soc.2008.finch: c3479c55: Ignore transient windows when closing an...

sadrul at pidgin.im sadrul at pidgin.im
Tue Sep 23 19:20:33 EDT 2008


-----------------------------------------------------------------
Revision: c3479c559617e69234f20e8510b0adbe73389e48
Ancestor: 67c9926328d37d4c77968494ef23e8c836fa0a45
Author: sadrul at pidgin.im
Date: 2008-09-23T23:28:02
Branch: im.pidgin.soc.2008.finch
URL: http://d.pidgin.im/viewmtn/revision/info/c3479c559617e69234f20e8510b0adbe73389e48

Modified files:
        finch/libgnt/genmarshal finch/libgnt/gntbox.c
        finch/libgnt/gntwm.c finch/libgnt/wms/tiling.c

ChangeLog: 

Ignore transient windows when closing and prevent a coordinate-underrun
when printing window-titles.
Also, fix a bug where the return value from GntWM::close_window was
ignored.

-------------- next part --------------
============================================================
--- finch/libgnt/genmarshal	d381a8c7e44c43a6e9a9114f5d552d6b0a610db6
+++ finch/libgnt/genmarshal	c2c684030cd4772e7913d53458795da5997f7b21
@@ -1,4 +1,5 @@ BOOLEAN:VOID
 BOOLEAN:VOID
+BOOLEAN:POINTER
 BOOLEAN:STRING
 VOID:INT,INT,INT,INT
 VOID:INT,INT
============================================================
--- finch/libgnt/gntbox.c	90cc33e4d8c0c5ace1ecccd74a908441df3531ce
+++ finch/libgnt/gntbox.c	77cab0ff42461dca9348e4140651c4ed37f6487c
@@ -60,8 +60,13 @@ get_title_thingies(GntBox *box, char *ti
 	int len;
 	char *end = (char*)gnt_util_onscreen_width_to_pointer(title, widget->priv.width - 4, &len);
 	
-	if (p)
+	if (p) {
 		*p = (widget->priv.width - len) / 2;
+		if (*p == 0) {
+			*p = 1;
+			--len;
+		}
+	}
 	if (r)
 		*r = (widget->priv.width + len) / 2;
 	*end = '\0';
============================================================
--- finch/libgnt/gntwm.c	d1131470cc7fce659971dd2fa70ca80b8ed0a29f
+++ finch/libgnt/gntwm.c	0621eb0c45386c91db2b88b7a6ca5b055362a804
@@ -1394,9 +1394,9 @@ gnt_wm_class_init(GntWMClass *klass)
 					 G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST,
 					 G_STRUCT_OFFSET(GntWMClass, close_window),
-					 NULL, NULL,
-					 g_cclosure_marshal_VOID__POINTER,
-					 G_TYPE_NONE, 1, G_TYPE_POINTER);
+					 gnt_boolean_handled_accumulator, NULL,
+					 gnt_closure_marshal_BOOLEAN__POINTER,
+					 G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
 	signals[SIG_CONFIRM_RESIZE] = 
 		g_signal_new("confirm_resize",
 					 G_TYPE_FROM_CLASS(klass),
@@ -1878,13 +1878,13 @@ void gnt_wm_window_close(GntWM *wm, GntW
 {
 	GntWS *s;
 	int pos;
+	gboolean ret = FALSE;
 
 	s = gnt_wm_widget_find_workspace(wm, widget);
 
 	if (g_hash_table_lookup(wm->nodes, widget) == NULL)
 		return;
 
-	g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget);
 	g_hash_table_remove(wm->nodes, widget);
 
 	if (wm->windows) {
@@ -1897,12 +1897,14 @@ void gnt_wm_window_close(GntWM *wm, GntW
 		if (pos != -1) {
 			s->list = g_list_remove(s->list, widget);
 			s->ordered = g_list_remove(s->ordered, widget);
-
-			if (s->ordered && wm->cws == s)
-				gnt_wm_raise_window(wm, s->ordered->data);
 		}
 	}
 
+	g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget, &ret);
+
+	if (!ret && s && s->ordered && wm->cws == s)
+		gnt_wm_raise_window(wm, s->ordered->data);
+
 	update_screen(wm);
 	gnt_ws_draw_taskbar(wm->cws, FALSE);
 }
============================================================
--- finch/libgnt/wms/tiling.c	98e802e4c7b2204b026999eb19cbce6ff0dbcdf5
+++ finch/libgnt/wms/tiling.c	0862cccfbcdcf35e665bfb362b41622d92f620f7
@@ -115,9 +115,10 @@ twm_move_window_to_frame(GntWidget *win,
 	 * the reason resize is called twice is that the resize might not
 	 * work correctly if the width/height increases and the current x/y
 	 * restricts the width/height */
-	gnt_screen_resize_widget(win, frame->width, frame->height);
 	gnt_screen_move_widget(win, frame->x, frame->y);
-	gnt_screen_resize_widget(win, frame->width, frame->height);
+	if (gnt_widget_set_size(win, frame->width, frame->height))
+			gnt_screen_resize_widget(win, frame->width, frame->height);
+	gnt_screen_move_widget(win, frame->x, frame->y);
 }
 
 static void
@@ -370,10 +371,6 @@ tiling_wm_new_window(GntWM *wm, GntWidge
 		twm_show_window_in_frame(wm, win, twm->current);
 	}
 	org_new_window(wm, win);
-
-	if(twm->current->windows->length == 1) {
-		gnt_wm_raise_window(wm, win);
-	}
 }
 
 static gboolean
@@ -402,7 +399,11 @@ tiling_wm_window_resize_confirm(GntWM *w
 	if (!frame || (*w == frame->width && *h == frame->height)) {
 		return TRUE;
 	} else {
-		return FALSE;
+		/* See if the widget agrees to resize itself */
+		if (gnt_widget_set_size(win, *w, *h))
+			return TRUE;
+		gnt_widget_get_size(win, w, h);
+		return TRUE;
 	}
 }
 
@@ -413,6 +414,9 @@ tiling_wm_close_window(GntWM *wm, GntWid
 	TilingFrame *frame;
 	GntWidget *wid;
 
+	if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_TRANSIENT))
+		return FALSE;
+
 	frame = find_frame_by_window(twm, win);
 
 	if (frame) {
@@ -431,6 +435,7 @@ tiling_wm_close_window(GntWM *wm, GntWid
 			/* not displayed window in frame, so just remove it from the queue */
 			twm_g_queue_remove(frame->windows, win);
 		}
+		return TRUE;
 	}
 
 	return FALSE;


More information about the Commits mailing list