1
From cb969e989477e2671d1e0cdd1519866d61d0c98c Mon Sep 17 00:00:00 2001
2
From: Vincent Untz <vuntz@gnome.org>
3
Date: Tue, 01 Feb 2011 12:55:34 +0000
4
Subject: panel: Fix dbus applets to work in multiscreen environment
6
When the applet is created, the frame itself is not yet added to a
7
widget hierarchy, and is therefore not associated with any screen. So we
8
always sent the default screen as the one to be used to the applet.
10
We can simply use the screen of the PanelWidget that will contain the
13
https://bugzilla.gnome.org/show_bug.cgi?id=632369
15
diff --git a/gnome-panel/libpanel-applet-private/panel-applet-container.c b/gnome-panel/libpanel-applet-private/panel-applet-container.c
16
index eef163a..3fa947c 100644
17
--- a/gnome-panel/libpanel-applet-private/panel-applet-container.c
18
+++ b/gnome-panel/libpanel-applet-private/panel-applet-container.c
19
@@ -446,6 +446,7 @@ on_factory_appeared (GDBusConnection *connection,
22
panel_applet_container_get_applet (PanelAppletContainer *container,
26
GCancellable *cancellable,
27
@@ -454,7 +455,7 @@ panel_applet_container_get_applet (PanelAppletContainer *container,
29
GSimpleAsyncResult *result;
30
AppletFactoryData *data;
36
@@ -479,12 +480,14 @@ panel_applet_container_get_applet (PanelAppletContainer *container,
37
factory_id = g_strndup (iid, strlen (iid) - strlen (applet_id));
40
- screen = gdk_screen_get_number (gtk_widget_get_screen (container->priv->socket));
41
+ /* we can't use the screen of the container widget since it's not in a
42
+ * widget hierarchy yet */
43
+ screen_number = gdk_screen_get_number (screen);
45
data = g_new (AppletFactoryData, 1);
46
data->result = result;
47
data->factory_id = factory_id;
48
- data->parameters = g_variant_new ("(si*)", applet_id, screen, props);
49
+ data->parameters = g_variant_new ("(si*)", applet_id, screen_number, props);
50
data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
52
bus_name = g_strdup_printf (PANEL_APPLET_BUS_NAME, factory_id);
53
@@ -503,6 +506,7 @@ panel_applet_container_get_applet (PanelAppletContainer *container,
56
panel_applet_container_add (PanelAppletContainer *container,
59
GCancellable *cancellable,
60
GAsyncReadyCallback callback,
61
@@ -514,7 +518,7 @@ panel_applet_container_add (PanelAppletContainer *container,
63
panel_applet_container_cancel_pending_operations (container);
65
- panel_applet_container_get_applet (container, iid, properties,
66
+ panel_applet_container_get_applet (container, screen, iid, properties,
67
cancellable, callback, user_data);
70
diff --git a/gnome-panel/libpanel-applet-private/panel-applet-container.h b/gnome-panel/libpanel-applet-private/panel-applet-container.h
71
index 130bf16..e4de97a 100644
72
--- a/gnome-panel/libpanel-applet-private/panel-applet-container.h
73
+++ b/gnome-panel/libpanel-applet-private/panel-applet-container.h
74
@@ -73,6 +73,7 @@ GtkWidget *panel_applet_container_new (void);
77
void panel_applet_container_add (PanelAppletContainer *container,
80
GCancellable *cancellable,
81
GAsyncReadyCallback callback,
82
diff --git a/gnome-panel/libpanel-applet-private/panel-applet-frame-dbus.c b/gnome-panel/libpanel-applet-private/panel-applet-frame-dbus.c
83
index 9aaac15..dd3aecb 100644
84
--- a/gnome-panel/libpanel-applet-private/panel-applet-frame-dbus.c
85
+++ b/gnome-panel/libpanel-applet-private/panel-applet-frame-dbus.c
86
@@ -411,6 +411,7 @@ panel_applet_frame_dbus_load (const gchar *iid,
87
PanelAppletFrameDBus *dbus_frame;
88
PanelAppletFrame *frame;
89
GVariantBuilder builder;
94
@@ -425,6 +426,7 @@ panel_applet_frame_dbus_load (const gchar *iid,
95
frame = PANEL_APPLET_FRAME (dbus_frame);
96
_panel_applet_frame_set_iid (frame, iid);
98
+ screen = panel_applet_frame_activating_get_screen (frame_act);
99
orient = get_panel_applet_orient (panel_applet_frame_activating_get_orientation (frame_act));
100
conf_path = panel_applet_frame_activating_get_conf_path (frame_act);
101
/* we can't really get a background string at this point since we don't
102
@@ -456,7 +458,7 @@ panel_applet_frame_dbus_load (const gchar *iid,
103
g_object_set_data (G_OBJECT (frame), "panel-applet-frame-activating", frame_act);
105
panel_applet_container_add (dbus_frame->priv->container,
108
(GAsyncReadyCallback) panel_applet_frame_dbus_activated,
110
g_variant_builder_end (&builder));
111
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
112
index a411bf0..114e32f 100644
113
--- a/gnome-panel/panel-applet-frame.c
114
+++ b/gnome-panel/panel-applet-frame.c
115
@@ -805,6 +805,12 @@ panel_applet_frame_activating_free (PanelAppletFrameActivating *frame_act)
116
g_slice_free (PanelAppletFrameActivating, frame_act);
120
+panel_applet_frame_activating_get_screen (PanelAppletFrameActivating *frame_act)
122
+ return gtk_widget_get_screen (frame_act->panel);
126
panel_applet_frame_activating_get_orientation (PanelAppletFrameActivating *frame_act)
128
diff --git a/gnome-panel/panel-applet-frame.h b/gnome-panel/panel-applet-frame.h
129
index a459bb7..a551c4c 100644
130
--- a/gnome-panel/panel-applet-frame.h
131
+++ b/gnome-panel/panel-applet-frame.h
132
@@ -105,6 +105,7 @@ void panel_applet_frame_set_panel (PanelAppletFrame *frame,
134
typedef struct _PanelAppletFrameActivating PanelAppletFrameActivating;
136
+GdkScreen *panel_applet_frame_activating_get_screen (PanelAppletFrameActivating *frame_act);
137
PanelOrientation panel_applet_frame_activating_get_orientation (PanelAppletFrameActivating *frame_act);
138
guint32 panel_applet_frame_activating_get_size (PanelAppletFrameActivating *frame_act);
139
gboolean panel_applet_frame_activating_get_locked (PanelAppletFrameActivating *frame_act);
140
diff --git a/gnome-panel/panel-test-applets.c b/gnome-panel/panel-test-applets.c
141
index 58b1a3a..b302bc2 100644
142
--- a/gnome-panel/panel-test-applets.c
143
+++ b/gnome-panel/panel-test-applets.c
144
@@ -164,6 +164,7 @@ load_applet_into_window (const char *title,
145
g_variant_builder_add (&builder, "{sv}",
146
"orient", g_variant_new_uint32 (orientation));
147
panel_applet_container_add (PANEL_APPLET_CONTAINER (container),
148
+ gtk_widget_get_screen (applet_window),
150
(GAsyncReadyCallback)applet_activated_cb,