]> Dogcows Code - chaz/openbox/blobdiff - openbox/menuframe.c
plug memory leaks from the new strut code
[chaz/openbox] / openbox / menuframe.c
index c6dd02fa3d8ec5a9e9ac21bfdab645207bbd6cc4..4f5a34d8d095c2f5d460406c3194627f4a778296 100644 (file)
@@ -45,6 +45,7 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
 static void menu_entry_frame_free(ObMenuEntryFrame *self);
 static void menu_frame_update(ObMenuFrame *self);
 static gboolean menu_entry_frame_submenu_timeout(gpointer data);
+static void menu_frame_hide(ObMenuFrame *self);
 
 static Window createWindow(Window parent, gulong mask,
                            XSetWindowAttributes *attrib)
@@ -342,6 +343,8 @@ void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
         *dx = MAX(*dx, a->x - x);
         *dy = MAX(*dy, a->y - y);
     }
+
+    g_free(a);
 }
 
 static void menu_entry_frame_render(ObMenuEntryFrame *self)
@@ -498,6 +501,8 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
             self->entry->data.normal.icon_width;
         self->a_icon->texture[0].data.rgba.height =
             self->entry->data.normal.icon_height;
+        self->a_icon->texture[0].data.rgba.alpha =
+            self->entry->data.normal.icon_alpha;
         self->a_icon->texture[0].data.rgba.data =
             self->entry->data.normal.icon_data;
         self->a_icon->surface.parent = item_a;
@@ -728,7 +733,7 @@ void menu_frame_render(ObMenuFrame *self)
             if (e->entry->data.separator.label != NULL) {
                 e->a_text_title->texture[0].data.text.string =
                     e->entry->data.separator.label;
-                tw = RrMinWidth(e->a_text_title);
+                tw = RrMinWidth(e->a_text_title) + 2*ob_rr_theme->paddingx;
                 tw = MIN(tw, MAX_MENU_WIDTH);
                 th = ob_rr_theme->menu_title_height +
                     (ob_rr_theme->mbwidth - PADDING) *2;
@@ -885,6 +890,8 @@ static void menu_frame_update(ObMenuFrame *self)
         }
     }
 
+    g_free(a);
+
     menu_frame_render(self);
 }
 
@@ -914,10 +921,10 @@ static gboolean menu_frame_show(ObMenuFrame *self)
 
         /* grab the pointer in such a way as to pass through "owner events"
            so that we can get enter/leave notifies in the menu. */
-        if (!grab_pointer(TRUE, TRUE, OB_CURSOR_POINTER))
+        if (!grab_pointer(TRUE, FALSE, OB_CURSOR_POINTER))
             return FALSE;
-        if (!grab_keyboard(TRUE)) {
-            grab_pointer(FALSE, TRUE, OB_CURSOR_POINTER);
+        if (!grab_keyboard()) {
+            ungrab_pointer();
             return FALSE;
         }
     }
@@ -945,8 +952,10 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y,
 
     /* find the monitor the menu is on */
     for (i = 0; i < screen_num_monitors; ++i) {
-        Rect *a = screen_physical_area_monitor(i);
-        if (RECT_CONTAINS(*a, x, y)) {
+        Rect a = screen_physical_area_monitor(i);
+        gboolean contains = RECT_CONTAINS(*a, x, y);
+        g_free(a);
+        if (contains) {
             self->monitor = i;
             break;
         }
@@ -1013,7 +1022,7 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
     return TRUE;
 }
 
-void menu_frame_hide(ObMenuFrame *self)
+static void menu_frame_hide(ObMenuFrame *self)
 {
     GList *it = g_list_find(menu_frame_visible, self);
 
@@ -1035,8 +1044,8 @@ void menu_frame_hide(ObMenuFrame *self)
 
     if (menu_frame_visible == NULL) {
         /* last menu shown */
-        grab_pointer(FALSE, TRUE, OB_CURSOR_NONE);
-        grab_keyboard(FALSE);
+        ungrab_pointer();
+        ungrab_keyboard();
     }
 
     XUnmapWindow(ob_display, self->window);
This page took 0.0256960000000001 seconds and 4 git commands to generate.