[maemo-commits] [maemo-commits] r13690 - in projects/haf/trunk/hildon-input-method: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Sep 10 12:07:46 EEST 2007
Author: risun
Date: 2007-09-10 12:07:44 +0300 (Mon, 10 Sep 2007)
New Revision: 13690

Modified:
   projects/haf/trunk/hildon-input-method/ChangeLog
   projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c
Log:
code cleanup and fix some memory leak

Modified: projects/haf/trunk/hildon-input-method/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-input-method/ChangeLog	2007-09-10 09:03:05 UTC (rev 13689)
+++ projects/haf/trunk/hildon-input-method/ChangeLog	2007-09-10 09:07:44 UTC (rev 13690)
@@ -1,7 +1,9 @@
 2007-09-10  Richard Sun  <richard.sun at nokia.com>
 
-	* src/hildon-im-ui.c: Add filter to listen "_NET_WORKAREA" property to
+	* src/hildon-im-ui.c: 
+	- Add filter to listen "_NET_WORKAREA" property to
 	reset UI work area width. Fixes: NB#68624
+	- code cleanup and fix some memory leak
 	
 2007-09-07  Tomas Junnonen  <tomas.junnonen at nokia.com>
 

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 09:03:05 UTC (rev 13689)
+++ projects/haf/trunk/hildon-input-method/src/hildon-im-ui.c	2007-09-10 09:07:44 UTC (rev 13690)
@@ -2718,11 +2718,6 @@
   Atom atoms[2];
   Window win;
   Display *dpy;
-  Atom act_type;
-  gint status, act_format;
-  gulong nitems, bytes;
-  unsigned char *data = NULL;
-  gulong *data_l;
 
   /* We actually should buid a constructor to be able to set base dir (as
    * property) and window properties BEFORE realizing window and creating
@@ -2735,22 +2730,8 @@
                       "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);
+  hildon_im_ui_get_work_area(self);
 
-  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;
-       	  }
-  }
-
   gtk_widget_realize(GTK_WIDGET(self));
   gtk_window_set_default_size(GTK_WINDOW(self), 
       self->priv->width, -1);
@@ -2765,12 +2746,6 @@
                   (unsigned char *) &atoms[1], 1);
 
   hildon_im_ui_init_root_window_properties(self);
-
-  if (data)
-  {
-    XFree(data);
-  }
-
   return GTK_WIDGET(self);
 }
 
@@ -4221,11 +4196,17 @@
 			 &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;
-		 }
-	 }
+	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;
+		}
+	}
+
+	if (data)
+	{
+		XFree(data);
+	}
 }


More information about the maemo-commits mailing list