[maemo-commits] [maemo-commits] r13687 - in projects/haf/trunk/hildon-input-method: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Sep 10 11:33:55 EEST 2007
- Previous message: [maemo-commits] r13685 - in projects/haf/trunk/glib: . debian glib
- Next message: [maemo-commits] r13688 - in projects/haf/trunk/hildon-desktop/debian: . config
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: risun Date: 2007-09-10 11:33:52 +0300 (Mon, 10 Sep 2007) New Revision: 13687 Modified: projects/haf/trunk/hildon-input-method/ChangeLog projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c Log: src/hildon-im-ui.c: Add filter to listen "_NET_WORKAREA" property to reset UI work area width. Modified: projects/haf/trunk/hildon-input-method/ChangeLog =================================================================== --- projects/haf/trunk/hildon-input-method/ChangeLog 2007-09-10 07:46:09 UTC (rev 13686) +++ projects/haf/trunk/hildon-input-method/ChangeLog 2007-09-10 08:33:52 UTC (rev 13687) @@ -1,3 +1,8 @@ +2007-09-10 Richard Sun <richard.sun at nokia.com> + + * src/hildon-im-ui.c: Add filter to listen "_NET_WORKAREA" property to + reset UI work area width. Fixes: NB#68624 + 2007-09-07 Tomas Junnonen <tomas.junnonen at nokia.com> * src/hildon-im-ui.c: Fixed plugins being enabled without the Modified: projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c =================================================================== --- projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c 2007-09-10 07:46:09 UTC (rev 13686) +++ projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c 2007-09-10 08:33:52 UTC (rev 13687) @@ -252,6 +252,7 @@ gpointer data); static void hildon_im_ui_button_enter(GtkButton *button, gpointer data); static void hildon_im_ui_button_leave(GtkButton *button, gpointer data); +static void hildon_im_ui_get_work_area (HildonIMUI *self); static GtkWidget *hildon_im_ui_create_control_menu( HildonIMUI *ui); @@ -960,7 +961,8 @@ if (GTK_WIDGET_VISIBLE(self) == TRUE) { - activate_plugin (self, self->priv->current_plugin, TRUE); + activate_plugin (self, self->priv->current_plugin, + TRUE); } if (CURRENT_IM_WIDGET (self) != NULL) @@ -1923,6 +1925,8 @@ { Atom active_window_atom = XInternAtom (GDK_DISPLAY(), "_NET_ACTIVE_WINDOW", False); + Atom workarea_change_atom = + XInternAtom (GDK_DISPLAY(), "_NET_WORKAREA", False); XPropertyEvent *prop = (XPropertyEvent *) xevent; if (prop->atom == active_window_atom && prop->window == GDK_ROOT_WINDOW()) @@ -1981,6 +1985,10 @@ } } } + else if (prop->atom == workarea_change_atom && prop->window == GDK_ROOT_WINDOW()) + { + hildon_im_ui_get_work_area (self); + } } return GDK_FILTER_CONTINUE; } @@ -2254,7 +2262,7 @@ g_signal_connect(priv->buttons[i].button, "leave", G_CALLBACK(hildon_im_ui_button_leave), (gpointer) self); - + priv->buttons[i].sensitive = TRUE; priv->buttons[i].toggle = FALSE; priv->buttons[i].id[0] = priv->buttons[i].id[BUTTON_ID_LEN - 1] = '\0'; @@ -2707,50 +2715,49 @@ hildon_im_ui_new() { HildonIMUI *self; - Atom atoms[2], act_type; + Atom atoms[2]; + Window win; Display *dpy; - Window win; + Atom act_type; gint status, act_format; gulong nitems, bytes; unsigned char *data = NULL; gulong *data_l; - - dpy = GDK_DISPLAY(); /* We actually should buid a constructor to be able to set base dir (as * property) and window properties BEFORE realizing window and creating * plugins */ + + dpy = GDK_DISPLAY(); self = g_object_new(HILDON_IM_TYPE_UI, "border-width", 1, "decorated", FALSE, "accept-focus", FALSE, NULL); status = XGetWindowProperty (dpy, - GDK_ROOT_WINDOW(), - XInternAtom(dpy, "_NET_WORKAREA", True), - 0, (~0L), False, - AnyPropertyType, - &act_type, &act_format, &nitems, &bytes, - (unsigned char**)&data); - + GDK_ROOT_WINDOW(), + XInternAtom(dpy, "_NET_WORKAREA", True), + 0, (~0L), False, + AnyPropertyType, + &act_type, &act_format, &nitems, &bytes, + (unsigned char**)&data); + if (status == Success && nitems > 3) { - data_l = (gulong *) data + 2; /* screen width is in the third value */ - if (*data_l > 0) - { - self->priv->width = *data_l; - } + data_l = (gulong *) data + 2; /* screen width is in the third value */ + if (*data_l > 0) + { + self->priv->width = *data_l; + } } gtk_widget_realize(GTK_WIDGET(self)); - gtk_window_set_default_size(GTK_WINDOW(self), self->priv->width, -1); g_object_set_data(G_OBJECT(GTK_WIDGET(self)->window), "_NEW_WM_STATE", (gpointer) PropModeAppend); - win = GDK_WINDOW_XID(GTK_WIDGET(self)->window); atoms[0] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); atoms[1] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_INPUT", False); @@ -2829,7 +2836,7 @@ static void flush_plugins(HildonIMUI *self, - PluginData *current, gboolean force) + PluginData *current, gboolean force) { GSList *iter; @@ -2870,10 +2877,11 @@ } static void -activate_plugin (HildonIMUI *self, PluginData *plugin, gboolean init) +activate_plugin (HildonIMUI *self, PluginData *plugin, + gboolean init) { gboolean need_packing, activate_special = FALSE; - + g_return_if_fail (HILDON_IM_IS_UI(self)); g_return_if_fail (plugin != NULL); @@ -2957,7 +2965,9 @@ } void -hildon_im_ui_activate_plugin (HildonIMUI *self, gchar *name, gboolean init) +hildon_im_ui_activate_plugin (HildonIMUI *self, + gchar *name, + gboolean init) { PluginData *plugin; @@ -4191,3 +4201,31 @@ gtk_widget_hide(GTK_WIDGET(ui)); } } + + +static void hildon_im_ui_get_work_area (HildonIMUI *self) +{ + Display *dpy; + Atom act_type; + gint status, act_format; + gulong nitems, bytes; + unsigned char *data = NULL; + gulong *data_l; + + dpy = GDK_DISPLAY(); + status = XGetWindowProperty (dpy, + GDK_ROOT_WINDOW(), + XInternAtom(dpy, "_NET_WORKAREA", True), + 0, (~0L), False, + AnyPropertyType, + &act_type, &act_format, &nitems, &bytes, + (unsigned char**)&data); + + if (status == Success && nitems > 3) { + data_l = (gulong *) data + 2; /* screen width is in the third value */ + if (*data_l > 0) + { + self->priv->width = *data_l; + } + } +}
- Previous message: [maemo-commits] r13685 - in projects/haf/trunk/glib: . debian glib
- Next message: [maemo-commits] r13688 - in projects/haf/trunk/hildon-desktop/debian: . config
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]