[libwnck] [tasklist] Fix a GSeal issue
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck] [tasklist] Fix a GSeal issue
- Date: Thu, 11 Mar 2010 00:06:15 +0000 (UTC)
commit 4a2eea3d1675da582daa07f0db2f6fffb8ca943c
Author: Vincent Untz <vuntz gnome org>
Date: Thu Mar 11 01:04:02 2010 +0100
[tasklist] Fix a GSeal issue
We were using the event_window field of GtkButton, which is sealed with
no accessor (that makes sense). What we're interested in is the position
of the GtkButton on the screen, and it's easy to find it another way.
There's just a small trick: the window of a GtkButton is actually the
window of its parent; once we know this, we just need to use the
allocation information to get the relative position and we can deduce
the absolution position of the widget.
libwnck/tasklist.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index 9906a0b..9e1c6ad 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -2471,12 +2471,20 @@ wnck_tasklist_update_icon_geometries (WnckTasklist *tasklist,
if (!gtk_widget_get_realized (task->button))
continue;
+ /* Let's cheat with some internal knowledge of GtkButton: in a
+ * GtkButton, the window is the same as the parent window. So
+ * to know the position of the widget, we should use the
+ * the position of the parent window and the allocation information. */
+
gtk_widget_get_allocation (task->button, &allocation);
- gdk_window_get_origin (GTK_BUTTON (task->button)->event_window,
- &x, &y);
- width = allocation.width;
- height = allocation.height;
+ gdk_window_get_origin (gtk_widget_get_parent_window (task->button),
+ &x, &y);
+
+ x += allocation.x;
+ y += allocation.y;
+ width = allocation.width;
+ height = allocation.height;
if (task->window)
wnck_window_set_icon_geometry (task->window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]