annotate finch/libgnt/gntwm.c @ 18874:5dd1cfc53666

Make the menus a little more usable.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 11 Aug 2007 05:09:33 +0000
parents fad7efbb98a6
children c8f9584e3221
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18049
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
1 /**
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
2 * GNT - The GLib Ncurses Toolkit
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
3 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
4 * GNT is the legal property of its developers, whose names are too numerous
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
6 * source distribution.
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
7 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
8 * This library is free software; you can redistribute it and/or modify
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
9 * it under the terms of the GNU General Public License as published by
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
11 * (at your option) any later version.
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
12 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
13 * This program is distributed in the hope that it will be useful,
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
16 * GNU General Public License for more details.
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
17 *
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
18 * You should have received a copy of the GNU General Public License
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
19 * along with this program; if not, write to the Free Software
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
21 */
1cedd520cd18 Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17812
diff changeset
22
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #define _GNU_SOURCE
17812
c0c17a81f5fe Fix libgnt compilation on BSD and solaris. This references #516.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17745
diff changeset
24 #if defined(__APPLE__) || defined(__unix__)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #define _XOPEN_SOURCE_EXTENDED
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #endif
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "config.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include <ctype.h>
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
31 #include <glib/gprintf.h>
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
32 #include <gmodule.h>
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include <stdlib.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include <string.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include <time.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "gntwm.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "gntstyle.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "gntmarshal.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include "gnt.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include "gntbox.h"
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
42 #include "gntlabel.h"
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "gntmenu.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "gnttextview.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "gnttree.h"
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 #include "gntutils.h"
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
47 #include "gntwindow.h"
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #define IDLE_CHECK_INTERVAL 5 /* 5 seconds */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 enum
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 SIG_NEW_WIN,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 SIG_DECORATE_WIN,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 SIG_CLOSE_WIN,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 SIG_CONFIRM_RESIZE,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 SIG_RESIZED,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 SIG_CONFIRM_MOVE,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 SIG_MOVED,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 SIG_UPDATE_WIN,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 SIG_GIVE_FOCUS,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 SIG_KEY_PRESS,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 SIG_MOUSE_CLICK,
18367
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
64 SIG_TERMINAL_REFRESH,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 SIGS
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 static guint signals[SIGS] = { 0 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 static void gnt_wm_new_window_real(GntWM *wm, GntWidget *widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 static void gnt_wm_win_resized(GntWM *wm, GntNode *node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 static void gnt_wm_win_moved(GntWM *wm, GntNode *node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 static void gnt_wm_give_focus(GntWM *wm, GntWidget *widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 static void update_window_in_list(GntWM *wm, GntWidget *wid);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 static void shift_window(GntWM *wm, GntWidget *widget, int dir);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
75 static gboolean workspace_next(GntBindable *wm, GList *n);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
76 static gboolean workspace_prev(GntBindable *wm, GList *n);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
17048
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
78 #ifndef NO_WIDECHAR
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
79 static int widestringwidth(wchar_t *wide);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
80 #endif
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
81
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 static gboolean write_already(gpointer data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 static int write_timeout;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 static time_t last_active_time;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 static gboolean idle_update;
17703
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
86 static GList *act = NULL; /* list of WS with unseen activitiy */
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 static GList *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 g_list_bring_to_front(GList *list, gpointer data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 list = g_list_remove(list, data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 list = g_list_prepend(list, data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 return list;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 free_node(gpointer data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 GntNode *node = data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 hide_panel(node->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 del_panel(node->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 g_free(node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
105 void
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
106 gnt_wm_copy_win(GntWidget *widget, GntNode *node)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 WINDOW *src, *dst;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 int shadow;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 if (!node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 src = widget->window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 dst = node->window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 shadow = gnt_widget_has_shadow(widget) ? 1 : 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
17048
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
118 /**
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
119 * The following is a workaround for a bug in most versions of ncursesw.
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
120 * Read about it in: http://article.gmane.org/gmane.comp.lib.ncurses.bugs/2751
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
121 *
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
122 * In short, if a panel hides one cell of a multi-cell character, then the rest
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
123 * of the characters in that line get screwed. The workaround here is to erase
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
124 * any such character preemptively.
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
125 *
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
126 * Caveat: If a wide character is erased, and the panel above it is moved enough
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
127 * to expose the entire character, it is not always redrawn.
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
128 */
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
129 static void
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
130 work_around_for_ncurses_bug()
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
131 {
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
132 #ifndef NO_WIDECHAR
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
133 PANEL *panel = NULL;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
134 while ((panel = panel_below(panel)) != NULL) {
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
135 int sx, ex, sy, ey, w, y;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
136 cchar_t ch;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
137 PANEL *below = panel;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
138
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
139 sx = panel->win->_begx;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
140 ex = panel->win->_maxx + sx;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
141 sy = panel->win->_begy;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
142 ey = panel->win->_maxy + sy;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
143
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
144 while ((below = panel_below(below)) != NULL) {
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
145 if (sy > below->win->_begy + below->win->_maxy ||
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
146 ey < below->win->_begy)
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
147 continue;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
148 if (sx > below->win->_begx + below->win->_maxx ||
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
149 ex < below->win->_begx)
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
150 continue;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
151 for (y = MAX(sy, below->win->_begy); y <= MIN(ey, below->win->_begy + below->win->_maxy); y++) {
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
152 if (mvwin_wch(below->win, y - below->win->_begy, sx - 1 - below->win->_begx, &ch) != OK)
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
153 goto right;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
154 w = widestringwidth(ch.chars);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
155 if (w > 1 && (ch.attr & 1)) {
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
156 ch.chars[0] = ' ';
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
157 ch.attr &= ~ A_CHARTEXT;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
158 mvwadd_wch(below->win, y - below->win->_begy, sx - 1 - below->win->_begx, &ch);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
159 touchline(below->win, y - below->win->_begy, 1);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
160 }
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
161 right:
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
162 if (mvwin_wch(below->win, y - below->win->_begy, ex + 1 - below->win->_begx, &ch) != OK)
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
163 continue;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
164 w = widestringwidth(ch.chars);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
165 if (w > 1 && !(ch.attr & 1)) {
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
166 ch.chars[0] = ' ';
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
167 ch.attr &= ~ A_CHARTEXT;
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
168 mvwadd_wch(below->win, y - below->win->_begy, ex + 1 - below->win->_begx, &ch);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
169 touchline(below->win, y - below->win->_begy, 1);
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
170 }
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
171 }
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
172 }
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
173 }
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
174 #endif
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
175 }
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
176
17703
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
177 static void
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
178 update_act_msg()
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
179 {
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
180 GntWidget *label;
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
181 GList *iter;
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
182 static GntWidget *message = NULL;
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
183 GString *text = g_string_new("act: ");
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
184 if (message)
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
185 gnt_widget_destroy(message);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
186 if (g_list_length(act) == 0)
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
187 return;
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
188 for (iter = act; iter; iter = iter->next) {
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
189 GntWS *ws = iter->data;
18070
2b757aadddc9 add gnt_window_present
Richard Nelson <wabz@pidgin.im>
parents: 18069
diff changeset
190 g_string_append_printf(text, "%s, ", gnt_ws_get_name(ws));
17703
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
191 }
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
192 g_string_erase(text, text->len - 2, 2);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
193 message = gnt_vbox_new(FALSE);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
194 label = gnt_label_new_with_format(text->str, GNT_TEXT_FLAG_BOLD | GNT_TEXT_FLAG_HIGHLIGHT);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
195 GNT_WIDGET_UNSET_FLAGS(GNT_BOX(message), GNT_WIDGET_CAN_TAKE_FOCUS);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
196 GNT_WIDGET_SET_FLAGS(GNT_BOX(message), GNT_WIDGET_TRANSIENT);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
197 gnt_box_add_widget(GNT_BOX(message), label);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
198 gnt_widget_set_name(message, "wm-message");
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
199 gnt_widget_set_position(message, 0, 0);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
200 gnt_widget_draw(message);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
201 g_string_free(text, TRUE);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
202 }
17828
4d4a396a478c propagate from branch 'im.pidgin.pidgin' (head 6f6e8345100a2f026e20c28fa52592fadd9c8193)
Richard Nelson <wabz@pidgin.im>
parents: 17048 17705
diff changeset
203
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 update_screen(GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 {
18421
e16d097c5739 Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18418
diff changeset
207 if (wm->mode == GNT_KP_MODE_WAIT_ON_CHILD)
e16d097c5739 Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18418
diff changeset
208 return TRUE;
e16d097c5739 Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18418
diff changeset
209
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 if (wm->menu) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 GntMenu *top = wm->menu;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 while (top) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 GntNode *node = g_hash_table_lookup(wm->nodes, top);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 if (node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 top_panel(node->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 top = top->submenu;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 }
17048
f1abdde52538 A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16518
diff changeset
219 work_around_for_ncurses_bug();
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 update_panels();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 doupdate();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 sanitize_position(GntWidget *widget, int *x, int *y)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 int X_MAX = getmaxx(stdscr);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 int Y_MAX = getmaxy(stdscr) - 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 int w, h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 int nx, ny;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 gboolean changed = FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 gnt_widget_get_size(widget, &w, &h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 if (x) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 if (*x + w > X_MAX) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 nx = MAX(0, X_MAX - w);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 if (nx != *x) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 *x = nx;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 changed = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 if (y) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 if (*y + h > Y_MAX) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 ny = MAX(0, Y_MAX - h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 if (ny != *y) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 *y = ny;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 changed = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 return changed;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 refresh_node(GntWidget *widget, GntNode *node, gpointer null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 int x, y, w, h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 int nw, nh;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 int X_MAX = getmaxx(stdscr);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 int Y_MAX = getmaxy(stdscr) - 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 gnt_widget_get_position(widget, &x, &y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 gnt_widget_get_size(widget, &w, &h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 if (sanitize_position(widget, &x, &y))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 gnt_screen_move_widget(widget, x, y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 nw = MIN(w, X_MAX);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 nh = MIN(h, Y_MAX);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 if (nw != w || nh != h)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 gnt_screen_resize_widget(widget, nw, nh);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 read_window_positions(GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 #if GLIB_CHECK_VERSION(2,6,0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 GKeyFile *gfile = g_key_file_new();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 GError *error = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 char **keys;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 gsize nk;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 if (!g_key_file_load_from_file(gfile, filename, G_KEY_FILE_NONE, &error)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 g_printerr("GntWM: %s\n", error->message);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 g_error_free(error);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 g_free(filename);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 keys = g_key_file_get_keys(gfile, "positions", &nk, &error);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 if (error) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 g_printerr("GntWM: %s\n", error->message);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 g_error_free(error);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 error = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 while (nk--) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 char *title = keys[nk];
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 gsize l;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 char **coords = g_key_file_get_string_list(gfile, "positions", title, &l, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 if (l == 2) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 int x = atoi(coords[0]);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 int y = atoi(coords[1]);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 GntPosition *p = g_new0(GntPosition, 1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 p->x = x;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 p->y = y;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 g_hash_table_replace(wm->positions, g_strdup(title + 1), p);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 g_printerr("GntWM: Invalid number of arguments for positioing a window.\n");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 g_strfreev(coords);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 g_strfreev(keys);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 g_free(filename);
15964
8a54f74fecdf plug some leaks
Richard Nelson <wabz@pidgin.im>
parents: 15817
diff changeset
320 g_key_file_free(gfile);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 #endif
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 static gboolean check_idle(gpointer n)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 if (idle_update) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 time(&last_active_time);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 idle_update = FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 gnt_wm_init(GTypeInstance *instance, gpointer class)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336 GntWM *wm = GNT_WM(instance);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
337 wm->workspaces = NULL;
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
338 wm->name_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
339 wm->title_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
340 gnt_style_read_workspaces(wm);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
341 if (wm->workspaces == NULL) {
18075
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
342 wm->cws = gnt_ws_new("default");
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
343 gnt_wm_add_workspace(wm, wm->cws);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
344 } else {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
345 wm->cws = wm->workspaces->data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
346 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 wm->event_stack = FALSE;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
348 wm->tagged = NULL;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 wm->windows = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 wm->actions = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 wm->nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 wm->positions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 read_window_positions(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 g_timeout_add(IDLE_CHECK_INTERVAL * 1000, check_idle, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 time(&last_active_time);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
357 gnt_wm_switch_workspace(wm, 0);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 switch_window(GntWM *wm, int direction)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 GntWidget *w = NULL, *wid = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 int pos;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 if (wm->_list.window || wm->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
369 if (!wm->cws->ordered || !wm->cws->ordered->next)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
372 w = wm->cws->ordered->data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
373 pos = g_list_index(wm->cws->list, w);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 pos += direction;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 if (pos < 0)
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
377 wid = g_list_last(wm->cws->list)->data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
378 else if (pos >= g_list_length(wm->cws->list))
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
379 wid = wm->cws->list->data;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 else if (pos >= 0)
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
381 wid = g_list_nth_data(wm->cws->list, pos);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382
18416
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
383 gnt_wm_raise_window(wm, wid);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 window_next(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 switch_window(wm, 1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 window_prev(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 switch_window(wm, -1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 switch_window_n(GntBindable *bind, GList *list)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 GntWM *wm = GNT_WM(bind);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 GList *l;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 int n;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
409 if (!wm->cws->ordered)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 if (list)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 n = GPOINTER_TO_INT(list->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 n = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
417 if ((l = g_list_nth(wm->cws->list, n)) != NULL)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 gnt_wm_raise_window(wm, l->data);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 window_scroll_up(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 GntNode *node;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
432 if (!wm->cws->ordered)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
435 window = wm->cws->ordered->data;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436 node = g_hash_table_lookup(wm->nodes, window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 if (!node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 if (node->scroll) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 node->scroll--;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
442 gnt_wm_copy_win(window, node);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 window_scroll_down(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 GntNode *node;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 int w, h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
456 if (!wm->cws->ordered)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
459 window = wm->cws->ordered->data;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 node = g_hash_table_lookup(wm->nodes, window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 if (!node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 gnt_widget_get_size(window, &w, &h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 if (h - node->scroll > getmaxy(node->window)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 node->scroll++;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
467 gnt_wm_copy_win(window, node);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 window_close(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 if (wm->_list.window)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
481 if (wm->cws->ordered) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
482 gnt_widget_destroy(wm->cws->ordered->data);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
488 static gboolean
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
489 help_for_widget(GntBindable *bindable, GList *null)
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
490 {
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
491 GntWM *wm = GNT_WM(bindable);
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
492 GntWidget *widget, *tree, *win, *active;
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
493 char *title;
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
494
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
495 if (!wm->cws->ordered)
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
496 return TRUE;
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
497
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
498 widget = wm->cws->ordered->data;
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
499 if (!GNT_IS_BOX(widget))
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
500 return TRUE;
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
501 active = GNT_BOX(widget)->active;
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
502
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
503 tree = gnt_widget_bindings_view(active);
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
504 win = gnt_window_new();
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
505 title = g_strdup_printf("Bindings for %s", g_type_name(G_OBJECT_TYPE(active)));
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
506 gnt_box_set_title(GNT_BOX(win), title);
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
507 if (tree)
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
508 gnt_box_add_widget(GNT_BOX(win), tree);
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
509 else
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
510 gnt_box_add_widget(GNT_BOX(win), gnt_label_new("This widget has no customizable bindings."));
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
511
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
512 gnt_widget_show(win);
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
513
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
514 return TRUE;
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
515 }
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
516
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 destroy__list(GntWidget *widget, GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 wm->_list.window = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 wm->_list.tree = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 wm->windows = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 wm->actions = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 setup__list(GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 GntWidget *tree, *win;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 win = wm->_list.window = gnt_box_new(FALSE, FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 gnt_box_set_toplevel(GNT_BOX(win), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 gnt_box_set_pad(GNT_BOX(win), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_TRANSIENT);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 tree = wm->_list.tree = gnt_tree_new();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 gnt_box_add_widget(GNT_BOX(win), tree);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(destroy__list), wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 window_list_activate(GntTree *tree, GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 {
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
545 GntBindable *sel = gnt_tree_get_selection_data(GNT_TREE(tree));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
547 gnt_widget_destroy(wm->_list.window);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
548
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
549 if (!sel)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
552 if (GNT_IS_WS(sel)) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
553 gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, sel));
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
554 } else {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
555 gnt_wm_raise_window(wm, GNT_WIDGET(sel));
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
556 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 static void
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
560 populate_window_list(GntWM *wm, gboolean workspace)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 GList *iter;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 GntTree *tree = GNT_TREE(wm->windows->tree);
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
564 if (!workspace) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
565 for (iter = wm->cws->list; iter; iter = iter->next) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
566 GntBox *box = GNT_BOX(iter->data);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
568 gnt_tree_add_row_last(tree, box,
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
569 gnt_tree_create_row(tree, box->title), NULL);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
570 update_window_in_list(wm, GNT_WIDGET(box));
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
571 }
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
572 } else {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
573 GList *ws = wm->workspaces;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
574 for (; ws; ws = ws->next) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
575 gnt_tree_add_row_last(tree, ws->data,
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
576 gnt_tree_create_row(tree, gnt_ws_get_name(GNT_WS(ws->data))), NULL);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
577 for (iter = GNT_WS(ws->data)->list; iter; iter = iter->next) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
578 GntBox *box = GNT_BOX(iter->data);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
579
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
580 gnt_tree_add_row_last(tree, box,
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
581 gnt_tree_create_row(tree, box->title), ws->data);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
582 update_window_in_list(wm, GNT_WIDGET(box));
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
583 }
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
584 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 window_list_key_pressed(GntWidget *widget, const char *text, GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 {
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
591 if (text[1] == 0 && wm->cws->ordered) {
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
592 GntBindable *sel = gnt_tree_get_selection_data(GNT_TREE(widget));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 switch (text[0]) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 case '-':
16127
063274e9cb27 These bindings are easier for changing window order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16126
diff changeset
595 case ',':
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
596 if (GNT_IS_WS(sel)) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
597 /* reorder the workspace. */
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
598 } else
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
599 shift_window(wm, GNT_WIDGET(sel), -1);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 break;
16127
063274e9cb27 These bindings are easier for changing window order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16126
diff changeset
601 case '=':
063274e9cb27 These bindings are easier for changing window order.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16126
diff changeset
602 case '.':
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
603 if (GNT_IS_WS(sel)) {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
604 /* reorder the workspace. */
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
605 } else
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
606 shift_window(wm, GNT_WIDGET(sel), 1);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 break;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 default:
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 gnt_tree_remove_all(GNT_TREE(widget));
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
612 populate_window_list(wm, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "workspace")));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 gnt_tree_set_selected(GNT_TREE(widget), sel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
619 static void
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
620 list_of_windows(GntWM *wm, gboolean workspace)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
621 {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
622 GntWidget *tree, *win;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
623 setup__list(wm);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
624 wm->windows = &wm->_list;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
625
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
626 win = wm->windows->window;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
627 tree = wm->windows->tree;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
628
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
629 gnt_box_set_title(GNT_BOX(win), workspace ? "Workspace List" : "Window List");
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
630
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
631 populate_window_list(wm, workspace);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
632
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
633 if (wm->cws->ordered)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
634 gnt_tree_set_selected(GNT_TREE(tree), wm->cws->ordered->data);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
635 else if (workspace)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
636 gnt_tree_set_selected(GNT_TREE(tree), wm->cws);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
637
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
638 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), wm);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
639 g_signal_connect(G_OBJECT(tree), "key_pressed", G_CALLBACK(window_list_key_pressed), wm);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
640 g_object_set_data(G_OBJECT(tree), "workspace", GINT_TO_POINTER(workspace));
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
641
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
642 gnt_tree_set_col_width(GNT_TREE(tree), 0, getmaxx(stdscr) / 3);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
643 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
644 gnt_widget_set_position(win, getmaxx(stdscr) / 3, getmaxy(stdscr) / 4);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
645
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
646 gnt_widget_show(win);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
647 }
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
648
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 window_list(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 if (wm->_list.window || wm->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
657 if (!wm->cws->ordered)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
660 list_of_windows(wm, FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 dump_screen(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 int x, y;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 chtype old = 0, now = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 FILE *file = fopen("dump.html", "w");
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
671 struct {
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
672 char ascii;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
673 char *unicode;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
674 } unis[] = {
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
675 {'q', "&#x2500;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
676 {'t', "&#x251c;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
677 {'u', "&#x2524;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
678 {'x', "&#x2502;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
679 {'-', "&#x2191;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
680 {'.', "&#x2193;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
681 {'l', "&#x250c;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
682 {'k', "&#x2510;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
683 {'m', "&#x2514;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
684 {'j', "&#x2518;"},
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
685 {'a', "&#x2592;"},
18536
70509e165225 Add a missing line-drawing character in the HTML screen-dump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18504
diff changeset
686 {'n', "&#x253c;"},
18733
fad7efbb98a6 Add two more missing characters for the HTML dump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18716
diff changeset
687 {'w', "&#x252c;"},
fad7efbb98a6 Add two more missing characters for the HTML dump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18716
diff changeset
688 {'v', "&#x2534;"},
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
689 {'\0', NULL}
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
690 };
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
692 fprintf(file, "<head>\n <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n</head>\n<body>\n");
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 fprintf(file, "<pre>");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 for (y = 0; y < getmaxy(stdscr); y++) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 for (x = 0; x < getmaxx(stdscr); x++) {
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
696 char ch[2] = {0, 0}, *print;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
697 #ifdef NO_WIDECHAR
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 now = mvwinch(curscr, y, x);
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
699 ch[0] = now & A_CHARTEXT;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
700 now ^= ch[0];
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
701 #else
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
702 cchar_t wch;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
703 char unicode[12];
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
704 mvwin_wch(curscr, y, x, &wch);
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
705 now = wch.attr;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
706 ch[0] = (char)(wch.chars[0] & 0xff);
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
707 #endif
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 #define CHECK(attr, start, end) \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 do \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 { \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 if (now & attr) \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 { \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 if (!(old & attr)) \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 fprintf(file, "%s", start); \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 } \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 else if (old & attr) \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 { \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 fprintf(file, "%s", end); \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 } \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 } while (0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 CHECK(A_BOLD, "<b>", "</b>");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 CHECK(A_UNDERLINE, "<u>", "</u>");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 CHECK(A_BLINK, "<blink>", "</blink>");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 if ((now & A_COLOR) != (old & A_COLOR) ||
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 (now & A_REVERSE) != (old & A_REVERSE))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 int ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 short fgp, bgp, r, g, b;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 struct
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 int r, g, b;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 } fg, bg;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 if (fgp == -1)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 fgp = COLOR_BLACK;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 if (bgp == -1)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741 bgp = COLOR_WHITE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742 if (now & A_REVERSE)
17146
e5cc13b1e0ca Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@wiktel.com>
parents: 17117
diff changeset
743 {
e5cc13b1e0ca Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@wiktel.com>
parents: 17117
diff changeset
744 short tmp = fgp;
e5cc13b1e0ca Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@wiktel.com>
parents: 17117
diff changeset
745 fgp = bgp;
e5cc13b1e0ca Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@wiktel.com>
parents: 17117
diff changeset
746 bgp = tmp;
e5cc13b1e0ca Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@wiktel.com>
parents: 17117
diff changeset
747 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 ret = color_content(fgp, &r, &g, &b);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 fg.r = r; fg.b = b; fg.g = g;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 ret = color_content(bgp, &r, &g, &b);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 bg.r = r; bg.b = b; bg.g = g;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 #define ADJUST(x) (x = x * 255 / 1000)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 ADJUST(fg.r);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 ADJUST(fg.g);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 ADJUST(fg.b);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 ADJUST(bg.r);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 ADJUST(bg.b);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 ADJUST(bg.g);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 if (x) fprintf(file, "</span>");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 fprintf(file, "<span style=\"background:#%02x%02x%02x;color:#%02x%02x%02x\">",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 bg.r, bg.g, bg.b, fg.r, fg.g, fg.b);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 }
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
764 print = ch;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
765 #ifndef NO_WIDECHAR
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
766 if (wch.chars[0] > 255) {
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
767 snprintf(unicode, sizeof(unicode), "&#x%x;", wch.chars[0]);
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
768 print = unicode;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
769 }
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
770 #endif
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 if (now & A_ALTCHARSET)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 {
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
773 int u;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
774 for (u = 0; unis[u].ascii; u++) {
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
775 if (ch[0] == unis[u].ascii) {
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
776 print = unis[u].unicode;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
777 break;
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
778 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 }
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
780 if (!unis[u].ascii)
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
781 print = " ";
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 }
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
783 if (ch[0] == '&')
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 fprintf(file, "&amp;");
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
785 else if (ch[0] == '<')
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 fprintf(file, "&lt;");
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
787 else if (ch[0] == '>')
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 fprintf(file, "&gt;");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 else
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
790 fprintf(file, "%s", print);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 old = now;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 fprintf(file, "</span>\n");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 old = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 }
17117
3c4280387259 Generate nicer HTML dumps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17048
diff changeset
796 fprintf(file, "</pre>\n</body>");
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 fclose(file);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 shift_window(GntWM *wm, GntWidget *widget, int dir)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 {
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
804 GList *all = wm->cws->list;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 GList *list = g_list_find(all, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 int length, pos;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 if (!list)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 length = g_list_length(all);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 pos = g_list_position(all, list);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 pos += dir;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 if (dir > 0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 pos++;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 if (pos < 0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 pos = length;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 else if (pos > length)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 pos = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 all = g_list_insert(all, widget, pos);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 all = g_list_delete_link(all, list);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
824 wm->cws->list = all;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
825 gnt_ws_draw_taskbar(wm->cws, FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829 shift_left(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 if (wm->_list.window)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834
18504
34ed4e7c08cb Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18455
diff changeset
835 if(!wm->cws->ordered)
34ed4e7c08cb Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18455
diff changeset
836 return FALSE;
34ed4e7c08cb Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18455
diff changeset
837
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
838 shift_window(wm, wm->cws->ordered->data, -1);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 shift_right(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 if (wm->_list.window)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848
18504
34ed4e7c08cb Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18455
diff changeset
849 if(!wm->cws->ordered)
34ed4e7c08cb Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18455
diff changeset
850 return FALSE;
34ed4e7c08cb Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18455
diff changeset
851
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
852 shift_window(wm, wm->cws->ordered->data, 1);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 action_list_activate(GntTree *tree, GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 GntAction *action = gnt_tree_get_selection_data(tree);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 action->callback();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 gnt_widget_destroy(wm->_list.window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864 static int
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
865 compare_action(gconstpointer p1, gconstpointer p2)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 const GntAction *a1 = p1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868 const GntAction *a2 = p2;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 return g_utf8_collate(a1->label, a2->label);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874 list_actions(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 GntWidget *tree, *win;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 GList *iter;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 if (wm->_list.window || wm->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 if (wm->acts == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 setup__list(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 wm->actions = &wm->_list;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 win = wm->actions->window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 tree = wm->actions->tree;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 gnt_box_set_title(GNT_BOX(win), "Actions");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 /* XXX: Do we really want this? */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 for (iter = wm->acts; iter; iter = iter->next) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 GntAction *action = iter->data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 gnt_tree_add_row_last(GNT_TREE(tree), action,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 gnt_tree_create_row(GNT_TREE(tree), action->label), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 gnt_widget_set_size(tree, 0, g_list_length(wm->acts));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 gnt_widget_set_position(win, 0, getmaxy(stdscr) - 3 - g_list_length(wm->acts));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 gnt_widget_show(win);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 #ifndef NO_WIDECHAR
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 static int
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 widestringwidth(wchar_t *wide)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 int len, ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 char *string;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 len = wcstombs(NULL, wide, 0) + 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 string = g_new0(char, len);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 wcstombs(string, wide, len);
18554
ab58b55f38b0 Do a NULL-check to prevent a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18536
diff changeset
919 ret = string ? gnt_util_onscreen_width(string, NULL) : 1;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 g_free(string);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 return ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 #endif
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 /* Returns the onscreen width of the character at the position */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 static int
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 reverse_char(WINDOW *d, int y, int x, gboolean set)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 #ifdef NO_WIDECHAR
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 chtype ch;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 ch = mvwinch(d, y, x);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 mvwaddch(d, y, x, DECIDE(ch));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 return 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 #else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 cchar_t ch;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 int wc = 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 if (mvwin_wch(d, y, x, &ch) == OK) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 wc = widestringwidth(ch.chars);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 ch.attr = DECIDE(ch.attr);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 ch.attr &= WA_ATTRIBUTES; /* XXX: This is a workaround for a bug */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 mvwadd_wch(d, y, x, &ch);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 return wc;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 #endif
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 window_reverse(GntWidget *win, gboolean set, GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 int i;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 int w, h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 WINDOW *d;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 d = win->window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 gnt_widget_get_size(win, &w, &h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 if (gnt_widget_has_shadow(win)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 --w;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 --h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 /* the top and bottom */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 for (i = 0; i < w; i += reverse_char(d, 0, i, set));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970 for (i = 0; i < w; i += reverse_char(d, h-1, i, set));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 /* the left and right */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973 for (i = 0; i < h; i += reverse_char(d, i, 0, set));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 for (i = 0; i < h; i += reverse_char(d, i, w-1, set));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
976 gnt_wm_copy_win(win, g_hash_table_lookup(wm->nodes, win));
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 start_move(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 if (wm->_list.window || wm->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 return TRUE;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
986 if (!wm->cws->ordered)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 wm->mode = GNT_KP_MODE_MOVE;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
990 window_reverse(GNT_WIDGET(wm->cws->ordered->data), TRUE, wm);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 start_resize(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 if (wm->_list.window || wm->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 return TRUE;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1001 if (!wm->cws->ordered)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 wm->mode = GNT_KP_MODE_RESIZE;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1005 window_reverse(GNT_WIDGET(wm->cws->ordered->data), TRUE, wm);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 wm_quit(GntBindable *bindable, GList *list)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 if (write_timeout)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 write_already(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 g_main_loop_quit(wm->loop);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 return_true(GntWM *wm, GntWidget *w, int *a, int *b)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1024 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 refresh_screen(GntBindable *bindable, GList *null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 GntWM *wm = GNT_WM(bindable);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 endwin();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL);
18367
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1034 refresh();
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1035 g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 update_screen(wm);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1037 gnt_ws_draw_taskbar(wm->cws, TRUE);
18077
2141130ac557 This got lost from a merge I think. This refixes #532.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18075
diff changeset
1038 curs_set(0); /* endwin resets the cursor to normal */
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039
18422
b8cf3002bb99 The key has been processed. Return TRUE.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18421
diff changeset
1040 return TRUE;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042
16518
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1043 static gboolean
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1044 toggle_clipboard(GntBindable *bindable, GList *n)
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1045 {
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1046 static GntWidget *clip;
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1047 gchar *text;
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1048 int maxx, maxy;
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1049 if (clip) {
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1050 gnt_widget_destroy(clip);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1051 clip = NULL;
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1052 return TRUE;
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1053 }
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1054 getmaxyx(stdscr, maxy, maxx);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1055 text = gnt_get_clipboard_string();
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1056 clip = gnt_hwindow_new(FALSE);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1057 GNT_WIDGET_SET_FLAGS(clip, GNT_WIDGET_TRANSIENT);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1058 GNT_WIDGET_SET_FLAGS(clip, GNT_WIDGET_NO_BORDER);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1059 gnt_box_set_pad(GNT_BOX(clip), 0);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1060 gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(" "));
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1061 gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(text));
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1062 gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(" "));
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1063 gnt_widget_set_position(clip, 0, 0);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1064 gnt_widget_draw(clip);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1065 g_free(text);
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1066 return TRUE;
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1067 }
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1068
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1069 static void remove_tag(gpointer wid, gpointer wim)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1070 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1071 GntWM *wm = GNT_WM(wim);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1072 GntWidget *w = GNT_WIDGET(wid);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1073 wm->tagged = g_list_remove(wm->tagged, w);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1074 mvwhline(w->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), 3);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1075 gnt_widget_draw(w);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1076 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1077
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1078 static gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1079 tag_widget(GntBindable *b, GList *params)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1080 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1081 GntWM *wm = GNT_WM(b);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1082 GntWidget *widget;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1083
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1084 if (!wm->cws->ordered)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1085 return FALSE;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1086 widget = wm->cws->ordered->data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1087
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1088 if (g_list_find(wm->tagged, widget)) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1089 remove_tag(widget, wm);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1090 return TRUE;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1091 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1092
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1093 wm->tagged = g_list_prepend(wm->tagged, widget);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1094 wbkgdset(widget->window, ' ' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT));
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1095 mvwprintw(widget->window, 0, 1, "[T]");
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1096 gnt_widget_draw(widget);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1097 return TRUE;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1098 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1099
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1100 static void
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1101 widget_move_ws(gpointer wid, gpointer w)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1102 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1103 GntWM *wm = GNT_WM(w);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1104 gnt_wm_widget_move_workspace(wm, wm->cws, GNT_WIDGET(wid));
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1105 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1106
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1107 static gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1108 place_tagged(GntBindable *b, GList *params)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1109 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1110 GntWM *wm = GNT_WM(b);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1111 g_list_foreach(wm->tagged, widget_move_ws, wm);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1112 g_list_foreach(wm->tagged, remove_tag, wm);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1113 g_list_free(wm->tagged);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1114 wm->tagged = NULL;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1115 return TRUE;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1116 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1117
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1118 static gboolean
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1119 workspace_list(GntBindable *b, GList *params)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1120 {
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1121 GntWM *wm = GNT_WM(b);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1122
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1123 if (wm->_list.window || wm->menu)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1124 return TRUE;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1125
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1126 list_of_windows(wm, TRUE);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1127
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1128 return TRUE;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1129 }
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1130
18075
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1131 static gboolean
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1132 workspace_new(GntBindable *bindable, GList *null)
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1133 {
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1134 GntWM *wm = GNT_WM(bindable);
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1135 GntWS *ws = gnt_ws_new(NULL);
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1136 gnt_wm_add_workspace(wm, ws);
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1137 gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1138 return TRUE;
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1139 }
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1140
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 static void
18716
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1142 accumulate_windows(gpointer window, gpointer node, gpointer p)
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1143 {
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1144 GList *list = *(GList**)p;
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1145 list = g_list_prepend(list, window);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1146 *(GList**)p = list;
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1147 }
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1148
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1149 static void
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1150 gnt_wm_destroy(GObject *obj)
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1151 {
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1152 GntWM *wm = GNT_WM(obj);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1153 GList *list = NULL;
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1154 g_hash_table_foreach(wm->nodes, accumulate_windows, &list);
18733
fad7efbb98a6 Add two more missing characters for the HTML dump.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18716
diff changeset
1155 g_list_foreach(list, (GFunc)gnt_widget_destroy, NULL);
18716
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1156 g_list_free(list);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1157 g_hash_table_destroy(wm->nodes);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1158 wm->nodes = NULL;
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1159
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1160 while (wm->workspaces) {
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1161 g_object_unref(wm->workspaces->data);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1162 wm->workspaces = g_list_delete_link(wm->workspaces, wm->workspaces);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1163 }
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1164 }
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1165
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1166 static void
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1167 gnt_wm_class_init(GntWMClass *klass)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 int i;
18716
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1170 GObjectClass *gclass = G_OBJECT_CLASS(klass);
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1171
0873698f8cce This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18554
diff changeset
1172 gclass->dispose = gnt_wm_destroy;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 klass->new_window = gnt_wm_new_window_real;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 klass->decorate_window = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 klass->close_window = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177 klass->window_resize_confirm = return_true;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178 klass->window_resized = gnt_wm_win_resized;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1179 klass->window_move_confirm = return_true;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180 klass->window_moved = gnt_wm_win_moved;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 klass->window_update = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182 klass->key_pressed = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 klass->mouse_clicked = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1184 klass->give_focus = gnt_wm_give_focus;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186 signals[SIG_NEW_WIN] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 g_signal_new("new_win",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190 G_STRUCT_OFFSET(GntWMClass, new_window),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 signals[SIG_DECORATE_WIN] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 g_signal_new("decorate_win",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1196 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 G_STRUCT_OFFSET(GntWMClass, decorate_window),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1199 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202 signals[SIG_CLOSE_WIN] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 g_signal_new("close_win",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1205 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206 G_STRUCT_OFFSET(GntWMClass, close_window),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1207 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210 signals[SIG_CONFIRM_RESIZE] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 g_signal_new("confirm_resize",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1214 G_STRUCT_OFFSET(GntWMClass, window_resize_confirm),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215 gnt_boolean_handled_accumulator, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217 G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 signals[SIG_CONFIRM_MOVE] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220 g_signal_new("confirm_move",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 G_STRUCT_OFFSET(GntWMClass, window_move_confirm),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 gnt_boolean_handled_accumulator, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1225 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 signals[SIG_RESIZED] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229 g_signal_new("window_resized",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 G_STRUCT_OFFSET(GntWMClass, window_resized),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 signals[SIG_MOVED] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 g_signal_new("window_moved",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 G_STRUCT_OFFSET(GntWMClass, window_moved),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 signals[SIG_UPDATE_WIN] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 g_signal_new("window_update",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 G_STRUCT_OFFSET(GntWMClass, window_update),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 signals[SIG_GIVE_FOCUS] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 g_signal_new("give_focus",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 G_STRUCT_OFFSET(GntWMClass, give_focus),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 NULL, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 g_cclosure_marshal_VOID__POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260 G_TYPE_NONE, 1, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262 signals[SIG_MOUSE_CLICK] =
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1263 g_signal_new("mouse_clicked",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 G_TYPE_FROM_CLASS(klass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265 G_SIGNAL_RUN_LAST,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266 G_STRUCT_OFFSET(GntWMClass, mouse_clicked),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 gnt_boolean_handled_accumulator, NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268 gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270
18367
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1271 signals[SIG_TERMINAL_REFRESH] =
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1272 g_signal_new("terminal-refresh",
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1273 G_TYPE_FROM_CLASS(klass),
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1274 G_SIGNAL_RUN_LAST,
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1275 G_STRUCT_OFFSET(GntWMClass, terminal_refresh),
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1276 NULL, NULL,
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1277 g_cclosure_marshal_VOID__VOID,
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1278 G_TYPE_NONE, 0);
1648cd94dddf Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18235
diff changeset
1279
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next", window_next,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 "\033" "n", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev", window_prev,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 "\033" "p", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-close", window_close,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285 "\033" "c", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1286 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-list", window_list,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1287 "\033" "w", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "dump-screen", dump_screen,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289 "\033" "d", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "shift-left", shift_left,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291 "\033" ",", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "shift-right", shift_right,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 "\033" ".", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "action-list", list_actions,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 "\033" "a", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1296 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "start-move", start_move,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297 "\033" "m", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "start-resize", start_resize,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1299 "\033" "r", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1300 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "wm-quit", wm_quit,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301 "\033" "q", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1302 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "refresh-screen", refresh_screen,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 "\033" "l", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "switch-window-n", switch_window_n,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1305 NULL, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-down", window_scroll_down,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1307 "\033" GNT_KEY_CTRL_J, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-up", window_scroll_up,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1309 "\033" GNT_KEY_CTRL_K, NULL);
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
1310 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-widget", help_for_widget,
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
1311 "\033" "/", NULL);
18075
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1312 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-new", workspace_new,
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1313 GNT_KEY_F9, NULL);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1314 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-next", workspace_next,
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1315 "\033" ">", NULL);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1316 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-prev", workspace_prev,
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1317 "\033" "<", NULL);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1318 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-tag", tag_widget,
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1319 "\033" "t", NULL);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1320 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "place-tagged", place_tagged,
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1321 "\033" "T", NULL);
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1322 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-list", workspace_list,
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1323 "\033" "s", NULL);
16518
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1324 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard",
403332494b92 Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16281
diff changeset
1325 toggle_clipboard, "\033" "C", NULL);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1327 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1329 /* Make sure Alt+x are detected properly. */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1330 for (i = '0'; i <= '9'; i++) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331 char str[] = "\033X";
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1332 str[1] = i;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333 gnt_keys_add_combination(str);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336 GNTDEBUG;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339 /******************************************************************************
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340 * GntWM API
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 *****************************************************************************/
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 GType
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 gnt_wm_get_gtype(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1344 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1345 static GType type = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 if(type == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 static const GTypeInfo info = {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 sizeof(GntWMClass),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350 NULL, /* base_init */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 NULL, /* base_finalize */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352 (GClassInitFunc)gnt_wm_class_init,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353 NULL,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 NULL, /* class_data */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 sizeof(GntWM),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 0, /* n_preallocs */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 gnt_wm_init, /* instance_init */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358 NULL /* value_table */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361 type = g_type_register_static(GNT_TYPE_BINDABLE,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1362 "GntWM",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1363 &info, 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1364 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1365
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1366 return type;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367 }
18075
34e011c8ed2b F9 to create a new workspace.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18070
diff changeset
1368
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1369 void
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1370 gnt_wm_add_workspace(GntWM *wm, GntWS *ws)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1371 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1372 wm->workspaces = g_list_append(wm->workspaces, ws);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1373 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1374
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1375 gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1376 gnt_wm_switch_workspace(GntWM *wm, gint n)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1377 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1378 GntWS *s = g_list_nth_data(wm->workspaces, n);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1379 if (!s)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1380 return FALSE;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1381
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1382 if (wm->_list.window) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1383 gnt_widget_destroy(wm->_list.window);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1384 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1385 gnt_ws_hide(wm->cws, wm->nodes);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1386 wm->cws = s;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1387 gnt_ws_show(wm->cws, wm->nodes);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1388
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1389 gnt_ws_draw_taskbar(wm->cws, TRUE);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1390 update_screen(wm);
17703
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1391 if (wm->cws->ordered) {
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1392 gnt_wm_raise_window(wm, wm->cws->ordered->data);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1393 }
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1394
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1395 if (act && g_list_find(act, wm->cws)) {
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1396 act = g_list_remove(act, wm->cws);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1397 update_act_msg();
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1398 }
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1399 return TRUE;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1400 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1401
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1402 gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1403 gnt_wm_switch_workspace_prev(GntWM *wm)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1404 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1405 int n = g_list_index(wm->workspaces, wm->cws);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1406 return gnt_wm_switch_workspace(wm, --n);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1407 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1408
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1409 gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1410 gnt_wm_switch_workspace_next(GntWM *wm)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1411 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1412 int n = g_list_index(wm->workspaces, wm->cws);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1413 return gnt_wm_switch_workspace(wm, ++n);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1414 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1415
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1416 static gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1417 workspace_next(GntBindable *wm, GList *n)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1418 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1419 return gnt_wm_switch_workspace_next(GNT_WM(wm));
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1420 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1421
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1422 static gboolean
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1423 workspace_prev(GntBindable *wm, GList *n)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1424 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1425 return gnt_wm_switch_workspace_prev(GNT_WM(wm));
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1426 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1427
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1428 void
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1429 gnt_wm_widget_move_workspace(GntWM *wm, GntWS *neww, GntWidget *widget)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1430 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1431 GntWS *oldw = gnt_wm_widget_find_workspace(wm, widget);
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1432 GntNode *node;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1433 if (!oldw || oldw == neww)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1434 return;
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1435 node = g_hash_table_lookup(wm->nodes, widget);
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1436 if (node && node->ws == neww)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1437 return;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1438
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1439 if (node)
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1440 node->ws = neww;
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1441
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1442 gnt_ws_remove_widget(oldw, widget);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1443 gnt_ws_add_widget(neww, widget);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1444 if (neww == wm->cws) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1445 gnt_ws_widget_show(widget, wm->nodes);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1446 } else {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1447 gnt_ws_widget_hide(widget, wm->nodes);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1448 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1449 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1450
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1451 static gint widget_in_workspace(gconstpointer workspace, gconstpointer wid)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1452 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1453 GntWS *s = (GntWS *)workspace;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1454 if (s->list && g_list_find(s->list, wid))
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1455 return 0;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1456 return 1;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1457 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1458
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1459 GntWS *gnt_wm_widget_find_workspace(GntWM *wm, GntWidget *widget)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1460 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1461 GList *l = g_list_find_custom(wm->workspaces, widget, widget_in_workspace);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1462 if (l)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1463 return l->data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1464 return NULL;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1465 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1466
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1467 static void free_workspaces(gpointer data, gpointer n)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1468 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1469 GntWS *s = data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1470 g_free(s->name);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1471 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1472
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1473 void gnt_wm_set_workspaces(GntWM *wm, GList *workspaces)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1474 {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1475 g_list_foreach(wm->workspaces, free_workspaces, NULL);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1476 wm->workspaces = workspaces;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1477 gnt_wm_switch_workspace(wm, 0);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1478 }
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1479
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 update_window_in_list(GntWM *wm, GntWidget *wid)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 GntTextFormatFlags flag = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 if (wm->windows == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1488 if (wm->cws->ordered && wid == wm->cws->ordered->data)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489 flag |= GNT_TEXT_FLAG_DIM;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491 flag |= GNT_TEXT_FLAG_BOLD;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 gnt_tree_set_row_flags(GNT_TREE(wm->windows->tree), wid, flag);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1496 static gboolean
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1497 match_title(gpointer title, gpointer n, gpointer wid_title)
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1498 {
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1499 /* XXX: do any regex magic here. */
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1500 if (g_strrstr((gchar *)wid_title, (gchar *)title))
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1501 return TRUE;
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1502 return FALSE;
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1503 }
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1504
18216
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1505 #if !GLIB_CHECK_VERSION(2,4,0)
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1506 struct
18216
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1507 {
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1508 gpointer data;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1509 gpointer value;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1510 } table_find_data;
18216
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1511
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1512 static void
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1513 table_find_helper(gpointer key, gpointer value, gpointer data)
18216
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1514 {
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1515 GHRFunc func = data;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1516 if (func(key, value, table_find_data.data))
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1517 table_find_data.value = value;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1518 }
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1519
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1520 static gpointer
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1521 g_hash_table_find(GHashTable * table, GHRFunc func, gpointer data)
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1522 {
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1523 table_find_data.data = data;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1524 table_find_data.value = NULL;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1525 g_hash_table_foreach(table, table_find_helper, func);
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1526 return table_find_data.value;
18216
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1527 }
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1528 #endif
af7b944374ba g_hash_table_find is glib 2.4
Richard Nelson <wabz@pidgin.im>
parents: 18097
diff changeset
1529
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1530 static GntWS *
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1531 new_widget_find_workspace(GntWM *wm, GntWidget *widget)
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1532 {
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1533 GntWS *ret = NULL;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1534 const gchar *name, *title;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1535 title = GNT_BOX(widget)->title;
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1536 if (title)
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1537 ret = g_hash_table_find(wm->title_places, match_title, (gpointer)title);
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1538 if (ret)
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1539 return ret;
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1540 name = gnt_widget_get_name(widget);
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1541 if (name)
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1542 ret = g_hash_table_find(wm->name_places, match_title, (gpointer)name);
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1543 return ret ? ret : wm->cws;
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1544 }
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1545
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 gnt_wm_new_window_real(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 GntNode *node;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 gboolean transient = FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 if (widget->window == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 node = g_new0(GntNode, 1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556 node->me = widget;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 node->scroll = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559 g_hash_table_replace(wm->nodes, widget, node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1561 refresh_node(widget, node, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 transient = !!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1565 #if 1
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567 int x, y, w, h, maxx, maxy;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 gboolean shadow = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 if (!gnt_widget_has_shadow(widget))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 shadow = FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 x = widget->priv.x;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 y = widget->priv.y;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 w = widget->priv.width;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 h = widget->priv.height;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577 getmaxyx(stdscr, maxy, maxx);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 maxy -= 1; /* room for the taskbar */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 maxy -= shadow;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1580 maxx -= shadow;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 x = MAX(0, x);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 y = MAX(0, y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 if (x + w >= maxx)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 x = MAX(0, maxx - w);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 if (y + h >= maxy)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587 y = MAX(0, maxy - h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589 w = MIN(w, maxx);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590 h = MIN(h, maxy);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 node->window = newwin(h + shadow, w + shadow, y, x);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1592 gnt_wm_copy_win(widget, node);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 #endif
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596 node->panel = new_panel(node->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 set_panel_userptr(node->panel, node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599 if (!transient) {
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1600 GntWS *ws = wm->cws;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1601 if (node->me != wm->_list.window) {
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1602 if (GNT_IS_BOX(widget)) {
18235
d359e5f3ee87 Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18216
diff changeset
1603 ws = new_widget_find_workspace(wm, widget);
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1604 }
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1605 node->ws = ws;
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1606 ws->list = g_list_append(ws->list, widget);
18418
b51dcbac4798 Some more focus fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18416
diff changeset
1607 ws->ordered = g_list_append(ws->ordered, widget);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609
18416
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
1610 if (wm->event_stack || node->me == wm->_list.window ||
18418
b51dcbac4798 Some more focus fixes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18416
diff changeset
1611 node->me == ws->ordered->data) {
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 gnt_wm_raise_window(wm, node->me);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 bottom_panel(node->panel); /* New windows should not grab focus */
18097
16bfad2597fb Notify a window on startup if it didn't get the focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18077
diff changeset
1615 gnt_widget_set_focus(node->me, FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 gnt_widget_set_urgent(node->me);
17704
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1617 if (wm->cws != ws)
5acee0788697 New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents: 17703
diff changeset
1618 gnt_ws_widget_hide(widget, wm->nodes);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 void gnt_wm_new_window(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 while (widget->parent)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 widget = widget->parent;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_INVISIBLE) ||
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 g_hash_table_lookup(wm->nodes, widget)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 if (GNT_IS_BOX(widget)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 const char *title = GNT_BOX(widget)->title;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636 GntPosition *p = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 if (title && (p = g_hash_table_lookup(wm->positions, title)) != NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 sanitize_position(widget, &p->x, &p->y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 gnt_widget_set_position(widget, p->x, p->y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640 mvwin(widget->window, p->y, p->x);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644 g_signal_emit(wm, signals[SIG_NEW_WIN], 0, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 if (wm->windows && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648 if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && wm->_list.window != widget
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650 gnt_tree_add_row_last(GNT_TREE(wm->windows->tree), widget,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 gnt_tree_create_row(GNT_TREE(wm->windows->tree), GNT_BOX(widget)->title),
17702
596c970076df Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17698
diff changeset
1652 g_object_get_data(G_OBJECT(wm->windows->tree), "workspace") ? wm->cws : NULL);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 update_window_in_list(wm, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 update_screen(wm);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1658 gnt_ws_draw_taskbar(wm->cws, FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1663 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1664 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666 void gnt_wm_window_close(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 {
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1668 GntWS *s;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669 GntNode *node;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670 int pos;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1672 s = gnt_wm_widget_find_workspace(wm, widget);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1673
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1674 if ((node = g_hash_table_lookup(wm->nodes, widget)) == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1675 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1676
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1677 g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1678 g_hash_table_remove(wm->nodes, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1680 if (wm->windows) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1681 gnt_tree_remove(GNT_TREE(wm->windows->tree), widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1684 if (s) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1685 pos = g_list_index(s->list, widget);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1687 if (pos != -1) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1688 s->list = g_list_remove(s->list, widget);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1689 s->ordered = g_list_remove(s->ordered, widget);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1691 if (s->ordered && wm->cws == s)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1692 gnt_wm_raise_window(wm, s->ordered->data);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1693 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1695
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 update_screen(wm);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1697 gnt_ws_draw_taskbar(wm->cws, FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1698 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1699
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700 time_t gnt_wm_get_idle_time()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 return time(NULL) - last_active_time;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1705 gboolean gnt_wm_process_input(GntWM *wm, const char *keys)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707 gboolean ret = FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1708
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709 keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711 idle_update = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
1713 if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) {
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714 return TRUE;
16126
d07f5128dd6b alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15995
diff changeset
1715 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 /* Do some manual checking */
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1718 if (wm->cws->ordered && wm->mode != GNT_KP_MODE_NORMAL) {
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719 int xmin = 0, ymin = 0, xmax = getmaxx(stdscr), ymax = getmaxy(stdscr) - 1;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720 int x, y, w, h;
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1721 GntWidget *widget = GNT_WIDGET(wm->cws->ordered->data);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722 int ox, oy, ow, oh;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1723
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1724 gnt_widget_get_position(widget, &x, &y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 gnt_widget_get_size(widget, &w, &h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 ox = x; oy = y;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727 ow = w; oh = h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729 if (wm->mode == GNT_KP_MODE_MOVE) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730 if (strcmp(keys, GNT_KEY_LEFT) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1731 if (x > xmin)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1732 x--;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1733 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734 if (x + w < xmax)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735 x++;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1736 } else if (strcmp(keys, GNT_KEY_UP) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737 if (y > ymin)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738 y--;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740 if (y + h < ymax)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1741 y++;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743 if (ox != x || oy != y) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744 gnt_screen_move_widget(widget, x, y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1745 window_reverse(widget, TRUE, wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 } else if (wm->mode == GNT_KP_MODE_RESIZE) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 if (strcmp(keys, GNT_KEY_LEFT) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750 w--;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1752 if (x + w < xmax)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 w++;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 } else if (strcmp(keys, GNT_KEY_UP) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 h--;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757 if (y + h < ymax)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 h++;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1760 if (oh != h || ow != w) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1761 gnt_screen_resize_widget(widget, w, h);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1762 window_reverse(widget, TRUE, wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1763 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1764 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1765 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766 if (strcmp(keys, "\r") == 0 || strcmp(keys, "\033") == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1767 window_reverse(widget, FALSE, wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 wm->mode = GNT_KP_MODE_NORMAL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1769 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773 /* Escape to close the window-list or action-list window */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1774 if (strcmp(keys, "\033") == 0) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 if (wm->_list.window) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1776 gnt_widget_destroy(wm->_list.window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779 } else if (keys[0] == '\033' && isdigit(keys[1]) && keys[2] == '\0') {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780 /* Alt+x for quick switch */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1781 int n = *(keys + 1) - '0';
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782 GList *list = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 if (n == 0)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785 n = 10;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 list = g_list_append(list, GINT_TO_POINTER(n - 1));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 switch_window_n(GNT_BINDABLE(wm), list);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1789 g_list_free(list);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1790 return TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1793 if (wm->menu)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 ret = gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 else if (wm->_list.window)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796 ret = gnt_widget_key_pressed(wm->_list.window, keys);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1797 else if (wm->cws->ordered)
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1798 ret = gnt_widget_key_pressed(GNT_WIDGET(wm->cws->ordered->data), keys);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 return ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 gnt_wm_win_resized(GntWM *wm, GntNode *node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805 /*refresh_node(node->me, node, NULL);*/
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1807
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 gnt_wm_win_moved(GntWM *wm, GntNode *node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 refresh_node(node->me, node, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 void gnt_wm_resize_window(GntWM *wm, GntWidget *widget, int width, int height)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 gboolean ret = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 GntNode *node;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818 int shadow;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1819 int maxx, maxy;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821 while (widget->parent)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822 widget = widget->parent;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 node = g_hash_table_lookup(wm->nodes, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 if (!node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1827 g_signal_emit(wm, signals[SIG_CONFIRM_RESIZE], 0, widget, &width, &height, &ret);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1828 if (!ret)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 return; /* resize is not permitted */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830 hide_panel(node->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1831 gnt_widget_set_size(widget, width, height);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1832 gnt_widget_draw(widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1833
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 shadow = gnt_widget_has_shadow(widget) ? 1 : 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 maxx = getmaxx(stdscr) - shadow;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 maxy = getmaxy(stdscr) - 1 - shadow;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837 height = MIN(height, maxy);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1838 width = MIN(width, maxx);
15978
2a82bc8d57f7 More fixes for resizing when shadow is turned on.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15964
diff changeset
1839 wresize(node->window, height, width);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 replace_panel(node->panel, node->window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 g_signal_emit(wm, signals[SIG_RESIZED], 0, node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 show_panel(node->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849 write_gdi(gpointer key, gpointer value, gpointer data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 GntPosition *p = value;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852 fprintf(data, ".%s = %d;%d\n", (char *)key, p->x, p->y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 write_already(gpointer data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858 GntWM *wm = data;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1859 FILE *file;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1860 char *filename;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1861
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1862 filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1863
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1864 file = fopen(filename, "wb");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1865 if (file == NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1866 g_printerr("GntWM: error opening file to save positions\n");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1867 } else {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1868 fprintf(file, "[positions]\n");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1869 g_hash_table_foreach(wm->positions, write_gdi, file);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1870 fclose(file);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1871 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1872
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1873 g_free(filename);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1874 g_source_remove(write_timeout);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1875 write_timeout = 0;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1876 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1877 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1878
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1879 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1880 write_positions_to_file(GntWM *wm)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882 if (write_timeout) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 g_source_remove(write_timeout);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1884 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1885 write_timeout = g_timeout_add(10000, write_already, wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1886 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1887
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1888 void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1889 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1890 gboolean ret = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 GntNode *node;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1893 while (widget->parent)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894 widget = widget->parent;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1895 node = g_hash_table_lookup(wm->nodes, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896 if (!node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1897 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1898
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1899 g_signal_emit(wm, signals[SIG_CONFIRM_MOVE], 0, widget, &x, &y, &ret);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1900 if (!ret)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1901 return; /* resize is not permitted */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1902
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903 gnt_widget_set_position(widget, x, y);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904 move_panel(node->panel, y, x);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1905
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906 g_signal_emit(wm, signals[SIG_MOVED], 0, node);
15995
bc2dd3358d46 Don't remember the position of transient windows
Richard Nelson <wabz@pidgin.im>
parents: 15978
diff changeset
1907 if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE) && GNT_IS_BOX(widget) &&
bc2dd3358d46 Don't remember the position of transient windows
Richard Nelson <wabz@pidgin.im>
parents: 15978
diff changeset
1908 !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) {
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1909 const char *title = GNT_BOX(widget)->title;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1910 if (title) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 GntPosition *p = g_new0(GntPosition, 1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912 GntWidget *wid = node->me;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913 p->x = wid->priv.x;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1914 p->y = wid->priv.y;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1915 g_hash_table_replace(wm->positions, g_strdup(title), p);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916 write_positions_to_file(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1917 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1918 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1919
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1920 update_screen(wm);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1924 gnt_wm_give_focus(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1926 GntNode *node = g_hash_table_lookup(wm->nodes, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1927
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928 if (!node)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1931 if (widget != wm->_list.window && !GNT_IS_MENU(widget) &&
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1932 wm->cws->ordered->data != widget) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1933 GntWidget *w = wm->cws->ordered->data;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1934 wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1935 gnt_widget_set_focus(w, FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1936 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1937
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1938 gnt_widget_set_focus(widget, TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1939 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_URGENT);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1940 gnt_widget_draw(widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 top_panel(node->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1943 if (wm->_list.window) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944 GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1945 top_panel(nd->panel);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1946 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947 update_screen(wm);
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1948 gnt_ws_draw_taskbar(wm->cws, FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1949 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1950
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951 void gnt_wm_update_window(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952 {
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1953 GntNode *node = NULL;
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1954 GntWS *ws;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1955
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1956 while (widget->parent)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1957 widget = widget->parent;
18455
c34981ad802a Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18422
diff changeset
1958 if (!GNT_IS_MENU(widget)) {
c34981ad802a Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18422
diff changeset
1959 if (!GNT_IS_BOX(widget))
c34981ad802a Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18422
diff changeset
1960 return;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 gnt_box_sync_children(GNT_BOX(widget));
18455
c34981ad802a Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18422
diff changeset
1962 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1964 ws = gnt_wm_widget_find_workspace(wm, widget);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1965 node = g_hash_table_lookup(wm->nodes, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1966 if (node == NULL) {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1967 gnt_wm_new_window(wm, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1968 } else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1969 g_signal_emit(wm, signals[SIG_UPDATE_WIN], 0, node);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1971 if (ws == wm->cws || GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) {
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1972 gnt_wm_copy_win(widget, node);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1973 update_screen(wm);
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1974 gnt_ws_draw_taskbar(wm->cws, FALSE);
18455
c34981ad802a Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18422
diff changeset
1975 } else if (ws && ws != wm->cws && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_URGENT)) {
17703
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1976 if (!act || (act && !g_list_find(act, ws)))
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1977 act = g_list_prepend(act, ws);
4ea517cb7ceb Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents: 17702
diff changeset
1978 update_act_msg();
17698
56d2ae9cbb5c Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents: 16281
diff changeset
1979 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1982 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984 gboolean ret = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 idle_update = TRUE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 g_signal_emit(wm, signals[SIG_MOUSE_CLICK], 0, event, x, y, widget, &ret);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 return ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991 {
18070
2b757aadddc9 add gnt_window_present
Richard Nelson <wabz@pidgin.im>
parents: 18069
diff changeset
1992 GntWS *ws = gnt_wm_widget_find_workspace(wm, widget);
2b757aadddc9 add gnt_window_present
Richard Nelson <wabz@pidgin.im>
parents: 18069
diff changeset
1993 if (wm->cws != ws)
2b757aadddc9 add gnt_window_present
Richard Nelson <wabz@pidgin.im>
parents: 18069
diff changeset
1994 gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
18416
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
1995 if (widget != wm->cws->ordered->data) {
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
1996 GntWidget *wid = wm->cws->ordered->data;
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
1997 wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget);
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
1998 gnt_widget_set_focus(wid, FALSE);
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
1999 gnt_widget_draw(wid);
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
2000 }
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
2001 gnt_widget_set_focus(widget, TRUE);
93c5c785a811 Fix some focus issues.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18367
diff changeset
2002 gnt_widget_draw(widget);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005
16281
82b6fdd899a9 Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16127
diff changeset
2006 void gnt_wm_set_event_stack(GntWM *wm, gboolean set)
82b6fdd899a9 Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16127
diff changeset
2007 {
82b6fdd899a9 Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16127
diff changeset
2008 wm->event_stack = set;
82b6fdd899a9 Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16127
diff changeset
2009 }
82b6fdd899a9 Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16127
diff changeset
2010