Skip to content

Commit

Permalink
Merge pull request mate-desktop#3 from benpicco/features
Browse files Browse the repository at this point in the history
new marco features
  • Loading branch information
szesch committed May 10, 2012
2 parents 6e5c6ab + e2d0da8 commit ce3d3a4
Show file tree
Hide file tree
Showing 11 changed files with 315 additions and 65 deletions.
36 changes: 36 additions & 0 deletions src/core/bell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ... */
Expand Down
3 changes: 2 additions & 1 deletion src/core/display-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
121 changes: 79 additions & 42 deletions src/core/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))))

Expand Down Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down
11 changes: 11 additions & 0 deletions src/core/keybindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
{
Expand Down
25 changes: 24 additions & 1 deletion src/core/prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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";

Expand All @@ -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";

Expand Down
Loading

0 comments on commit ce3d3a4

Please sign in to comment.