[notification-daemon] Properly get the workarea for positioning stacks
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [notification-daemon] Properly get the workarea for positioning stacks
- Date: Thu, 10 Feb 2011 02:45:04 +0000 (UTC)
commit e5facb84bb1c9de42313fd76cca407d7ade57905
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Feb 9 21:44:09 2011 -0500
Properly get the workarea for positioning stacks
This fixes https://bugzilla.gnome.org/show_bug.cgi?id=641997
src/nd-stack.c | 43 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/src/nd-stack.c b/src/nd-stack.c
index a72c09a..6c03acc 100644
--- a/src/nd-stack.c
+++ b/src/nd-stack.c
@@ -58,6 +58,38 @@ nd_stack_get_bubbles (NdStack *stack)
return stack->priv->bubbles;
}
+static int
+get_current_desktop (GdkScreen *screen)
+{
+ Display *display;
+ Window win;
+ Atom current_desktop, type;
+ int format;
+ unsigned long n_items, bytes_after;
+ unsigned char *data_return = NULL;
+ int workspace = 0;
+
+ display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+ win = XRootWindow (display, GDK_SCREEN_XNUMBER (screen));
+
+ current_desktop = XInternAtom (display, "_NET_CURRENT_DESKTOP", True);
+
+ XGetWindowProperty (display,
+ win,
+ current_desktop,
+ 0, G_MAXLONG,
+ False, XA_CARDINAL,
+ &type, &format, &n_items, &bytes_after,
+ &data_return);
+
+ if (type == XA_CARDINAL && format == 32 && n_items > 0)
+ workspace = (int) data_return[0];
+ if (data_return)
+ XFree (data_return);
+
+ return workspace;
+}
+
static gboolean
get_work_area (NdStack *stack,
GdkRectangle *rect)
@@ -73,6 +105,7 @@ get_work_area (NdStack *stack,
long *workareas;
int result;
int disp_screen;
+ int desktop;
Display *display;
display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (stack->priv->screen));
@@ -111,11 +144,13 @@ get_work_area (NdStack *stack,
return FALSE;
}
+ desktop = get_current_desktop (stack->priv->screen);
+
workareas = (long *) ret_workarea;
- rect->x = workareas[disp_screen * 4];
- rect->y = workareas[disp_screen * 4 + 1];
- rect->width = workareas[disp_screen * 4 + 2];
- rect->height = workareas[disp_screen * 4 + 3];
+ rect->x = workareas[desktop * 4];
+ rect->y = workareas[desktop * 4 + 1];
+ rect->width = workareas[desktop * 4 + 2];
+ rect->height = workareas[desktop * 4 + 3];
XFree (ret_workarea);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]