diff options
author | Steve Zesch <[email protected]> | 2012-05-10 13:08:46 -0700 |
---|---|---|
committer | Steve Zesch <[email protected]> | 2012-05-10 13:08:46 -0700 |
commit | ce3d3a4b6e0a93eea4d54ac4bc2907b7432e136b (patch) | |
tree | 81f0b3024b3440b881b9e61e165a93d23ca0b22d /src | |
parent | 6e5c6ab190ca9bddf0e2b694abd0100ab5fcc11c (diff) | |
parent | e2d0da87ec3f7add9643c7f7f424df080d95d8dc (diff) | |
download | marco-ce3d3a4b6e0a93eea4d54ac4bc2907b7432e136b.tar.bz2 marco-ce3d3a4b6e0a93eea4d54ac4bc2907b7432e136b.tar.xz |
Merge pull request #3 from benpicco/features
new marco features
Diffstat (limited to 'src')
-rw-r--r-- | src/core/bell.c | 36 | ||||
-rw-r--r-- | src/core/display-private.h | 3 | ||||
-rw-r--r-- | src/core/display.c | 121 | ||||
-rw-r--r-- | src/core/keybindings.c | 11 | ||||
-rw-r--r-- | src/core/prefs.c | 25 | ||||
-rw-r--r-- | src/core/workspace.c | 87 | ||||
-rw-r--r-- | src/include/all-keybindings.h | 6 | ||||
-rw-r--r-- | src/include/common.h | 13 | ||||
-rw-r--r-- | src/include/prefs.h | 2 | ||||
-rw-r--r-- | src/marco.schemas.in.in | 23 | ||||
-rw-r--r-- | src/ui/frames.c | 53 |
11 files changed, 315 insertions, 65 deletions
diff --git a/src/core/bell.c b/src/core/bell.c index 560b3569..efbfb7fd 100644 --- a/src/core/bell.c +++ b/src/core/bell.c @@ -300,10 +300,46 @@ meta_bell_notify (MetaDisplay *display, if (window) { + int x=-1, y=-1, width=-1, height=-1, screen_width=-1, screen_height=-1; + MetaScreen *screen; + + screen = meta_window_get_screen (window); + ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title); ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow); + ca_proplist_setf (p, CA_PROP_WINDOW_X11_SCREEN, "%i", meta_screen_get_screen_number(screen)); ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name); ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid); + + /* properties for positional sound based on window placement */ + meta_window_get_geometry (window, &x, &y, &width, &height); + ca_proplist_setf (p, CA_PROP_WINDOW_X, "%i", x); + ca_proplist_setf (p, CA_PROP_WINDOW_Y, "%i", y); + ca_proplist_setf (p, CA_PROP_WINDOW_WIDTH, "%i", width); + ca_proplist_setf (p, CA_PROP_WINDOW_HEIGHT, "%i", height); + + meta_screen_get_size (screen, &screen_width, &screen_height); + if (screen_width > 1) + { + x += width/2; + x = CLAMP(x, 0, screen_width-1); + + /* From libcanberra-gtk. + * We use these strange format strings here to avoid that libc + * applies locale information on the formatting of floating + * numbers. */ + + ca_proplist_setf (p, CA_PROP_WINDOW_HPOS, "%i.%03i", + (int) (x/(screen_width-1)), (int) (1000.0*x/(screen_width-1)) % 1000); + } + if (screen_height > 1) + { + y += height/2; + y = CLAMP(y, 0, screen_height-1); + + ca_proplist_setf (p, CA_PROP_WINDOW_VPOS, "%i.%03i", + (int) (y/(screen_height-1)), (int) (1000.0*y/(screen_height-1)) % 1000); + } } /* First, we try to play a real sound ... */ diff --git a/src/core/display-private.h b/src/core/display-private.h index 692e25f2..c59c5e19 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -445,7 +445,8 @@ typedef enum { META_TAB_LIST_NORMAL, META_TAB_LIST_DOCKS, - META_TAB_LIST_GROUP + META_TAB_LIST_GROUP, + META_TAB_LIST_NORMAL_ALL_WORKSPACES } MetaTabList; typedef enum diff --git a/src/core/display.c b/src/core/display.c index 59ec9021..647581f5 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -90,7 +90,9 @@ (g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL || \ g == META_GRAB_OP_KEYBOARD_TABBING_DOCK || \ g == META_GRAB_OP_KEYBOARD_TABBING_GROUP || \ + g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES || \ g == META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL || \ + g == META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES || \ g == META_GRAB_OP_KEYBOARD_ESCAPING_DOCK || \ g == META_GRAB_OP_KEYBOARD_ESCAPING_GROUP) @@ -1141,9 +1143,11 @@ grab_op_is_keyboard (MetaGrabOp op) case META_GRAB_OP_KEYBOARD_RESIZING_SW: case META_GRAB_OP_KEYBOARD_RESIZING_NW: case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: case META_GRAB_OP_KEYBOARD_TABBING_GROUP: case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP: case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: @@ -3625,12 +3629,23 @@ meta_display_begin_grab_op (MetaDisplay *display, META_TAB_LIST_NORMAL, META_TAB_SHOW_ICON); break; + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: + meta_screen_ensure_tab_popup (screen, + META_TAB_LIST_NORMAL_ALL_WORKSPACES, + META_TAB_SHOW_ICON); + break; case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: meta_screen_ensure_tab_popup (screen, META_TAB_LIST_NORMAL, META_TAB_SHOW_INSTANTLY); break; + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: + meta_screen_ensure_tab_popup (screen, + META_TAB_LIST_NORMAL_ALL_WORKSPACES, + META_TAB_SHOW_INSTANTLY); + break; + case META_GRAB_OP_KEYBOARD_TABBING_DOCK: meta_screen_ensure_tab_popup (screen, META_TAB_LIST_DOCKS, @@ -4441,7 +4456,9 @@ get_focussed_group (MetaDisplay *display) return NULL; } -#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \ +#define IN_TAB_CHAIN(w,t) \ + (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \ + || ((t) == META_TAB_LIST_NORMAL_ALL_WORKSPACES && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \ || ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \ || ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focussed_group(w->display)))) @@ -4532,56 +4549,76 @@ GList* meta_display_get_tab_list (MetaDisplay *display, MetaTabList type, MetaScreen *screen, - MetaWorkspace *workspace) + MetaWorkspace *active_workspace) { - GList *tab_list; + GList *tab_list, *workspace_list, *l, link; + MetaWorkspace *workspace; - g_return_val_if_fail (workspace != NULL, NULL); + g_return_val_if_fail (active_workspace != NULL, NULL); + + if (type == META_TAB_LIST_NORMAL_ALL_WORKSPACES) + { + workspace_list = screen->workspaces; + type = META_TAB_LIST_NORMAL; + } + else + { + link.next = NULL; + link.prev = NULL; + link.data = active_workspace; + workspace_list = &link; + } + tab_list = NULL; /* Windows sellout mode - MRU order. Collect unminimized windows * then minimized so minimized windows aren't in the way so much. */ - { - GList *tmp; - - tab_list = NULL; - tmp = workspace->mru_list; - while (tmp != NULL) - { - MetaWindow *window = tmp->data; - - if (!window->minimized && - window->screen == screen && - IN_TAB_CHAIN (window, type)) - tab_list = g_list_prepend (tab_list, window); - - tmp = tmp->next; - } - } - - { - GList *tmp; - - tmp = workspace->mru_list; - while (tmp != NULL) - { - MetaWindow *window = tmp->data; - - if (window->minimized && - window->screen == screen && - IN_TAB_CHAIN (window, type)) - tab_list = g_list_prepend (tab_list, window); - - tmp = tmp->next; - } - } - + for (l = workspace_list; l != NULL; l = l->next) + { + GList *tmp; + + workspace = l->data; + + tmp = workspace->mru_list; + while (tmp != NULL) + { + MetaWindow *window = tmp->data; + + if (!window->minimized && + window->screen == screen && + IN_TAB_CHAIN (window, type)) + tab_list = g_list_prepend (tab_list, window); + + tmp = tmp->next; + } + } + + for (l = workspace_list; l != NULL; l = l->next) + { + GList *tmp; + + workspace = l->data; + + tmp = workspace->mru_list; + while (tmp != NULL) + { + MetaWindow *window = tmp->data; + + if (window->minimized && + window->screen == screen && + IN_TAB_CHAIN (window, type)) + tab_list = g_list_prepend (tab_list, window); + + tmp = tmp->next; + } + } + tab_list = g_list_reverse (tab_list); - + { GSList *tmp; MetaWindow *l_window; - + tmp = meta_display_list_windows (display); /* Go through all windows */ @@ -4591,7 +4628,7 @@ meta_display_get_tab_list (MetaDisplay *display, /* Check to see if it demands attention */ if (l_window->wm_state_demands_attention && - l_window->workspace!=workspace && + l_window->workspace!=active_workspace && IN_TAB_CHAIN (l_window, type)) { /* if it does, add it to the popup */ diff --git a/src/core/keybindings.c b/src/core/keybindings.c index b9371c85..e1d87920 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1340,9 +1340,11 @@ meta_display_process_key_event (MetaDisplay *display, break; case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: case META_GRAB_OP_KEYBOARD_TABBING_GROUP: case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP: meta_topic (META_DEBUG_KEYBINDINGS, @@ -2029,6 +2031,7 @@ process_tab_grab (MetaDisplay *display, target_window->desc); display->mouse_mode = FALSE; meta_window_activate (target_window, event->xkey.time); + meta_workspace_activate (target_window->workspace, event->xkey.time); meta_topic (META_DEBUG_KEYBINDINGS, "Ending grab early so we can focus the target window\n"); @@ -2070,6 +2073,7 @@ process_tab_grab (MetaDisplay *display, switch (display->grab_op) { case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL: + case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: /* carry on */ break; @@ -2087,6 +2091,7 @@ process_tab_grab (MetaDisplay *display, switch (display->grab_op) { case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES: case META_GRAB_OP_KEYBOARD_TABBING_DOCK: /* carry on */ break; @@ -2810,6 +2815,8 @@ tab_op_from_tab_type (MetaTabList type) { case META_TAB_LIST_NORMAL: return META_GRAB_OP_KEYBOARD_TABBING_NORMAL; + case META_TAB_LIST_NORMAL_ALL_WORKSPACES: + return META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES; case META_TAB_LIST_DOCKS: return META_GRAB_OP_KEYBOARD_TABBING_DOCK; case META_TAB_LIST_GROUP: @@ -2828,6 +2835,8 @@ cycle_op_from_tab_type (MetaTabList type) { case META_TAB_LIST_NORMAL: return META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL; + case META_TAB_LIST_NORMAL_ALL_WORKSPACES: + return META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES; case META_TAB_LIST_DOCKS: return META_GRAB_OP_KEYBOARD_ESCAPING_DOCK; case META_TAB_LIST_GROUP: @@ -2888,6 +2897,7 @@ do_choose_window (MetaDisplay *display, initial_selection->desc); display->mouse_mode = FALSE; meta_window_activate (initial_selection, event->xkey.time); + meta_workspace_activate (initial_selection->workspace, event->xkey.time); } else if (meta_display_begin_grab_op (display, screen, @@ -2917,6 +2927,7 @@ do_choose_window (MetaDisplay *display, meta_display_end_grab_op (display, event->xkey.time); display->mouse_mode = FALSE; meta_window_activate (initial_selection, event->xkey.time); + meta_workspace_activate (initial_selection->workspace, event->xkey.time); } else { diff --git a/src/core/prefs.c b/src/core/prefs.c index 494d3da1..5b546f57 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -81,6 +81,7 @@ static MetaFocusNewWindows focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART; static gboolean raise_on_click = TRUE; static char* current_theme = NULL; static int num_workspaces = 4; +static MetaWrapStyle wrap_style = META_WRAP_NONE; static MetaActionTitlebar action_double_click_titlebar = META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE; static MetaActionTitlebar action_middle_click_titlebar = META_ACTION_TITLEBAR_LOWER; static MetaActionTitlebar action_right_click_titlebar = META_ACTION_TITLEBAR_MENU; @@ -188,6 +189,14 @@ static MateConfEnumStringPair symtab_focus_new_windows[] = { 0, NULL }, }; +static MateConfEnumStringPair symtab_wrap_style[] = + { + { META_WRAP_NONE, "no wrap" }, + { META_WRAP_CLASSIC, "classic" }, + { META_WRAP_TOROIDAL, "toroidal" }, + { 0, NULL }, + }; + static MateConfEnumStringPair symtab_visual_bell_type[] = { /* Note to the reader: 0 is an invalid value; these start at 1. */ @@ -327,6 +336,11 @@ static MetaEnumPreference preferences_enum[] = symtab_focus_mode, &focus_mode, }, + { "/apps/marco/general/wrap_style", + META_PREF_WRAP_STYLE, + symtab_wrap_style, + &wrap_style, + }, { "/apps/marco/general/visual_bell_type", META_PREF_VISUAL_BELL_TYPE, symtab_visual_bell_type, @@ -1642,6 +1656,12 @@ meta_prefs_get_num_workspaces (void) return num_workspaces; } +MetaWrapStyle +meta_prefs_get_wrap_style (void) +{ + return wrap_style; +} + gboolean meta_prefs_get_application_based (void) { @@ -1679,7 +1699,7 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_RAISE_ON_CLICK: return "RAISE_ON_CLICK"; - + case META_PREF_THEME: return "THEME"; @@ -1689,6 +1709,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_NUM_WORKSPACES: return "NUM_WORKSPACES"; + case META_PREF_WRAP_STYLE: + return "WRAP_STYLE"; + case META_PREF_APPLICATION_BASED: return "APPLICATION_BASED"; diff --git a/src/core/workspace.c b/src/core/workspace.c index 2b28fe0b..9694c1f9 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -809,21 +809,23 @@ MetaWorkspace* meta_workspace_get_neighbor (MetaWorkspace *workspace, MetaMotionDirection direction) { - MetaWorkspaceLayout layout; + MetaWorkspaceLayout layout; int i, current_space, num_workspaces; gboolean ltr; + MetaWrapStyle wrap; current_space = meta_workspace_index (workspace); num_workspaces = meta_screen_get_n_workspaces (workspace->screen); meta_screen_calc_workspace_layout (workspace->screen, num_workspaces, current_space, &layout); + wrap = meta_prefs_get_wrap_style(); meta_verbose ("Getting neighbor of %d in direction %s\n", current_space, meta_motion_direction_to_string (direction)); - + ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR; - switch (direction) + switch (direction) { case META_MOTION_LEFT: layout.current_col -= ltr ? 1 : -1; @@ -839,14 +841,81 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, break; } + /* LEFT */ if (layout.current_col < 0) - layout.current_col = 0; + switch (wrap) + { + case META_WRAP_NONE: + layout.current_col = 0; + break; + case META_WRAP_TOROIDAL: + layout.current_row = layout.current_row > 0 ? layout.current_row - 1 : layout.rows - 1; + /* fall through */ + case META_WRAP_CLASSIC: + layout.current_col = layout.cols - 1; + } + /* RIGHT */ if (layout.current_col >= layout.cols) - layout.current_col = layout.cols - 1; + switch (wrap) + { + case META_WRAP_NONE: + layout.current_col = layout.cols - 1; + break; + case META_WRAP_TOROIDAL: + layout.current_row = layout.current_row < layout.rows - 1 ? layout.current_row + 1 : 0; + /* fall through */ + case META_WRAP_CLASSIC: + layout.current_col = 0; + } + /* UP */ if (layout.current_row < 0) - layout.current_row = 0; + switch (wrap) + { + case META_WRAP_NONE: + layout.current_row = 0; + break; + case META_WRAP_TOROIDAL: + layout.current_col = layout.current_col > 0 ? layout.current_col - 1 : layout.cols - 1; + /* fall through */ + case META_WRAP_CLASSIC: + layout.current_row = layout.rows - 1; + } + /* DOWN */ if (layout.current_row >= layout.rows) - layout.current_row = layout.rows - 1; + switch (wrap) + { + case META_WRAP_NONE: + layout.current_row = layout.rows - 1; + break; + case META_WRAP_TOROIDAL: + layout.current_col = layout.current_col < layout.cols - 1 ? layout.current_col + 1 : 0; + /* fall through */ + case META_WRAP_CLASSIC: + layout.current_row = 0; + } + + /* If we have an uneven arrangement of workspaces, (layout.cols - n, layout.rows - 1) may be an invalid workspace + e.g. we have 7 workspaces on a 3x3 pane */ + if (wrap != META_WRAP_NONE && (layout.current_row * layout.cols + layout.current_col >= num_workspaces)) + switch (direction) + { + case META_MOTION_LEFT: + layout.current_col = num_workspaces - (layout.current_row * layout.cols + 1); + break; + case META_MOTION_RIGHT: + layout.current_col = 0; + if (wrap == META_WRAP_TOROIDAL) + layout.current_row = 0; + break; + case META_MOTION_UP: + layout.current_row -= 1; + break; + case META_MOTION_DOWN: + layout.current_row = 0; + if (wrap == META_WRAP_TOROIDAL) + layout.current_col = layout.current_col < layout.cols - 1 ? layout.current_col + 1 : 0; + break; + } i = layout.grid[layout.current_row * layout.cols + layout.current_col]; @@ -856,12 +925,12 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace, if (i >= num_workspaces) meta_bug ("calc_workspace_layout left an invalid (too-high) workspace number %d in the grid\n", i); - + meta_verbose ("Neighbor workspace is %d at row %d col %d\n", i, layout.current_row, layout.current_col); meta_screen_free_workspace_layout (&layout); - + return meta_screen_get_workspace_by_index (workspace->screen, i); } diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h index ee9b5d37..26834454 100644 --- a/src/include/all-keybindings.h +++ b/src/include/all-keybindings.h @@ -158,6 +158,12 @@ keybind (switch_windows, handle_switch, META_TAB_LIST_NORMAL, keybind (switch_windows_backward, handle_switch, META_TAB_LIST_NORMAL, REVERSES_AND_REVERSED, NULL, _("Move backward between windows, using a popup window")) +keybind (switch_windows_all, handle_switch, META_TAB_LIST_NORMAL_ALL_WORKSPACES, + BINDING_REVERSES, NULL, + _("Move between windows on all workspaces, using a popup window")) +keybind (switch_windows_all_backward,handle_switch, META_TAB_LIST_NORMAL_ALL_WORKSPACES, + REVERSES_AND_REVERSED, NULL, + _("Move backward between windows on all workspaces, using a popup window")) keybind (switch_panels, handle_switch, META_TAB_LIST_DOCKS, BINDING_REVERSES, "<Control><Alt>Tab", _("Move between panels and the desktop, using a popup window")) diff --git a/src/include/common.h b/src/include/common.h index ccb592f6..a7eb89b1 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -116,9 +116,11 @@ typedef enum /* Alt+Tab */ META_GRAB_OP_KEYBOARD_TABBING_NORMAL, META_GRAB_OP_KEYBOARD_TABBING_DOCK, + META_GRAB_OP_KEYBOARD_TABBING_NORMAL_ALL_WORKSPACES, /* Alt+Esc */ META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL, + META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL_ALL_WORKSPACES, META_GRAB_OP_KEYBOARD_ESCAPING_DOCK, META_GRAB_OP_KEYBOARD_ESCAPING_GROUP, @@ -131,7 +133,11 @@ typedef enum /* Frame button ops */ META_GRAB_OP_CLICKING_MINIMIZE, META_GRAB_OP_CLICKING_MAXIMIZE, + META_GRAB_OP_CLICKING_MAXIMIZE_VERTICAL, + META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL, META_GRAB_OP_CLICKING_UNMAXIMIZE, + META_GRAB_OP_CLICKING_UNMAXIMIZE_VERTICAL, + META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL, META_GRAB_OP_CLICKING_DELETE, META_GRAB_OP_CLICKING_MENU, META_GRAB_OP_CLICKING_SHADE, @@ -173,6 +179,13 @@ typedef enum typedef enum { + META_WRAP_NONE, + META_WRAP_CLASSIC, + META_WRAP_TOROIDAL +} MetaWrapStyle; + +typedef enum +{ META_ACTION_TITLEBAR_TOGGLE_SHADE, META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE, META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY, diff --git a/src/include/prefs.h b/src/include/prefs.h index 39597f9f..58814130 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -43,6 +43,7 @@ typedef enum META_PREF_THEME, META_PREF_TITLEBAR_FONT, META_PREF_NUM_WORKSPACES, + META_PREF_WRAP_STYLE, META_PREF_APPLICATION_BASED, META_PREF_KEYBINDINGS, META_PREF_DISABLE_WORKAROUNDS, @@ -88,6 +89,7 @@ gboolean meta_prefs_get_application_based (void); gboolean meta_prefs_get_disable_workarounds (void); gboolean meta_prefs_get_auto_raise (void); int meta_prefs_get_auto_raise_delay (void); +MetaWrapStyle meta_prefs_get_wrap_style (void); gboolean meta_prefs_get_reduced_resources (void); gboolean meta_prefs_get_mate_accessibility (void); gboolean meta_prefs_get_mate_animations (void); diff --git a/src/marco.schemas.in.in b/src/marco.schemas.in.in index acd342b4..ca03ab70 100644 --- a/src/marco.schemas.in.in +++ b/src/marco.schemas.in.in @@ -307,6 +307,29 @@ </schema> <schema> + <key>/schemas/apps/marco/general/wrap_style</key> + <applyto>/apps/marco/general/wrap_style</applyto> + <owner>marco</owner> + <type>string</type> + <default>no wrap</default> + <locale name="C"> + <short>Workspace wrap style</short> + <long> + The wrap style is used to determine how to switch from one + workspace to another at the border of the workspace switcher. + When set to "no wrap", nothing will happen if you try to + switch to a workspace past the border of the workspace switcher. + If set to "classic", the old marco behavior is used: + the end of one row leads to the beginning of the next and + the end of a column leads to the beginning of the next. + If set to "toroidal", workspaces are connected like a doughnut: + the end of each row leads to its own beginning and the + end of each column leads to its own beginning. + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/marco/general/visual_bell</key> <applyto>/apps/marco/general/visual_bell</applyto> <owner>marco</owner> diff --git a/src/ui/frames.c b/src/ui/frames.c index bb4c863c..c3cfc0ea 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -1443,10 +1443,8 @@ meta_frames_button_press_event (GtkWidget *widget, META_GRAB_OP_NONE) return FALSE; /* already up to something */ - if (event->button == 1 && - (control == META_FRAME_CONTROL_MAXIMIZE || - control == META_FRAME_CONTROL_UNMAXIMIZE || - control == META_FRAME_CONTROL_MINIMIZE || + if ((event->button == 1 && + (control == META_FRAME_CONTROL_MINIMIZE || control == META_FRAME_CONTROL_DELETE || control == META_FRAME_CONTROL_SHADE || control == META_FRAME_CONTROL_UNSHADE || @@ -1454,7 +1452,9 @@ meta_frames_button_press_event (GtkWidget *widget, control == META_FRAME_CONTROL_UNABOVE || control == META_FRAME_CONTROL_STICK || control == META_FRAME_CONTROL_UNSTICK || - control == META_FRAME_CONTROL_MENU)) + control == META_FRAME_CONTROL_MENU)) || + (control == META_FRAME_CONTROL_MAXIMIZE || + control == META_FRAME_CONTROL_UNMAXIMIZE)) { MetaGrabOp op = META_GRAB_OP_NONE; @@ -1464,9 +1464,12 @@ meta_frames_button_press_event (GtkWidget *widget, op = META_GRAB_OP_CLICKING_MINIMIZE; break; case META_FRAME_CONTROL_MAXIMIZE: - op = META_GRAB_OP_CLICKING_MAXIMIZE; + op = META_GRAB_OP_CLICKING_MAXIMIZE + event->button - 1; + op = op > META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL ? META_GRAB_OP_CLICKING_MAXIMIZE : op; break; case META_FRAME_CONTROL_UNMAXIMIZE: + op = META_GRAB_OP_CLICKING_UNMAXIMIZE + event->button - 1; + op = op > META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL ? META_GRAB_OP_CLICKING_UNMAXIMIZE : op; op = META_GRAB_OP_CLICKING_UNMAXIMIZE; break; case META_FRAME_CONTROL_DELETE: @@ -1710,20 +1713,36 @@ meta_frames_button_release_event (GtkWidget *widget, break; case META_GRAB_OP_CLICKING_MAXIMIZE: + case META_GRAB_OP_CLICKING_MAXIMIZE_VERTICAL: + case META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL: if (control == META_FRAME_CONTROL_MAXIMIZE) { /* Focus the window on the maximize */ meta_core_user_focus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, event->time); - meta_core_maximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + + if (op == META_GRAB_OP_CLICKING_MAXIMIZE) + meta_core_maximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + if (op == META_GRAB_OP_CLICKING_MAXIMIZE_VERTICAL) + meta_core_toggle_maximize_vertically (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + if (op == META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL) + meta_core_toggle_maximize_horizontally (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); } meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; case META_GRAB_OP_CLICKING_UNMAXIMIZE: - if (control == META_FRAME_CONTROL_UNMAXIMIZE) - meta_core_unmaximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + case META_GRAB_OP_CLICKING_UNMAXIMIZE_VERTICAL: + case META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL: + if (control == META_FRAME_CONTROL_UNMAXIMIZE) { + if (op == META_GRAB_OP_CLICKING_UNMAXIMIZE) + meta_core_unmaximize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + if (op == META_GRAB_OP_CLICKING_UNMAXIMIZE_VERTICAL) + meta_core_toggle_maximize_vertically (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + if (op == META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL) + meta_core_toggle_maximize_horizontally (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow); + } meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time); break; @@ -1930,7 +1949,11 @@ meta_frames_motion_notify_event (GtkWidget *widget, case META_GRAB_OP_CLICKING_DELETE: case META_GRAB_OP_CLICKING_MINIMIZE: case META_GRAB_OP_CLICKING_MAXIMIZE: + case META_GRAB_OP_CLICKING_MAXIMIZE_VERTICAL: + case META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL: case META_GRAB_OP_CLICKING_UNMAXIMIZE: + case META_GRAB_OP_CLICKING_UNMAXIMIZE_VERTICAL: + case META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL: case META_GRAB_OP_CLICKING_SHADE: case META_GRAB_OP_CLICKING_UNSHADE: case META_GRAB_OP_CLICKING_ABOVE: @@ -1956,7 +1979,11 @@ meta_frames_motion_notify_event (GtkWidget *widget, ((control == META_FRAME_CONTROL_MAXIMIZE || control == META_FRAME_CONTROL_UNMAXIMIZE) && (grab_op == META_GRAB_OP_CLICKING_MAXIMIZE || - grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE)) || + grab_op == META_GRAB_OP_CLICKING_MAXIMIZE_VERTICAL || + grab_op == META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL || + grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE || + grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE_VERTICAL || + grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL)) || (control == META_FRAME_CONTROL_SHADE && grab_op == META_GRAB_OP_CLICKING_SHADE) || (control == META_FRAME_CONTROL_UNSHADE && @@ -2387,13 +2414,15 @@ meta_frames_paint_to_drawable (MetaFrames *frames, button_states[META_BUTTON_TYPE_MINIMIZE] = META_BUTTON_STATE_PRELIGHT; break; case META_FRAME_CONTROL_MAXIMIZE: - if (grab_op == META_GRAB_OP_CLICKING_MAXIMIZE) + if (grab_op == META_GRAB_OP_CLICKING_MAXIMIZE || grab_op == META_GRAB_OP_CLICKING_MAXIMIZE_VERTICAL || + grab_op == META_GRAB_OP_CLICKING_MAXIMIZE_HORIZONTAL) button_states[META_BUTTON_TYPE_MAXIMIZE] = META_BUTTON_STATE_PRESSED; else button_states[META_BUTTON_TYPE_MAXIMIZE] = META_BUTTON_STATE_PRELIGHT; break; case META_FRAME_CONTROL_UNMAXIMIZE: - if (grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE) + if (grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE || grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE_VERTICAL || + grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL) button_states[META_BUTTON_TYPE_MAXIMIZE] = META_BUTTON_STATE_PRESSED; else button_states[META_BUTTON_TYPE_MAXIMIZE] = META_BUTTON_STATE_PRELIGHT; |