[gnome-panel] [panel] Stop using deprecated gdk_display/GDK_DISPLAY()
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] [panel] Stop using deprecated gdk_display/GDK_DISPLAY()
- Date: Sat, 11 Sep 2010 11:43:51 +0000 (UTC)
commit 79db993fb64b252ab99e2aeec957d6fb58b5acd6
Author: Vincent Untz <vuntz gnome org>
Date: Sat Sep 11 13:41:40 2010 +0200
[panel] Stop using deprecated gdk_display/GDK_DISPLAY()
gnome-panel/panel-force-quit.c | 29 +++++++++++++++++------------
gnome-panel/panel-xutils.c | 9 ++++++---
gnome-panel/xstuff.c | 2 +-
3 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/gnome-panel/panel-force-quit.c b/gnome-panel/panel-force-quit.c
index 7a98fcd..6f663b2 100644
--- a/gnome-panel/panel-force-quit.c
+++ b/gnome-panel/panel-force-quit.c
@@ -112,7 +112,8 @@ remove_popup (GtkWidget *popup)
}
static gboolean
-wm_state_set (Window window)
+wm_state_set (Display *display,
+ Window window)
{
gulong nitems;
gulong bytes_after;
@@ -122,7 +123,7 @@ wm_state_set (Window window)
int result;
gdk_error_trap_push ();
- result = XGetWindowProperty (gdk_display, window, wm_state_atom,
+ result = XGetWindowProperty (display, window, wm_state_atom,
0, G_MAXLONG, False, wm_state_atom,
&ret_type, &ret_format, &nitems,
&bytes_after, (gpointer) &prop);
@@ -142,7 +143,8 @@ wm_state_set (Window window)
}
static Window
-find_managed_window (Window window)
+find_managed_window (Display *display,
+ Window window)
{
Window root;
Window parent;
@@ -151,23 +153,23 @@ find_managed_window (Window window)
guint nkids;
int i, result;
- if (wm_state_set (window))
+ if (wm_state_set (display, window))
return window;
gdk_error_trap_push ();
- result = XQueryTree (gdk_display, window, &root, &parent, &kids, &nkids);
+ result = XQueryTree (display, window, &root, &parent, &kids, &nkids);
if (gdk_error_trap_pop () || !result)
return None;
retval = None;
for (i = 0; i < nkids; i++) {
- if (wm_state_set (kids [i])) {
+ if (wm_state_set (display, kids [i])) {
retval = kids [i];
break;
}
- retval = find_managed_window (kids [i]);
+ retval = find_managed_window (display, kids [i]);
if (retval != None)
break;
}
@@ -184,10 +186,13 @@ kill_window_response (GtkDialog *dialog,
gpointer user_data)
{
if (response_id == GTK_RESPONSE_ACCEPT) {
+ Display *display;
Window window = (Window) user_data;
+ display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (dialog)));
+
gdk_error_trap_push ();
- XKillClient (gdk_display, window);
+ XKillClient (display, window);
gdk_flush ();
gdk_error_trap_pop ();
}
@@ -241,12 +246,12 @@ handle_button_press_event (GtkWidget *popup,
return;
if (wm_state_atom == None)
- wm_state_atom = XInternAtom (gdk_display, "WM_STATE", FALSE);
+ wm_state_atom = XInternAtom (event->display, "WM_STATE", FALSE);
- window = find_managed_window (event->subwindow);
+ window = find_managed_window (event->display, event->subwindow);
if (window != None) {
- if (!gdk_xid_table_lookup_for_display (gdk_display_get_default (), window))
+ if (!gdk_xid_table_lookup_for_display (gdk_x11_lookup_xdisplay (event->display), window))
kill_window_question ((gpointer) window);
}
}
@@ -263,7 +268,7 @@ popup_filter (GdkXEvent *gdk_xevent,
handle_button_press_event (popup, &xevent->xkey);
return GDK_FILTER_REMOVE;
case KeyPress:
- if (xevent->xkey.keycode == XKeysymToKeycode (gdk_display, XK_Escape)) {
+ if (xevent->xkey.keycode == XKeysymToKeycode (xevent->xany.display, XK_Escape)) {
remove_popup (popup);
return GDK_FILTER_REMOVE;
}
diff --git a/gnome-panel/panel-xutils.c b/gnome-panel/panel-xutils.c
index 16cdf67..4480f19 100644
--- a/gnome-panel/panel-xutils.c
+++ b/gnome-panel/panel-xutils.c
@@ -175,6 +175,7 @@ guint
panel_get_real_modifier_mask (guint mask)
{
guint real_mask;
+ Display *display;
int i, min_keycode, max_keycode, keysyms_per_keycode;
int max_keycodes_per_modifier;
KeySym *keysyms_for_keycodes;
@@ -187,13 +188,15 @@ panel_get_real_modifier_mask (guint mask)
return mask;
}
- XDisplayKeycodes (GDK_DISPLAY (), &min_keycode, &max_keycode);
- keysyms_for_keycodes = XGetKeyboardMapping (GDK_DISPLAY (),
+ display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+
+ XDisplayKeycodes (display, &min_keycode, &max_keycode);
+ keysyms_for_keycodes = XGetKeyboardMapping (display,
min_keycode,
max_keycode - min_keycode + 1,
&keysyms_per_keycode);
- modifier_keymap = XGetModifierMapping (GDK_DISPLAY ());
+ modifier_keymap = XGetModifierMapping (display);
max_keycodes_per_modifier = modifier_keymap->max_keypermod;
/* Loop through all the modifiers and find out which "real"
diff --git a/gnome-panel/xstuff.c b/gnome-panel/xstuff.c
index 6a44d50..0ba272a 100644
--- a/gnome-panel/xstuff.c
+++ b/gnome-panel/xstuff.c
@@ -643,7 +643,7 @@ xstuff_get_current_workspace (GdkScreen *screen)
gdk_screen_get_root_window (screen));
gdk_error_trap_push ();
- result = XGetWindowProperty (gdk_display,
+ result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen)),
root_window,
panel_atom_get ("_NET_CURRENT_DESKTOP"),
0, G_MAXLONG,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]