r3347 - trunk/src/target/OM-2007.2/daemons/neod/src
mickey at sita.openmoko.org
mickey at sita.openmoko.org
Sun Nov 4 16:45:41 CET 2007
Author: mickey
Date: 2007-11-04 16:45:41 +0100 (Sun, 04 Nov 2007)
New Revision: 3347
Modified:
trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
Log:
neod:
* fix popup menu positioning when screen has been rotated (closes #964), patch by Kristian Mueller: Thanks!
* do not attempt to close the today window, no matter its title (closes #972), patch by Kristian Mueller: Thanks!
Modified: trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
===================================================================
--- trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c 2007-11-04 15:31:08 UTC (rev 3346)
+++ trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c 2007-11-04 15:45:41 UTC (rev 3347)
@@ -176,6 +176,30 @@
return ret;
}
+/* Checks if type property of @window is "desktop window" */
+gboolean is_desktop_window( Window window )
+{
+ unsigned long nitems, bytesafter;
+ Atom *window_type = NULL;
+ Atom actual_type;
+ int actual_format;
+
+ Display* display = XOpenDisplay( NULL );
+
+ /* not using gdk_property_get() here, due to note at
+ * http://www.gtk.org/api/2.6/gdk/gdk-Properties-and-Atoms.html#gdk-property-get
+ */
+ XGetWindowProperty(display, window,
+ gdk_x11_get_xatom_by_name("_NET_WM_WINDOW_TYPE"), 0, 1, False,
+ XA_ATOM, &actual_type, &actual_format, &nitems, &bytesafter,
+ (unsigned char **) &window_type);
+
+ if (strcmp(XGetAtomName(display, *window_type), "_NET_WM_WINDOW_TYPE_DESKTOP") == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
gboolean neod_buttonactions_install_watcher()
{
int i = 0;
@@ -438,15 +462,22 @@
gtk_widget_size_request( GTK_WIDGET(menu), &req );
gint screen_width = gdk_screen_width();
gint screen_height = gdk_screen_height();
+ gboolean landscape_mode = gdk_screen_width() >= gdk_screen_height();
if ( GTK_WIDGET(menu) == aux_menu )
{
- *x = 0;
+ if (landscape_mode)
+ *x = screen_width - req.width;
+ else
+ *x = 0;
*y = 0;
}
else if ( GTK_WIDGET(menu) == power_menu )
{
- *x = screen_width - req.width;
+ if (landscape_mode)
+ *x = 0;
+ else
+ *x = screen_width - req.width;
*y = screen_height - req.height;
}
else
@@ -462,12 +493,6 @@
const char* title = get_text_property( xwindow, gdk_x11_get_xatom_by_name("_NET_WM_NAME") );
g_debug( "active Window = %d ('%s')", (int) xwindow, title );
- if ( strcmp( "Today", title ) == 0 )
- {
- g_debug( "sorry, i'm not going to fullscreen the today window" );
- return;
- }
-
Display* display = XOpenDisplay( NULL );
XEvent xev;
@@ -667,7 +692,7 @@
const char* title = get_text_property( xwindow, gdk_x11_get_xatom_by_name("_NET_WM_NAME") );
g_debug( "active Window = %d ('%s')", (int) xwindow, title );
- if ( strcmp( "Today", title ) == 0 )
+ if ( is_desktop_window(xwindow) )
{
g_debug( "sorry, i'm not going to close the today window" );
return;
More information about the commitlog
mailing list