window: Move _NET_WM_DESKTOP setting to window-x11

This commit is contained in:
Jasper St. Pierre 2014-05-20 15:46:21 -04:00
parent 3941dc7537
commit d02505852d
4 changed files with 52 additions and 40 deletions

View File

@ -477,6 +477,7 @@ struct _MetaWindowClass
MetaGrabOp op);
void (*grab_op_ended) (MetaWindow *window,
MetaGrabOp op);
void (*current_workspace_changed) (MetaWindow *window);
void (*move_resize_internal) (MetaWindow *window,
int gravity,
MetaRectangle requested_rect,
@ -615,9 +616,7 @@ void meta_window_update_unfocused_button_grabs (MetaWindow *window);
void meta_window_set_focused_internal (MetaWindow *window,
gboolean focused);
void meta_window_set_current_workspace_hint (MetaWindow *window);
unsigned long meta_window_get_net_wm_desktop (MetaWindow *window);
void meta_window_current_workspace_changed (MetaWindow *window);
void meta_window_show_menu (MetaWindow *window);

View File

@ -205,6 +205,11 @@ meta_window_real_grab_op_ended (MetaWindow *window,
window->shaken_loose = FALSE;
}
static void
meta_window_real_current_workspace_changed (MetaWindow *window)
{
}
static gboolean
meta_window_real_update_struts (MetaWindow *window)
{
@ -378,6 +383,7 @@ meta_window_class_init (MetaWindowClass *klass)
klass->grab_op_began = meta_window_real_grab_op_began;
klass->grab_op_ended = meta_window_real_grab_op_ended;
klass->current_workspace_changed = meta_window_real_current_workspace_changed;
klass->update_struts = meta_window_real_update_struts;
klass->get_default_skip_hints = meta_window_real_get_default_skip_hints;
@ -1130,7 +1136,7 @@ _meta_window_shared_new (MetaDisplay *display,
}
/* for the various on_all_workspaces = TRUE possible above */
meta_window_set_current_workspace_hint (window);
meta_window_current_workspace_changed (window);
meta_window_update_struts (window);
}
@ -1502,7 +1508,7 @@ meta_window_update_on_all_workspaces (MetaWindow *window)
tmp = tmp->next;
}
}
meta_window_set_current_workspace_hint (window);
meta_window_current_workspace_changed (window);
}
}
@ -4637,40 +4643,10 @@ meta_window_unstick (MetaWindow *window)
&stick);
}
unsigned long
meta_window_get_net_wm_desktop (MetaWindow *window)
{
if (window->on_all_workspaces)
return 0xFFFFFFFF;
else
return meta_workspace_index (window->workspace);
}
void
meta_window_set_current_workspace_hint (MetaWindow *window)
meta_window_current_workspace_changed (MetaWindow *window)
{
/* FIXME if on more than one workspace, we claim to be "sticky",
* the WM spec doesn't say what to do here.
*/
unsigned long data[1];
if (window->workspace == NULL)
{
/* this happens when unmanaging windows */
return;
}
data[0] = meta_window_get_net_wm_desktop (window);
meta_verbose ("Setting _NET_WM_DESKTOP of %s to %lu\n",
window->desc, data[0]);
meta_error_trap_push (window->display);
XChangeProperty (window->display->xdisplay, window->xwindow,
window->display->atom__NET_WM_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (window->display);
META_WINDOW_GET_CLASS (window)->current_workspace_changed (window);
}
static gboolean

View File

@ -342,7 +342,7 @@ meta_workspace_add_window (MetaWorkspace *workspace,
window->workspace = workspace;
meta_window_set_current_workspace_hint (window);
meta_window_current_workspace_changed (window);
if (window->struts)
{
@ -391,7 +391,7 @@ meta_workspace_remove_window (MetaWorkspace *workspace,
g_assert (g_list_find (workspace->mru_list, window) == NULL);
}
meta_window_set_current_workspace_hint (window);
meta_window_current_workspace_changed (window);
if (window->struts)
{
@ -718,7 +718,7 @@ meta_workspace_update_window_hints (MetaWorkspace *workspace)
{
MetaWindow *win = l->data;
meta_window_set_current_workspace_hint (win);
meta_window_current_workspace_changed (win);
l = l->next;
}

View File

@ -945,6 +945,42 @@ send_sync_request (MetaWindow *window)
meta_window_updates_are_frozen (window));
}
static unsigned long
meta_window_get_net_wm_desktop (MetaWindow *window)
{
if (window->on_all_workspaces)
return 0xFFFFFFFF;
else
return meta_workspace_index (window->workspace);
}
static void
meta_window_x11_current_workspace_changed (MetaWindow *window)
{
/* FIXME if on more than one workspace, we claim to be "sticky",
* the WM spec doesn't say what to do here.
*/
unsigned long data[1];
if (window->workspace == NULL)
{
/* this happens when unmanaging windows */
return;
}
data[0] = meta_window_get_net_wm_desktop (window);
meta_verbose ("Setting _NET_WM_DESKTOP of %s to %lu\n",
window->desc, data[0]);
meta_error_trap_push (window->display);
XChangeProperty (window->display->xdisplay, window->xwindow,
window->display->atom__NET_WM_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (window->display);
}
static void
meta_window_x11_move_resize_internal (MetaWindow *window,
int gravity,
@ -1426,6 +1462,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
window_class->focus = meta_window_x11_focus;
window_class->grab_op_began = meta_window_x11_grab_op_began;
window_class->grab_op_ended = meta_window_x11_grab_op_ended;
window_class->current_workspace_changed = meta_window_x11_current_workspace_changed;
window_class->move_resize_internal = meta_window_x11_move_resize_internal;
window_class->update_struts = meta_window_x11_update_struts;
window_class->get_default_skip_hints = meta_window_x11_get_default_skip_hints;