finch/libgnt/gntwm.c

Wed, 06 Jun 2007 15:50:21 +0000

author
Eric Polino <aluink@pidgin.im>
date
Wed, 06 Jun 2007 15:50:21 +0000
branch
soc.2007.finchfeat
changeset 17586
5beb8d987e84
parent 17585
77ed9c746072
child 17587
9071e012ce1d
permissions
-rw-r--r--

applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
through e82c41f34ce5f7439b2f2971139efaf6ef7a54ff

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

mercurial