r411 - in trunk/src/target/OM-2007/openmoko-libs: . libmokoui
mickey at gta01.hmw-consulting.de
mickey at gta01.hmw-consulting.de
Thu Dec 14 17:40:29 CET 2006
Author: mickey
Date: 2006-12-14 17:40:28 +0100 (Thu, 14 Dec 2006)
New Revision: 411
Modified:
trunk/src/target/OM-2007/openmoko-libs/TODO
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-application.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-window.c
Log:
libmokoui: fix bug inherited from Maemo *cough*
Modified: trunk/src/target/OM-2007/openmoko-libs/TODO
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/TODO 2006-12-14 14:55:19 UTC (rev 410)
+++ trunk/src/target/OM-2007/openmoko-libs/TODO 2006-12-14 16:40:28 UTC (rev 411)
@@ -13,6 +13,9 @@
- Add dbus service interfaces
- Refactor moko_paned_window_set_application_menu and moko_finger_window_set_application_menu
into common MokoWindow class (moko_window_set_application_menu) and make it a virtual method.
+- Rethink whether MokoFingerWheel and MokoFingerToolBox "belong" to a moko_window or a moko_finger_window
+- Rethink whether they belong to one window or more windows per app. I guess we only want one wheel + toolbox per app
+- Rethink whether MokoFingerWheel and MokoFingerToolBox might be GTK_WINDOW_POPUP + manual hide/show on changing current application / window
- OE-SDK
- Native SDK
- Scratchbox
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-application.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-application.c 2006-12-14 14:55:19 UTC (rev 410)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-application.c 2006-12-14 16:40:28 UTC (rev 411)
@@ -45,7 +45,7 @@
{
/* Window Manager Collaboration */
Atom mb_current_app_window_atom; // _MB_CURRENT_APP_WINDOW
- Atom net_current_window_atom; // _NET_CURRENT_WINDOW
+ Atom net_active_window_atom; // _NET_ACTIVE_WINDOW
gboolean seen_matchbox_atom; // TRUE, if we received _MB_CURRENT_APP_WINDOW at least once
Window window_group; // X11 Window Group (one group per application)
gboolean is_topmost; // whether one of the application windows is topmost
@@ -123,13 +123,13 @@
priv->name = NULL;
priv->mb_current_app_window_atom = XInternAtom( GDK_DISPLAY(), "_MB_CURRENT_APP_WINDOW", False );
- priv->net_current_window_atom = XInternAtom( GDK_DISPLAY(), "_NET_ACTIVE_WINDOW", False );
+ priv->net_active_window_atom = XInternAtom( GDK_DISPLAY(), "_NET_ACTIVE_WINDOW", False );
priv->seen_matchbox_atom = FALSE;
}
static void moko_application_finalize (GObject *self)
{
- MokoApplicationPrivate *priv = MOKO_APPLICATION_GET_PRIVATE (MOKO_APPLICATION(self));
+ MokoApplicationPrivate *priv = MOKO_APPLICATION_GET_PRIVATE(MOKO_APPLICATION(self));
g_free( priv->name );
}
@@ -166,6 +166,56 @@
}
/* Utilities */
+
+/*
+ * Checks the root window to know which is the topmost window
+ */
+Window
+moko_application_get_active_window(MokoApplication* self)
+{
+ Atom realtype;
+ int format;
+ int status;
+ Window ret;
+ unsigned long n;
+ unsigned long extra;
+ union
+ {
+ Window *win;
+ unsigned char *char_pointer;
+ } win;
+
+ MokoApplicationPrivate* priv = MOKO_APPLICATION_GET_PRIVATE (MOKO_APPLICATION(self));
+ Atom active_app_atom = priv->seen_matchbox_atom ? priv->mb_current_app_window_atom : priv->net_active_window_atom;
+
+ win.win = NULL;
+
+ status = XGetWindowProperty( GDK_DISPLAY(),
+ GDK_ROOT_WINDOW(),
+ active_app_atom,
+ 0L,
+ 16L,
+ 0,
+ XA_WINDOW,
+ &realtype,
+ &format,
+ &n,
+ &extra,
+ &win.char_pointer);
+ if ( !(status == Success && realtype == XA_WINDOW && format == 32 && n == 1 && win.win != NULL) )
+ {
+ if (win.win != NULL) XFree (win.char_pointer);
+ return None;
+ }
+
+ ret = win.win[0];
+
+ if (win.win != NULL)
+ XFree(win.char_pointer);
+
+ return ret;
+}
+
static gint
moko_application_window_list_compare(gconstpointer window_a, gconstpointer window_b)
{
@@ -187,17 +237,16 @@
}
/*
- * Check the _MB_CURRENT_APP_WINDOW on the root window, and update
- * the top_most status accordingly
+ * Check the _MB_CURRENT_APP_WINDOW / _NET_ACTIVE_WINDOW on the root window, and update
+ * the topmost status accordingly
*/
static void
moko_application_update_top_most(MokoApplication* self)
{
- moko_debug( "moko_application_update_top_most" );
- moko_debug( "-- status has changed for '%s'", g_get_application_name() );
+ moko_debug( "moko_application_update_top_most '%s'", g_get_application_name() );
MokoApplicationPrivate* priv = MOKO_APPLICATION_GET_PRIVATE(self);
- Window active_window = moko_window_get_active_window();
+ Window active_window = moko_application_get_active_window(self);
if (active_window)
{
@@ -205,7 +254,6 @@
if (wm_hints)
{
-
if (wm_hints->window_group == priv->window_group)
{
if (!priv->is_topmost)
@@ -225,8 +273,10 @@
XFree (wm_hints);
}
- /* Check each window if it was is_topmost */
+ /* Update topmost status for every window */
+#if 1
g_slist_foreach(priv->windows, (GFunc)moko_application_list_is_is_topmost, &active_window);
+#endif
}
/* Event filter */
@@ -249,16 +299,17 @@
XPropertyEvent* pevent = xevent;
moko_debug( "-- got PropertyNotify for Atom '%s'", XGetAtomName( GDK_DISPLAY(), pevent->atom ) );
- if ( (pevent->atom == priv->net_current_window_atom) && (!priv->seen_matchbox_atom) )
+ if (pevent->atom == priv->mb_current_app_window_atom)
{
- moko_debug( "-- got _NET_CURRENT_WINDOW atom" );
+ moko_debug( "-- got _MB_CURRENT_APP_WINDOW atom" );
+ priv->seen_matchbox_atom = TRUE;
moko_application_update_top_most( program );
return GDK_FILTER_CONTINUE;
}
- if (pevent->atom == priv->mb_current_app_window_atom)
+ else
+ if ( (pevent->atom == priv->net_active_window_atom) && (!priv->seen_matchbox_atom) )
{
- moko_debug( "-- got _MB_CURRENT_APP_WINDOW atom" );
- priv->seen_matchbox_atom = TRUE;
+ moko_debug( "-- got _NET_ACTIVE_WINDOW atom" );
moko_application_update_top_most( program );
return GDK_FILTER_CONTINUE;
}
@@ -308,9 +359,6 @@
if (!priv->windows)
{
- moko_debug( "need to update top most window now..." );
- /* program_update_top_most (self); */
-
/* Now that we have a window we should start keeping track of the root window */
gdk_window_set_events( gdk_get_default_root_window(), gdk_window_get_events(gdk_get_default_root_window ()) | GDK_PROPERTY_CHANGE_MASK);
gdk_window_add_filter( gdk_get_default_root_window(), moko_application_root_window_event_filter, self );
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c 2006-12-14 14:55:19 UTC (rev 410)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c 2006-12-14 16:40:28 UTC (rev 411)
@@ -47,18 +47,18 @@
MokoFingerToolBox* tools;
} MokoFingerWindowPriv;
-static void moko_finger_window_dispose (GObject *object)
+static void moko_finger_window_dispose(GObject *object)
{
if (G_OBJECT_CLASS (moko_finger_window_parent_class)->dispose)
G_OBJECT_CLASS (moko_finger_window_parent_class)->dispose (object);
}
-static void moko_finger_window_finalize (GObject *object)
+static void moko_finger_window_finalize(GObject *object)
{
G_OBJECT_CLASS (moko_finger_window_parent_class)->finalize (object);
}
-static void moko_finger_window_class_init (MokoFingerWindowClass *klass)
+static void moko_finger_window_class_init(MokoFingerWindowClass *klass)
{
moko_debug( "moko_finger_window_class_init" );
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -69,7 +69,7 @@
object_class->finalize = moko_finger_window_finalize;
}
-static void moko_finger_window_init (MokoFingerWindow *self)
+static void moko_finger_window_init(MokoFingerWindow *self)
{
moko_debug( "moko_finger_window_init" );
MokoFingerWindowPriv* priv = MOKO_FINGER_WINDOW_PRIVATE(self);
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-window.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-window.c 2006-12-14 14:55:19 UTC (rev 410)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-window.c 2006-12-14 16:40:28 UTC (rev 411)
@@ -71,6 +71,7 @@
static void moko_window_class_init(MokoWindowClass *klass) /* Class Initialization */
{
+ moko_debug( "moko_window_class_init" );
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
GObjectClass *object_class = G_OBJECT_CLASS(klass);
@@ -144,11 +145,11 @@
switch (property_id) {
case PROP_IS_TOPMOST:
- g_value_set_boolean (value, priv->is_topmost);
+ g_value_set_boolean( value, priv->is_topmost );
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, pspec );
break;
}
}
@@ -156,7 +157,7 @@
static void
moko_window_notify(GObject* gobject, GParamSpec* param)
{
- moko_debug( "moko_window_notify" );
+ moko_debug( "moko_window_notify '%s'", param->name );
MokoWindow* window = MOKO_WINDOW(gobject);
if (strcmp(param->name, "title") == 0)
@@ -164,13 +165,13 @@
moko_debug( "update window title" );
//moko_window_update_title(window);
}
- else if (strcmp(param->name, "is-topmost"))
+ else if (strcmp(param->name, "is-topmost") == 0)
{
moko_window_is_topmost_notify(window);
}
if (G_OBJECT_CLASS(parent_class)->notify)
- G_OBJECT_CLASS(parent_class)->notify (gobject, param);
+ G_OBJECT_CLASS(parent_class)->notify( gobject, param );
}
static void
@@ -205,7 +206,6 @@
if (!priv->is_topmost)
{
priv->is_topmost = TRUE;
- moko_window_is_topmost_notify( self );
g_object_notify( G_OBJECT(self), "is-topmost" );
}
}
@@ -220,53 +220,7 @@
gtk_im_context_focus_out(GTK_TEXT_VIEW(focus)->im_context);
priv->is_topmost = FALSE;
- moko_window_is_topmost_notify(self);
g_object_notify( G_OBJECT(self), "is-topmost" );
}
}
-/*
- * Checks the root window to know which is the topmost window
- */
-Window
-moko_window_get_active_window()
-{
- Atom realtype;
- int format;
- int status;
- Window ret;
- unsigned long n;
- unsigned long extra;
- union
- {
- Window *win;
- unsigned char *char_pointer;
- } win;
- Atom active_app_atom = XInternAtom( GDK_DISPLAY(), "_MB_CURRENT_APP_WINDOW", False );
- win.win = NULL;
-
- status = XGetWindowProperty( GDK_DISPLAY(),
- GDK_ROOT_WINDOW(),
- active_app_atom,
- 0L,
- 16L,
- 0,
- XA_WINDOW,
- &realtype,
- &format,
- &n,
- &extra,
- &win.char_pointer);
- if ( !(status == Success && realtype == XA_WINDOW && format == 32 && n == 1 && win.win != NULL) )
- {
- if (win.win != NULL) XFree (win.char_pointer);
- return None;
- }
-
- ret = win.win[0];
-
- if (win.win != NULL)
- XFree(win.char_pointer);
-
- return ret;
-}
More information about the commitlog
mailing list