From d5e660196ea18efccd11d07dc23a23d160186479 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Wed, 19 Jan 2011 22:30:21 +0100 Subject: core: Add Screen argument to _wnck_get_window(), _wnck_get_session_id() --- libwnck/screen.c | 6 ++++-- libwnck/window.c | 13 ++++++++----- libwnck/xutils.c | 13 +++++++++---- libwnck/xutils.h | 6 ++++-- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/libwnck/screen.c b/libwnck/screen.c index a78c460..eb5ee71 100644 --- a/libwnck/screen.c +++ b/libwnck/screen.c @@ -1993,7 +1993,8 @@ update_active_window (WnckScreen *screen) screen->priv->need_update_active_window = FALSE; xwindow = None; - _wnck_get_window (screen->priv->xroot, + _wnck_get_window (WNCK_SCREEN_XSCREEN (screen), + screen->priv->xroot, _wnck_atom_get ("_NET_ACTIVE_WINDOW"), &xwindow); @@ -2193,7 +2194,8 @@ update_wm (WnckScreen *screen) screen->priv->need_update_wm = FALSE; wm_window = None; - _wnck_get_window (screen->priv->xroot, + _wnck_get_window (WNCK_SCREEN_XSCREEN (screen), + screen->priv->xroot, _wnck_atom_get ("_NET_SUPPORTING_WM_CHECK"), &wm_window); diff --git a/libwnck/window.c b/libwnck/window.c index aa0bd3a..68e7647 100644 --- a/libwnck/window.c +++ b/libwnck/window.c @@ -499,6 +499,7 @@ _wnck_window_create (Window xwindow, gint sort_order) { WnckWindow *window; + Screen *xscreen; if (window_hash == NULL) window_hash = g_hash_table_new (_wnck_xid_hash, _wnck_xid_equal); @@ -506,6 +507,8 @@ _wnck_window_create (Window xwindow, g_return_val_if_fail (g_hash_table_lookup (window_hash, &xwindow) == NULL, NULL); + xscreen = WNCK_SCREEN_XSCREEN (screen); + window = g_object_new (WNCK_TYPE_WINDOW, NULL); window->priv->xwindow = xwindow; window->priv->screen = screen; @@ -527,17 +530,16 @@ _wnck_window_create (Window xwindow, window->priv->group_leader = window->priv->xwindow; window->priv->session_id = - _wnck_get_session_id (window->priv->xwindow); + _wnck_get_session_id (xscreen, window->priv->xwindow); window->priv->pid = - _wnck_get_pid (WNCK_SCREEN_XSCREEN (window->priv->screen), - window->priv->xwindow); + _wnck_get_pid (xscreen, window->priv->xwindow); window->priv->x = 0; window->priv->y = 0; window->priv->width = 0; window->priv->height = 0; - _wnck_get_window_geometry (WNCK_SCREEN_XSCREEN (window->priv->screen), + _wnck_get_window_geometry (xscreen, xwindow, &window->priv->x, &window->priv->y, @@ -3005,7 +3007,8 @@ update_transient_for (WnckWindow *window) window->priv->need_update_transient_for = FALSE; parent = None; - if (_wnck_get_window (window->priv->xwindow, + if (_wnck_get_window (WNCK_SCREEN_XSCREEN (window->priv->screen), + window->priv->xwindow, _wnck_atom_get ("WM_TRANSIENT_FOR"), &parent) && parent != window->priv->xwindow) diff --git a/libwnck/xutils.c b/libwnck/xutils.c index dcf49c1..e892431 100644 --- a/libwnck/xutils.c +++ b/libwnck/xutils.c @@ -121,10 +121,12 @@ _wnck_get_wm_state (Screen *screen, } gboolean -_wnck_get_window (Window xwindow, +_wnck_get_window (Screen *screen, + Window xwindow, Atom atom, Window *val) { + Display *display; Atom type; int format; gulong nitems; @@ -132,11 +134,13 @@ _wnck_get_window (Window xwindow, Window *w; int err, result; + display = DisplayOfScreen (screen); + *val = 0; _wnck_error_trap_push (); type = None; - result = XGetWindowProperty (_wnck_get_default_display(), + result = XGetWindowProperty (display, xwindow, atom, 0, G_MAXLONG, @@ -1129,12 +1133,13 @@ _wnck_toggle_showing_desktop (Screen *screen, } char* -_wnck_get_session_id (Window xwindow) +_wnck_get_session_id (Screen *screen, + Window xwindow) { Window client_leader; client_leader = None; - _wnck_get_window (xwindow, + _wnck_get_window (screen, xwindow, _wnck_atom_get ("WM_CLIENT_LEADER"), &client_leader); diff --git a/libwnck/xutils.h b/libwnck/xutils.h index c32327a..6407cc0 100644 --- a/libwnck/xutils.h +++ b/libwnck/xutils.h @@ -44,7 +44,8 @@ gboolean _wnck_get_cardinal (Screen *screen, int *val); int _wnck_get_wm_state (Screen *screen, Window xwindow); -gboolean _wnck_get_window (Window xwindow, +gboolean _wnck_get_window (Screen *screen, + Window xwindow, Atom atom, Window *val); gboolean _wnck_get_pixmap (Window xwindow, @@ -113,7 +114,8 @@ void _wnck_change_viewport (Screen *screen, int x, int y); -char* _wnck_get_session_id (Window xwindow); +char* _wnck_get_session_id (Screen *screen, + Window xwindow); int _wnck_get_pid (Screen *screen, Window xwindow); char* _wnck_get_name (Window xwindow); -- cgit v1.2.1