soc.2008.finch: a87d2783: Include support for changing focus of a ...

queueram at soc.pidgin.im queueram at soc.pidgin.im
Sat Sep 13 02:00:30 EDT 2008


-----------------------------------------------------------------
Revision: a87d2783cf2457025ca56130ba475920a24a9e42
Ancestor: 5e9f93ddd871ede830e84bb7e3d6ca94f0460400
Author: queueram at soc.pidgin.im
Date: 2008-09-13T05:55:16
Branch: im.pidgin.soc.2008.finch
URL: http://d.pidgin.im/viewmtn/revision/info/a87d2783cf2457025ca56130ba475920a24a9e42

Modified files:
        finch/libgnt/wms/tiling.c

ChangeLog: 

Include support for changing focus of a window through an event not
controlled by the tiling window manager, such as a mouse click.

-------------- next part --------------
============================================================
--- finch/libgnt/wms/tiling.c	8c199d176b4801a9ab18335ee530292ff6f18068
+++ finch/libgnt/wms/tiling.c	f2fc2aaf4aea56a9fec5834b69f72bf25b2039c7
@@ -98,6 +98,7 @@ static void (*org_new_window)(GntWM *wm,
 void gntwm_init(GntWM **wm);
 
 static void (*org_new_window)(GntWM *wm, GntWidget *win);
+static void (*org_give_focus)(GntWM *wm, GntWidget *win);
 
 static GntWidget *
 get_next_window(GntWM *wm, GntWidget *win, int direction);
@@ -402,6 +403,26 @@ tiling_wm_terminal_refresh(GntWM *wm)
 	}
 }
 
+static void
+tiling_wm_give_focus(GntWM *wm, GntWidget *win)
+{
+	TilingWM *twm = (TilingWM*)wm;
+	TilingFrame *frame;
+
+	if (win != twm->current->window && !GNT_IS_MENU(win)) {
+		frame = find_frame_by_window(&twm->root, win);
+		if (frame) {
+			if (twm->current->window) {
+				window_reverse(twm->current->window, FALSE, wm);
+			}
+			twm->current = frame;
+			window_reverse(win, TRUE, wm);
+		}
+	}
+
+	org_give_focus(wm, win);
+}
+
 static GntWidget *
 get_next_window(GntWM *wm, GntWidget *win, int direction)
 {
@@ -935,12 +956,14 @@ tiling_wm_class_init(TilingWMClass *klas
 	GntWMClass *pclass = GNT_WM_CLASS(klass);
 
 	org_new_window = pclass->new_window;
+	org_give_focus = pclass->give_focus;
 
 	pclass->new_window = tiling_wm_new_window;
 	pclass->window_resize_confirm = tiling_wm_window_resize_confirm;
 	pclass->window_move_confirm = tiling_wm_window_move_confirm;
 	pclass->close_window = tiling_wm_close_window;
 	pclass->terminal_refresh = tiling_wm_terminal_refresh;
+	pclass->give_focus = tiling_wm_give_focus;
 
 	/* moving between windows */
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "next-window",


More information about the Commits mailing list