Mon, 03 Feb 2014 01:06:54 +0530
Merge gtkdoc-conversion
|
18114
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
1 | /** |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
2 | * GNT - The GLib Ncurses Toolkit |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
3 | * |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
4 | * GNT is the legal property of its developers, whose names are too numerous |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
6 | * source distribution. |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
7 | * |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
8 | * This library is free software; you can redistribute it and/or modify |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
11 | * (at your option) any later version. |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
12 | * |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
16 | * GNU General Public License for more details. |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
17 | * |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19562
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
18114
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
21 | */ |
|
adb3cfadc125
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17853
diff
changeset
|
22 | |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
23 | #include "config.h" |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
24 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
25 | #ifdef USE_PYTHON |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
26 | #include <Python.h> |
|
31830
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
27 | #endif |
|
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
28 | |
|
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
29 | /* Python.h may define _GNU_SOURCE and _XOPEN_SOURCE_EXTENDED, so protect |
|
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
30 | * these checks with #ifndef/!defined() */ |
|
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
31 | #ifndef _GNU_SOURCE |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | #define _GNU_SOURCE |
|
31830
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
33 | #endif |
|
7d6045f46f72
Fix gntwm.c compile on some platforms.
Ethan Blanton <elb@pidgin.im>
parents:
31294
diff
changeset
|
34 | |
|
32040
d4345b8d4763
Patch from OpenBSD Ports to fix finch build on OpenBSD
Ethan Blanton <elb@pidgin.im>
parents:
31830
diff
changeset
|
35 | #if !defined _XOPEN_SOURCE_EXTENDED && (defined(__APPLE__) || defined(__unix__)) && !defined(__FreeBSD__) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
36 | #define _XOPEN_SOURCE_EXTENDED |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
37 | #endif |
|
14966
28f21386d822
[gaim-migrate @ 17676]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14962
diff
changeset
|
38 | |
|
20180
0028da879056
Fix compiling with old glib where glib/gprint.h doesn't exist, refs #3144
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
19859
diff
changeset
|
39 | #include <glib.h> |
|
33649
1d643f401252
Remove old GLib version checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32040
diff
changeset
|
40 | #include <glib/gstdio.h> |
|
15863
7411e672a88b
Re-order includes to fix this compile error:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15839
diff
changeset
|
41 | #include <ctype.h> |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
42 | #include <gmodule.h> |
|
15863
7411e672a88b
Re-order includes to fix this compile error:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15839
diff
changeset
|
43 | #include <stdlib.h> |
|
7411e672a88b
Re-order includes to fix this compile error:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15839
diff
changeset
|
44 | #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
|
45 | #include <time.h> |
|
15863
7411e672a88b
Re-order includes to fix this compile error:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15839
diff
changeset
|
46 | |
|
24822
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
47 | #include "gntinternal.h" |
|
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
48 | #undef GNT_LOG_DOMAIN |
|
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
49 | #define GNT_LOG_DOMAIN "WM" |
|
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
50 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
51 | #include "gntwm.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
52 | #include "gntstyle.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
53 | #include "gntmarshal.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
54 | #include "gnt.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
55 | #include "gntbox.h" |
|
19314
472ad9489d68
Fix some white-space and other similar issues. Preparing for a merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19307
diff
changeset
|
56 | #include "gntbutton.h" |
|
472ad9489d68
Fix some white-space and other similar issues. Preparing for a merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19307
diff
changeset
|
57 | #include "gntentry.h" |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
58 | #include "gntfilesel.h" |
|
16188
2c7ee371f005
alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16056
diff
changeset
|
59 | #include "gntlabel.h" |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
60 | #include "gntmenu.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
61 | #include "gnttextview.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
62 | #include "gnttree.h" |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
63 | #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
|
64 | #include "gntwindow.h" |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
65 | |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
66 | #define IDLE_CHECK_INTERVAL 5 /* 5 seconds */ |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
67 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
68 | enum |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
69 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
70 | SIG_NEW_WIN, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
71 | SIG_DECORATE_WIN, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
72 | SIG_CLOSE_WIN, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
73 | SIG_CONFIRM_RESIZE, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
74 | SIG_RESIZED, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
75 | SIG_CONFIRM_MOVE, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
76 | SIG_MOVED, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
77 | SIG_UPDATE_WIN, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
78 | SIG_GIVE_FOCUS, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
79 | SIG_KEY_PRESS, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
80 | SIG_MOUSE_CLICK, |
|
18420
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
81 | SIG_TERMINAL_REFRESH, |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
82 | SIGS |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
83 | }; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
84 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
85 | static guint signals[SIGS] = { 0 }; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
86 | static void gnt_wm_new_window_real(GntWM *wm, GntWidget *widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
87 | static void gnt_wm_win_resized(GntWM *wm, GntNode *node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
88 | static void gnt_wm_win_moved(GntWM *wm, GntNode *node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
89 | static void gnt_wm_give_focus(GntWM *wm, GntWidget *widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
90 | 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
|
91 | static void shift_window(GntWM *wm, GntWidget *widget, int dir); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
92 | static gboolean workspace_next(GntBindable *wm, GList *n); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
93 | static gboolean workspace_prev(GntBindable *wm, GList *n); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
94 | |
|
17094
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
95 | #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
|
96 | 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
|
97 | #endif |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
98 | |
|
21708
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
99 | static void ensure_normal_mode(GntWM *wm); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
100 | static gboolean write_already(gpointer data); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
101 | static int write_timeout; |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
102 | static time_t last_active_time; |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
103 | static gboolean idle_update; |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
104 | static GList *act = NULL; /* list of WS with unseen activitiy */ |
|
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
|
105 | static gboolean ignore_keys = FALSE; |
|
23001
beca6066b85b
Fix a compiler warning due to a missing #ifdef USE_PYTHON
Richard Laager <rlaager@pidgin.im>
parents:
22952
diff
changeset
|
106 | #ifdef USE_PYTHON |
|
22642
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
107 | static gboolean started_python = FALSE; |
|
23001
beca6066b85b
Fix a compiler warning due to a missing #ifdef USE_PYTHON
Richard Laager <rlaager@pidgin.im>
parents:
22952
diff
changeset
|
108 | #endif |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
109 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
110 | static GList * |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
111 | g_list_bring_to_front(GList *list, gpointer data) |
|
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 | list = g_list_remove(list, data); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
114 | list = g_list_prepend(list, data); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
115 | return list; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
116 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
117 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
118 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
119 | free_node(gpointer data) |
|
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 | GntNode *node = data; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
122 | hide_panel(node->panel); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
123 | del_panel(node->panel); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
124 | g_free(node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
125 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
126 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
127 | void |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
128 | gnt_wm_copy_win(GntWidget *widget, 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
|
129 | { |
|
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
|
130 | 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
|
131 | 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
|
132 | 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
|
133 | 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
|
134 | 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
|
135 | copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0); |
|
26650
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
136 | |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
137 | /* Update the hardware cursor */ |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
138 | if (GNT_IS_WINDOW(widget) || GNT_IS_BOX(widget)) { |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
139 | GntWidget *active = GNT_BOX(widget)->active; |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
140 | if (active) { |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
141 | int curx = active->priv.x + getcurx(active->window); |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
142 | int cury = active->priv.y + getcury(active->window); |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
143 | if (wmove(node->window, cury - widget->priv.y, curx - widget->priv.x) != OK) |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
144 | wmove(node->window, 0, 0); |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
145 | } |
|
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
146 | } |
|
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
|
147 | } |
|
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
|
148 | |
|
17094
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
149 | /** |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
150 | * 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
|
151 | * Read about it in: http://article.gmane.org/gmane.comp.lib.ncurses.bugs/2751 |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
152 | * |
|
17094
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
153 | * 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
|
154 | * 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
|
155 | * 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
|
156 | * |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
157 | * 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
|
158 | * 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
|
159 | */ |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
160 | static void |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21915
diff
changeset
|
161 | work_around_for_ncurses_bug(void) |
|
17094
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
162 | { |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
163 | #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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
170 | 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
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
175 | 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
|
176 | 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
|
177 | 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
|
178 | continue; |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
179 | 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
|
180 | 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
|
181 | continue; |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
182 | 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
|
183 | 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
|
184 | 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
|
185 | 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
|
186 | 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
|
187 | 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
|
188 | 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
|
189 | 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
|
190 | 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
|
191 | } |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
192 | right: |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
193 | 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
|
194 | continue; |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
195 | 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
|
196 | 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
|
197 | 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
|
198 | 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
|
199 | 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
|
200 | 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
|
201 | } |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
202 | } |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
203 | } |
|
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 | #endif |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
206 | } |
|
a728bde379cf
A workaround for an ncurses bug about multi-cell characters and panels.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16584
diff
changeset
|
207 | |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
208 | static void |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21915
diff
changeset
|
209 | update_act_msg(void) |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
210 | { |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
211 | GntWidget *label; |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
212 | GList *iter; |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
213 | static GntWidget *message = NULL; |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
214 | GString *text = g_string_new("act: "); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
215 | if (message) |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
216 | gnt_widget_destroy(message); |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
23001
diff
changeset
|
217 | if (!act) |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
218 | return; |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
219 | for (iter = act; iter; iter = iter->next) { |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
220 | GntWS *ws = iter->data; |
| 18133 | 221 | g_string_append_printf(text, "%s, ", gnt_ws_get_name(ws)); |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
222 | } |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
223 | g_string_erase(text, text->len - 2, 2); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
224 | message = gnt_vbox_new(FALSE); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
225 | label = gnt_label_new_with_format(text->str, GNT_TEXT_FLAG_BOLD | GNT_TEXT_FLAG_HIGHLIGHT); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
226 | GNT_WIDGET_UNSET_FLAGS(GNT_BOX(message), GNT_WIDGET_CAN_TAKE_FOCUS); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
227 | GNT_WIDGET_SET_FLAGS(GNT_BOX(message), GNT_WIDGET_TRANSIENT); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
228 | gnt_box_add_widget(GNT_BOX(message), label); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
229 | gnt_widget_set_name(message, "wm-message"); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
230 | gnt_widget_set_position(message, 0, 0); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
231 | gnt_widget_draw(message); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
232 | g_string_free(text, TRUE); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
233 | } |
|
17139
6a6f27caf79e
propagate from branch 'im.pidgin.pidgin' (head 41a52fb8d3b6772f937ad085d9bae4b361898362)
Richard Nelson <wabz@pidgin.im>
diff
changeset
|
234 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
235 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
236 | update_screen(GntWM *wm) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
237 | { |
|
18599
7e31405a2cbb
Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18596
diff
changeset
|
238 | if (wm->mode == GNT_KP_MODE_WAIT_ON_CHILD) |
|
7e31405a2cbb
Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18596
diff
changeset
|
239 | return TRUE; |
|
7e31405a2cbb
Allow executing another application (eg. PAGER) that will use the same
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18596
diff
changeset
|
240 | |
|
14962
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 |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
257 | sanitize_position(GntWidget *widget, int *x, int *y, gboolean m) |
|
15129
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; |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
264 | GntWindowFlags flags = GNT_IS_WINDOW(widget) ? |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
265 | gnt_window_get_maximize(GNT_WINDOW(widget)) : 0; |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
266 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
267 | gnt_widget_get_size(widget, &w, &h); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
268 | if (x) { |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
269 | if (m && (flags & GNT_WINDOW_MAXIMIZE_X) && *x != 0) { |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
270 | *x = 0; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
271 | changed = TRUE; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
272 | } else if (*x + w > X_MAX) { |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
273 | nx = MAX(0, X_MAX - w); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
274 | if (nx != *x) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
275 | *x = nx; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
276 | changed = TRUE; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
277 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
278 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
279 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
280 | if (y) { |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
281 | if (m && (flags & GNT_WINDOW_MAXIMIZE_Y) && *y != 0) { |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
282 | *y = 0; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
283 | changed = TRUE; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
284 | } else if (*y + h > Y_MAX) { |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
285 | ny = MAX(0, Y_MAX - h); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
286 | if (ny != *y) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
287 | *y = ny; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
288 | changed = TRUE; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
289 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
290 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
291 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
292 | return changed; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
293 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
294 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
295 | static void |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
296 | refresh_node(GntWidget *widget, GntNode *node, gpointer m) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
297 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
298 | int x, y, w, h; |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
299 | int nw, nh; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
300 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
301 | int X_MAX = getmaxx(stdscr); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
302 | int Y_MAX = getmaxy(stdscr) - 1; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
303 | |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
304 | GntWindowFlags flags = 0; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
305 | |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
306 | if (m && GNT_IS_WINDOW(widget)) { |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
307 | flags = gnt_window_get_maximize(GNT_WINDOW(widget)); |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
308 | } |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
309 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
310 | gnt_widget_get_position(widget, &x, &y); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
311 | gnt_widget_get_size(widget, &w, &h); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
312 | |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
313 | if (sanitize_position(widget, &x, &y, !!m)) |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
314 | gnt_screen_move_widget(widget, x, y); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
315 | |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
316 | if (flags & GNT_WINDOW_MAXIMIZE_X) |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
317 | nw = X_MAX; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
318 | else |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
319 | nw = MIN(w, X_MAX); |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
320 | |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
321 | if (flags & GNT_WINDOW_MAXIMIZE_Y) |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
322 | nh = Y_MAX; |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
323 | else |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
324 | nh = MIN(h, Y_MAX); |
|
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
325 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
326 | if (nw != w || nh != h) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
327 | gnt_screen_resize_widget(widget, nw, nh); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
328 | } |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
329 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
330 | static void |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
331 | read_window_positions(GntWM *wm) |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
332 | { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
333 | GKeyFile *gfile = g_key_file_new(); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
334 | 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
|
335 | GError *error = NULL; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
336 | char **keys; |
|
15219
4d959b4386bb
[gaim-migrate @ 17943]
Mark Doliner <markdoliner@pidgin.im>
parents:
15199
diff
changeset
|
337 | gsize nk; |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
338 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
339 | if (!g_key_file_load_from_file(gfile, filename, G_KEY_FILE_NONE, &error)) { |
|
24822
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
340 | gnt_warning("%s", error->message); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
341 | g_error_free(error); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
342 | g_free(filename); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
343 | return; |
|
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 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
346 | keys = g_key_file_get_keys(gfile, "positions", &nk, &error); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
347 | if (error) { |
|
24822
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
348 | gnt_warning("%s", error->message); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
349 | g_error_free(error); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
350 | error = NULL; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
351 | } else { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
352 | while (nk--) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
353 | char *title = keys[nk]; |
|
15219
4d959b4386bb
[gaim-migrate @ 17943]
Mark Doliner <markdoliner@pidgin.im>
parents:
15199
diff
changeset
|
354 | gsize l; |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
355 | 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
|
356 | if (l == 2) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
357 | int x = atoi(coords[0]); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
358 | int y = atoi(coords[1]); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
359 | GntPosition *p = g_new0(GntPosition, 1); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
360 | p->x = x; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
361 | p->y = y; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
362 | 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
|
363 | } else { |
|
25601
61ba797ef480
Fix a warning I caught about using %d for a gsize.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25353
diff
changeset
|
364 | gnt_warning("Invalid number of arguments (%" G_GSIZE_FORMAT |
|
61ba797ef480
Fix a warning I caught about using %d for a gsize.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25353
diff
changeset
|
365 | ") for positioning a window.", l); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
366 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
367 | g_strfreev(coords); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
368 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
369 | g_strfreev(keys); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
370 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
371 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
372 | g_free(filename); |
| 16025 | 373 | g_key_file_free(gfile); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
374 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
375 | |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
376 | static gboolean check_idle(gpointer n) |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
377 | { |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
378 | if (idle_update) { |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
379 | time(&last_active_time); |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
380 | idle_update = FALSE; |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
381 | } |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
382 | return TRUE; |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
383 | } |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
384 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
385 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
386 | gnt_wm_init(GTypeInstance *instance, gpointer class) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
387 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
388 | GntWM *wm = GNT_WM(instance); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
389 | wm->workspaces = NULL; |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
390 | wm->name_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
391 | wm->title_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
392 | gnt_style_read_workspaces(wm); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
393 | if (wm->workspaces == NULL) { |
|
18137
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
394 | wm->cws = gnt_ws_new("default"); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
395 | gnt_wm_add_workspace(wm, wm->cws); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
396 | } else { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
397 | wm->cws = wm->workspaces->data; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
398 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
399 | wm->event_stack = FALSE; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
400 | wm->tagged = NULL; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
401 | wm->windows = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
402 | wm->actions = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
403 | 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
|
404 | 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
|
405 | if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE)) |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
406 | read_window_positions(wm); |
|
26651
d9f1eeefb89c
Save the world.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26650
diff
changeset
|
407 | g_timeout_add_seconds(IDLE_CHECK_INTERVAL, check_idle, NULL); |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
408 | time(&last_active_time); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
409 | gnt_wm_switch_workspace(wm, 0); |
|
14962
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 | static void |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
413 | switch_window(GntWM *wm, int direction, gboolean urgent) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
414 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
415 | GntWidget *w = NULL, *wid = NULL; |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
416 | int pos, orgpos; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
417 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
418 | if (wm->_list.window || wm->menu) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
419 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
420 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
421 | if (!wm->cws->ordered || !wm->cws->ordered->next) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
422 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
423 | |
|
21708
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
424 | if (wm->mode != GNT_KP_MODE_NORMAL) { |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
425 | ensure_normal_mode(wm); |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
426 | } |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
427 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
428 | w = wm->cws->ordered->data; |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
429 | orgpos = pos = g_list_index(wm->cws->list, w); |
|
34306
4fb8809f2f97
Fix finch warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
430 | g_return_if_fail(pos < 0); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
431 | |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
432 | do { |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
433 | pos += direction; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
434 | |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
435 | if (pos < 0) { |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
436 | wid = g_list_last(wm->cws->list)->data; |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
437 | pos = g_list_length(wm->cws->list) - 1; |
|
34306
4fb8809f2f97
Fix finch warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33892
diff
changeset
|
438 | } else if ((guint)pos >= g_list_length(wm->cws->list)) { |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
439 | wid = wm->cws->list->data; |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
440 | pos = 0; |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
441 | } else |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
442 | wid = g_list_nth_data(wm->cws->list, pos); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
443 | } while (urgent && !GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT) && pos != orgpos); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
444 | |
|
18567
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
445 | gnt_wm_raise_window(wm, wid); |
|
14962
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 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
448 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
449 | window_next(GntBindable *bindable, GList *null) |
|
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 | GntWM *wm = GNT_WM(bindable); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
452 | switch_window(wm, 1, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
453 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
454 | } |
|
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 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
457 | window_prev(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
458 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
459 | GntWM *wm = GNT_WM(bindable); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
460 | switch_window(wm, -1, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
461 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
462 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
463 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
464 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
465 | switch_window_n(GntBindable *bind, GList *list) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
466 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
467 | GntWM *wm = GNT_WM(bind); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
468 | GList *l; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
469 | int n; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
470 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
471 | if (!wm->cws->ordered) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
472 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
473 | |
|
15272
c6e322c9c9b2
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15258
diff
changeset
|
474 | if (list) |
|
c6e322c9c9b2
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15258
diff
changeset
|
475 | n = GPOINTER_TO_INT(list->data); |
|
c6e322c9c9b2
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15258
diff
changeset
|
476 | else |
|
c6e322c9c9b2
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15258
diff
changeset
|
477 | 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
|
478 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
479 | if ((l = g_list_nth(wm->cws->list, n)) != NULL) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
480 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
481 | gnt_wm_raise_window(wm, l->data); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
482 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
483 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
484 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
485 | } |
|
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
|
486 | |
|
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 | 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
|
488 | 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
|
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 | 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
|
491 | 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
|
492 | 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
|
493 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
494 | if (!wm->cws->ordered) |
|
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
|
495 | 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
|
496 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
497 | window = wm->cws->ordered->data; |
|
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
|
498 | 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
|
499 | 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
|
500 | 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
|
501 | |
|
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 | 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
|
503 | node->scroll--; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
504 | gnt_wm_copy_win(window, 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
|
505 | 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
|
506 | } |
|
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
|
507 | 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
|
508 | } |
|
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
|
509 | |
|
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
|
510 | 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
|
511 | 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
|
512 | { |
|
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
|
513 | 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
|
514 | 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
|
515 | 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
|
516 | 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
|
517 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
518 | if (!wm->cws->ordered) |
|
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
|
519 | 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
|
520 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
521 | window = wm->cws->ordered->data; |
|
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
|
522 | 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
|
523 | 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
|
524 | 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
|
525 | |
|
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
|
526 | 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
|
527 | 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
|
528 | node->scroll++; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
529 | gnt_wm_copy_win(window, 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
|
530 | 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
|
531 | } |
|
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
|
532 | 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
|
533 | } |
|
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
|
534 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
535 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
536 | window_close(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
537 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
538 | GntWM *wm = GNT_WM(bindable); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
539 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
540 | if (wm->_list.window) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
541 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
542 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
543 | if (wm->cws->ordered) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
544 | gnt_widget_destroy(wm->cws->ordered->data); |
|
21708
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
545 | ensure_normal_mode(wm); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
546 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
547 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
548 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
549 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
550 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
551 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
552 | destroy__list(GntWidget *widget, GntWM *wm) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
553 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
554 | wm->_list.window = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
555 | wm->_list.tree = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
556 | wm->windows = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
557 | wm->actions = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
558 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
559 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
560 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
561 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
562 | setup__list(GntWM *wm) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
563 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
564 | GntWidget *tree, *win; |
|
21708
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
565 | ensure_normal_mode(wm); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
566 | win = wm->_list.window = gnt_box_new(FALSE, FALSE); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
567 | gnt_box_set_toplevel(GNT_BOX(win), TRUE); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
568 | gnt_box_set_pad(GNT_BOX(win), 0); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
569 | GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_TRANSIENT); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
570 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
571 | tree = wm->_list.tree = gnt_tree_new(); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
572 | gnt_box_add_widget(GNT_BOX(win), tree); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
573 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
574 | 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
|
575 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
576 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
577 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
578 | window_list_activate(GntTree *tree, GntWM *wm) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
579 | { |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
580 | GntBindable *sel = gnt_tree_get_selection_data(GNT_TREE(tree)); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
581 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
582 | gnt_widget_destroy(wm->_list.window); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
583 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
584 | if (!sel) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
585 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
586 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
587 | if (GNT_IS_WS(sel)) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
588 | gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, sel)); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
589 | } else { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
590 | gnt_wm_raise_window(wm, GNT_WIDGET(sel)); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
591 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
592 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
593 | |
|
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
|
594 | static void |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
595 | populate_window_list(GntWM *wm, gboolean workspace) |
|
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
|
596 | { |
|
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
|
597 | 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
|
598 | GntTree *tree = GNT_TREE(wm->windows->tree); |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
599 | if (!workspace) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
600 | for (iter = wm->cws->list; iter; iter = iter->next) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
601 | GntBox *box = GNT_BOX(iter->data); |
|
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
|
602 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
603 | gnt_tree_add_row_last(tree, box, |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
604 | gnt_tree_create_row(tree, box->title), NULL); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
605 | update_window_in_list(wm, GNT_WIDGET(box)); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
606 | } |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
607 | } else { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
608 | GList *ws = wm->workspaces; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
609 | for (; ws; ws = ws->next) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
610 | gnt_tree_add_row_last(tree, ws->data, |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
611 | gnt_tree_create_row(tree, gnt_ws_get_name(GNT_WS(ws->data))), NULL); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
612 | for (iter = GNT_WS(ws->data)->list; iter; iter = iter->next) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
613 | GntBox *box = GNT_BOX(iter->data); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
614 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
615 | gnt_tree_add_row_last(tree, box, |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
616 | gnt_tree_create_row(tree, box->title), ws->data); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
617 | update_window_in_list(wm, GNT_WIDGET(box)); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
618 | } |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
619 | } |
|
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
|
620 | } |
|
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
|
621 | } |
|
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
|
622 | |
|
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
|
623 | 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
|
624 | 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
|
625 | { |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
626 | if (text[1] == 0 && wm->cws->ordered) { |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
627 | GntBindable *sel = gnt_tree_get_selection_data(GNT_TREE(widget)); |
|
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
|
628 | 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
|
629 | case '-': |
|
16189
eec6c18f2abf
These bindings are easier for changing window order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16188
diff
changeset
|
630 | case ',': |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
631 | if (GNT_IS_WS(sel)) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
632 | /* reorder the workspace. */ |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
633 | } else |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
634 | shift_window(wm, GNT_WIDGET(sel), -1); |
|
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
|
635 | break; |
|
16189
eec6c18f2abf
These bindings are easier for changing window order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16188
diff
changeset
|
636 | case '=': |
|
eec6c18f2abf
These bindings are easier for changing window order.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16188
diff
changeset
|
637 | case '.': |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
638 | if (GNT_IS_WS(sel)) { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
639 | /* reorder the workspace. */ |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
640 | } else |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
641 | shift_window(wm, GNT_WIDGET(sel), 1); |
|
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
|
642 | 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
|
643 | 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
|
644 | 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
|
645 | } |
|
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
|
646 | gnt_tree_remove_all(GNT_TREE(widget)); |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
647 | populate_window_list(wm, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "workspace"))); |
|
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
|
648 | 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
|
649 | 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
|
650 | } |
|
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
|
651 | 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
|
652 | } |
|
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
|
653 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
654 | static void |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
655 | list_of_windows(GntWM *wm, gboolean workspace) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
656 | { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
657 | GntWidget *tree, *win; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
658 | setup__list(wm); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
659 | wm->windows = &wm->_list; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
660 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
661 | win = wm->windows->window; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
662 | tree = wm->windows->tree; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
663 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
664 | gnt_box_set_title(GNT_BOX(win), workspace ? "Workspace List" : "Window List"); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
665 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
666 | populate_window_list(wm, workspace); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
667 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
668 | if (wm->cws->ordered) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
669 | gnt_tree_set_selected(GNT_TREE(tree), wm->cws->ordered->data); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
670 | else if (workspace) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
671 | gnt_tree_set_selected(GNT_TREE(tree), wm->cws); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
672 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
673 | g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), wm); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
674 | g_signal_connect(G_OBJECT(tree), "key_pressed", G_CALLBACK(window_list_key_pressed), wm); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
675 | g_object_set_data(G_OBJECT(tree), "workspace", GINT_TO_POINTER(workspace)); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
676 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
677 | gnt_tree_set_col_width(GNT_TREE(tree), 0, getmaxx(stdscr) / 3); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
678 | gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
679 | gnt_widget_set_position(win, getmaxx(stdscr) / 3, getmaxy(stdscr) / 4); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
680 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
681 | gnt_widget_show(win); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
682 | } |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
683 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
684 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
685 | window_list(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
686 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
687 | GntWM *wm = GNT_WM(bindable); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
688 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
689 | if (wm->_list.window || wm->menu) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
690 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
691 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
692 | if (!wm->cws->ordered) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
693 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
694 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
695 | list_of_windows(wm, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
696 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
697 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
698 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
699 | |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
700 | static void |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
701 | dump_file_save(GntFileSel *fs, const char *path, const char *f, gpointer n) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
702 | { |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
703 | FILE *file; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
704 | int x, y; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
705 | chtype old = 0, now = 0; |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
706 | struct { |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
707 | char ascii; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
708 | char *unicode; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
709 | } unis[] = { |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
710 | {'q', "─"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
711 | {'t', "├"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
712 | {'u', "┤"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
713 | {'x', "│"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
714 | {'-', "↑"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
715 | {'.', "↓"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
716 | {'l', "┌"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
717 | {'k', "┐"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
718 | {'m', "└"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
719 | {'j', "┘"}, |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
720 | {'a', "▒"}, |
|
18788
6617cf363381
Add a missing line-drawing character in the HTML screen-dump.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18756
diff
changeset
|
721 | {'n', "┼"}, |
|
19197
172671e74863
Add two more missing characters for the HTML dump.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19180
diff
changeset
|
722 | {'w', "┬"}, |
|
172671e74863
Add two more missing characters for the HTML dump.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19180
diff
changeset
|
723 | {'v', "┴"}, |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
724 | {'\0', NULL} |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
725 | }; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
726 | |
|
21834
3b38970ae13f
Remove the file dialog first before dumping the screenshot.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21793
diff
changeset
|
727 | gnt_widget_destroy(GNT_WIDGET(fs)); |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
728 | |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
729 | if ((file = g_fopen(path, "w+")) == NULL) { |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
730 | return; |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
731 | } |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
732 | |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
733 | 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
|
734 | fprintf(file, "<pre>"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
735 | for (y = 0; y < getmaxy(stdscr); y++) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
736 | for (x = 0; x < getmaxx(stdscr); x++) { |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
737 | char ch[2] = {0, 0}, *print; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
738 | #ifdef NO_WIDECHAR |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
739 | now = mvwinch(curscr, y, x); |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
740 | ch[0] = now & A_CHARTEXT; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
741 | now ^= ch[0]; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
742 | #else |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
743 | cchar_t wch; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
744 | char unicode[12]; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
745 | mvwin_wch(curscr, y, x, &wch); |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
746 | now = wch.attr; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
747 | ch[0] = (char)(wch.chars[0] & 0xff); |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
748 | #endif |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
749 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
750 | #define CHECK(attr, start, end) \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
751 | do \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
752 | { \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
753 | if (now & attr) \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
754 | { \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
755 | if (!(old & attr)) \ |
|
15258
ca95e4c752e8
[gaim-migrate @ 17985]
Mark Doliner <markdoliner@pidgin.im>
parents:
15219
diff
changeset
|
756 | fprintf(file, "%s", start); \ |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
757 | } \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
758 | else if (old & attr) \ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
759 | { \ |
|
15258
ca95e4c752e8
[gaim-migrate @ 17985]
Mark Doliner <markdoliner@pidgin.im>
parents:
15219
diff
changeset
|
760 | fprintf(file, "%s", end); \ |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
761 | } \ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
762 | } while (0) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
763 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
764 | CHECK(A_BOLD, "<b>", "</b>"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
765 | CHECK(A_UNDERLINE, "<u>", "</u>"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
766 | CHECK(A_BLINK, "<blink>", "</blink>"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
767 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
768 | if ((now & A_COLOR) != (old & A_COLOR) || |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
769 | (now & A_REVERSE) != (old & A_REVERSE)) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
770 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
771 | short fgp, bgp, r, g, b; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
772 | struct |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
773 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
774 | int r, g, b; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
775 | } fg, bg; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
776 | |
|
33892
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
777 | if (pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp) != OK) { |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
778 | fgp = -1; |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
779 | bgp = -1; |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
780 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
781 | if (fgp == -1) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
782 | fgp = COLOR_BLACK; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
783 | if (bgp == -1) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
784 | bgp = COLOR_WHITE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
785 | 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
|
786 | { |
|
1442df274a24
Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@pidgin.im>
parents:
17181
diff
changeset
|
787 | short tmp = fgp; |
|
1442df274a24
Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@pidgin.im>
parents:
17181
diff
changeset
|
788 | fgp = bgp; |
|
1442df274a24
Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@pidgin.im>
parents:
17181
diff
changeset
|
789 | bgp = tmp; |
|
1442df274a24
Fix a compiler warning by using a temporary variable for swapping.
Richard Laager <rlaager@pidgin.im>
parents:
17181
diff
changeset
|
790 | } |
|
33892
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
791 | if (color_content(fgp, &r, &g, &b) != OK) { |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
792 | r = g = b = 0; |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
793 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
794 | fg.r = r; fg.b = b; fg.g = g; |
|
33892
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
795 | if (color_content(bgp, &r, &g, &b) != OK) { |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
796 | r = g = b = 255; |
|
ef97228bc5f0
Fix most of warnings for gtk2 and linux
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33811
diff
changeset
|
797 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
798 | bg.r = r; bg.b = b; bg.g = g; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
799 | #define ADJUST(x) (x = x * 255 / 1000) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
800 | ADJUST(fg.r); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
801 | ADJUST(fg.g); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
802 | ADJUST(fg.b); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
803 | ADJUST(bg.r); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
804 | ADJUST(bg.b); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
805 | ADJUST(bg.g); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
806 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
807 | if (x) fprintf(file, "</span>"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
808 | 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
|
809 | 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
|
810 | } |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
811 | print = ch; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
812 | #ifndef NO_WIDECHAR |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
813 | if (wch.chars[0] > 255) { |
|
19562
f7931803273a
Get rid of compile warnings on older glib.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19317
diff
changeset
|
814 | snprintf(unicode, sizeof(unicode), "&#x%x;", (unsigned int)wch.chars[0]); |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
815 | print = unicode; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
816 | } |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
817 | #endif |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
818 | if (now & A_ALTCHARSET) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
819 | { |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
820 | int u; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
821 | for (u = 0; unis[u].ascii; u++) { |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
822 | if (ch[0] == unis[u].ascii) { |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
823 | print = unis[u].unicode; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
824 | break; |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
825 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
826 | } |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
827 | if (!unis[u].ascii) |
|
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
828 | print = " "; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
829 | } |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
830 | if (ch[0] == '&') |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
831 | fprintf(file, "&"); |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
832 | else if (ch[0] == '<') |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
833 | fprintf(file, "<"); |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
834 | else if (ch[0] == '>') |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
835 | fprintf(file, ">"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
836 | else |
|
17181
cc871788e3f8
Generate nicer HTML dumps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17094
diff
changeset
|
837 | fprintf(file, "%s", print); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
838 | old = now; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
839 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
840 | fprintf(file, "</span>\n"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
841 | old = 0; |
|
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, "</pre>\n</body>"); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
844 | fclose(file); |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
845 | } |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
846 | |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
847 | static void |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
848 | dump_file_cancel(GntWidget *w, GntFileSel *fs) |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
849 | { |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
850 | gnt_widget_destroy(GNT_WIDGET(fs)); |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
851 | } |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
852 | |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
853 | static gboolean |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
854 | dump_screen(GntBindable *b, GList *null) |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
855 | { |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
856 | GntWidget *window = gnt_file_sel_new(); |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
857 | GntFileSel *sel = GNT_FILE_SEL(window); |
|
21835
951e27453f24
Add a title and some helpful text in the 'save screenshot' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21834
diff
changeset
|
858 | |
|
951e27453f24
Add a title and some helpful text in the 'save screenshot' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21834
diff
changeset
|
859 | g_object_set(G_OBJECT(window), "vertical", TRUE, NULL); |
|
951e27453f24
Add a title and some helpful text in the 'save screenshot' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21834
diff
changeset
|
860 | gnt_box_add_widget(GNT_BOX(window), gnt_label_new("Please enter the filename to save the screenshot.")); |
|
951e27453f24
Add a title and some helpful text in the 'save screenshot' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21834
diff
changeset
|
861 | gnt_box_set_title(GNT_BOX(window), "Save Screenshot..."); |
|
951e27453f24
Add a title and some helpful text in the 'save screenshot' dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21834
diff
changeset
|
862 | |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
863 | gnt_file_sel_set_suggested_filename(sel, "dump.html"); |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
864 | g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(dump_file_save), NULL); |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
865 | g_signal_connect(G_OBJECT(sel->cancel), "activate", G_CALLBACK(dump_file_cancel), sel); |
|
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
866 | gnt_widget_show(window); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
867 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
868 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
869 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
870 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
871 | shift_window(GntWM *wm, GntWidget *widget, int dir) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
872 | { |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
873 | GList *all = wm->cws->list; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
874 | GList *list = g_list_find(all, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
875 | int length, pos; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
876 | if (!list) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
877 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
878 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
879 | length = g_list_length(all); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
880 | pos = g_list_position(all, list); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
881 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
882 | pos += dir; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
883 | if (dir > 0) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
884 | pos++; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
885 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
886 | if (pos < 0) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
887 | pos = length; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
888 | else if (pos > length) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
889 | pos = 0; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
890 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
891 | all = g_list_insert(all, widget, pos); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
892 | all = g_list_delete_link(all, list); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
893 | wm->cws->list = all; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
894 | gnt_ws_draw_taskbar(wm->cws, FALSE); |
|
29236
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
895 | if (wm->cws->ordered) { |
|
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
896 | GntWidget *w = wm->cws->ordered->data; |
|
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
897 | GntNode *node = g_hash_table_lookup(wm->nodes, w); |
|
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
898 | top_panel(node->panel); |
|
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
899 | update_panels(); |
|
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
900 | doupdate(); |
|
a1582a87b6ce
gnt: Restore hardware cursor after reordering windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26654
diff
changeset
|
901 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
902 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
903 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
904 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
905 | shift_left(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
906 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
907 | GntWM *wm = GNT_WM(bindable); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
908 | if (wm->_list.window) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
909 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
910 | |
|
18756
5498c1e29cca
Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18638
diff
changeset
|
911 | if(!wm->cws->ordered) |
|
5498c1e29cca
Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18638
diff
changeset
|
912 | return FALSE; |
|
5498c1e29cca
Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18638
diff
changeset
|
913 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
914 | shift_window(wm, wm->cws->ordered->data, -1); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
915 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
916 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
917 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
918 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
919 | shift_right(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
920 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
921 | GntWM *wm = GNT_WM(bindable); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
922 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
923 | if (wm->_list.window) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
924 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
925 | |
|
18756
5498c1e29cca
Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18638
diff
changeset
|
926 | if(!wm->cws->ordered) |
|
5498c1e29cca
Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18638
diff
changeset
|
927 | return FALSE; |
|
5498c1e29cca
Crash fixes from Eric Polino.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18638
diff
changeset
|
928 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
929 | shift_window(wm, wm->cws->ordered->data, 1); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
930 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
931 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
932 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
933 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
934 | action_list_activate(GntTree *tree, GntWM *wm) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
935 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
936 | GntAction *action = gnt_tree_get_selection_data(tree); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
937 | action->callback(); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
938 | gnt_widget_destroy(wm->_list.window); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
939 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
940 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
941 | static int |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
942 | compare_action(gconstpointer p1, gconstpointer p2) |
|
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 | const GntAction *a1 = p1; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
945 | const GntAction *a2 = p2; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
946 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
947 | return g_utf8_collate(a1->label, a2->label); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
948 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
949 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
950 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
951 | list_actions(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
952 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
953 | GntWidget *tree, *win; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
954 | GList *iter; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
955 | GntWM *wm = GNT_WM(bindable); |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
23001
diff
changeset
|
956 | int n; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
957 | if (wm->_list.window || wm->menu) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
958 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
959 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
960 | if (wm->acts == NULL) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
961 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
962 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
963 | setup__list(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
964 | wm->actions = &wm->_list; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
965 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
966 | win = wm->actions->window; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
967 | tree = wm->actions->tree; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
968 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
969 | gnt_box_set_title(GNT_BOX(win), "Actions"); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
970 | GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
971 | /* XXX: Do we really want this? */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
972 | gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
973 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
974 | for (iter = wm->acts; iter; iter = iter->next) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
975 | GntAction *action = iter->data; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
976 | gnt_tree_add_row_last(GNT_TREE(tree), action, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
977 | gnt_tree_create_row(GNT_TREE(tree), action->label), NULL); |
|
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 | g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), wm); |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
23001
diff
changeset
|
980 | n = g_list_length(wm->acts); |
|
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
23001
diff
changeset
|
981 | gnt_widget_set_size(tree, 0, n); |
|
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
23001
diff
changeset
|
982 | gnt_widget_set_position(win, 0, getmaxy(stdscr) - 3 - n); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
983 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
984 | gnt_widget_show(win); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
985 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
986 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
987 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
988 | #ifndef NO_WIDECHAR |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
989 | static int |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
990 | widestringwidth(wchar_t *wide) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
991 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
992 | int len, ret; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
993 | char *string; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
994 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
995 | len = wcstombs(NULL, wide, 0) + 1; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
996 | string = g_new0(char, len); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
997 | wcstombs(string, wide, len); |
|
18809
5ba9bf0804fe
Do a NULL-check to prevent a crash.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18788
diff
changeset
|
998 | ret = string ? gnt_util_onscreen_width(string, NULL) : 1; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
999 | g_free(string); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1000 | return ret; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1001 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1002 | #endif |
|
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 | /* Returns the onscreen width of the character at the position */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1005 | static int |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1006 | reverse_char(WINDOW *d, int y, int x, gboolean set) |
|
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 | #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1009 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1010 | #ifdef NO_WIDECHAR |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1011 | chtype ch; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1012 | ch = mvwinch(d, y, x); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1013 | mvwaddch(d, y, x, DECIDE(ch)); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1014 | return 1; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1015 | #else |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1016 | cchar_t ch; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1017 | int wc = 1; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1018 | if (mvwin_wch(d, y, x, &ch) == OK) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1019 | wc = widestringwidth(ch.chars); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1020 | ch.attr = DECIDE(ch.attr); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1021 | 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
|
1022 | mvwadd_wch(d, y, x, &ch); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1023 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1024 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1025 | return wc; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1026 | #endif |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1027 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1028 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1029 | 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
|
1030 | window_reverse(GntWidget *win, gboolean set, GntWM *wm) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1031 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1032 | int i; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1033 | int w, h; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1034 | WINDOW *d; |
|
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 | if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1037 | return; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1038 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1039 | d = win->window; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1040 | gnt_widget_get_size(win, &w, &h); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1041 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1042 | if (gnt_widget_has_shadow(win)) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1043 | --w; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1044 | --h; |
|
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 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1047 | /* the top and bottom */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1048 | 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
|
1049 | 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
|
1050 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1051 | /* the left and right */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1052 | 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
|
1053 | 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
|
1054 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1055 | gnt_wm_copy_win(win, g_hash_table_lookup(wm->nodes, win)); |
|
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
|
1056 | update_screen(wm); |
|
14962
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 | |
|
21708
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1059 | static void |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1060 | ensure_normal_mode(GntWM *wm) |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1061 | { |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1062 | if (wm->mode != GNT_KP_MODE_NORMAL) { |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1063 | if (wm->cws->ordered) |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1064 | window_reverse(wm->cws->ordered->data, FALSE, wm); |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1065 | wm->mode = GNT_KP_MODE_NORMAL; |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1066 | } |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1067 | } |
|
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1068 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1069 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1070 | start_move(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1071 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1072 | GntWM *wm = GNT_WM(bindable); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1073 | if (wm->_list.window || wm->menu) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1074 | return TRUE; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1075 | if (!wm->cws->ordered) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1076 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1077 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1078 | wm->mode = GNT_KP_MODE_MOVE; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1079 | window_reverse(GNT_WIDGET(wm->cws->ordered->data), TRUE, wm); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1080 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1081 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1082 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1083 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1084 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1085 | start_resize(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1086 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1087 | GntWM *wm = GNT_WM(bindable); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1088 | if (wm->_list.window || wm->menu) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1089 | return TRUE; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1090 | if (!wm->cws->ordered) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1091 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1092 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1093 | wm->mode = GNT_KP_MODE_RESIZE; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1094 | window_reverse(GNT_WIDGET(wm->cws->ordered->data), TRUE, wm); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1095 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1096 | return TRUE; |
|
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 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1099 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1100 | wm_quit(GntBindable *bindable, GList *list) |
|
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 | GntWM *wm = GNT_WM(bindable); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1103 | if (write_timeout) |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1104 | write_already(wm); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1105 | g_main_loop_quit(wm->loop); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1106 | return TRUE; |
|
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 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1109 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1110 | return_true(GntWM *wm, GntWidget *w, int *a, int *b) |
|
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 | return TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1113 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1114 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1115 | static gboolean |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1116 | refresh_screen(GntBindable *bindable, GList *null) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1117 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1118 | GntWM *wm = GNT_WM(bindable); |
|
29237
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1119 | GList *iter; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1120 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1121 | endwin(); |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1122 | refresh(); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1123 | |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1124 | g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, GINT_TO_POINTER(TRUE)); |
|
18420
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1125 | g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0); |
|
29237
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1126 | |
|
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1127 | for (iter = g_list_last(wm->cws->ordered); iter; iter = iter->prev) { |
|
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1128 | GntWidget *w = iter->data; |
|
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1129 | GntNode *node = g_hash_table_lookup(wm->nodes, w); |
|
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1130 | top_panel(node->panel); |
|
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1131 | } |
|
c34ebb81ce4a
gnt: Make sure the ordering of the windows is correct after a refresh.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29236
diff
changeset
|
1132 | |
|
26650
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
1133 | gnt_ws_draw_taskbar(wm->cws, TRUE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1134 | update_screen(wm); |
|
18139
6f8ce11e928a
This got lost from a merge I think. This refixes #532.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18137
diff
changeset
|
1135 | curs_set(0); /* endwin resets the cursor to normal */ |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1136 | |
|
18600
4645484d0776
The key has been processed. Return TRUE.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18599
diff
changeset
|
1137 | return TRUE; |
|
14962
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 | |
|
16584
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1140 | static gboolean |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1141 | 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
|
1142 | { |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1143 | static GntWidget *clip; |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1144 | gchar *text; |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1145 | if (clip) { |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1146 | gnt_widget_destroy(clip); |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1147 | clip = NULL; |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1148 | return TRUE; |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1149 | } |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1150 | 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
|
1151 | 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
|
1152 | 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
|
1153 | 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
|
1154 | 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
|
1155 | 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
|
1156 | 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
|
1157 | 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
|
1158 | 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
|
1159 | gnt_widget_draw(clip); |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1160 | g_free(text); |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1161 | return TRUE; |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1162 | } |
|
4da6c97082c9
Move the toggle-clipboard operation to the default wm.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16356
diff
changeset
|
1163 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1164 | static void remove_tag(gpointer wid, gpointer wim) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1165 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1166 | GntWM *wm = GNT_WM(wim); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1167 | GntWidget *w = GNT_WIDGET(wid); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1168 | wm->tagged = g_list_remove(wm->tagged, w); |
|
21240
b78eaddaae02
Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21204
diff
changeset
|
1169 | mvwhline(w->window, 0, 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), 3); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1170 | gnt_widget_draw(w); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1171 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1172 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1173 | static gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1174 | tag_widget(GntBindable *b, GList *params) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1175 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1176 | GntWM *wm = GNT_WM(b); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1177 | GntWidget *widget; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1178 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1179 | if (!wm->cws->ordered) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1180 | return FALSE; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1181 | widget = wm->cws->ordered->data; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1182 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1183 | if (g_list_find(wm->tagged, widget)) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1184 | remove_tag(widget, wm); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1185 | return TRUE; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1186 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1187 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1188 | wm->tagged = g_list_prepend(wm->tagged, widget); |
|
21240
b78eaddaae02
Add gnt_color_pair, which will replace color codes with 'appropriate' text
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21204
diff
changeset
|
1189 | wbkgdset(widget->window, ' ' | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1190 | mvwprintw(widget->window, 0, 1, "[T]"); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1191 | gnt_widget_draw(widget); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1192 | return TRUE; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1193 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1194 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1195 | static void |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1196 | widget_move_ws(gpointer wid, gpointer w) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1197 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1198 | GntWM *wm = GNT_WM(w); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1199 | gnt_wm_widget_move_workspace(wm, wm->cws, GNT_WIDGET(wid)); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1200 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1201 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1202 | static gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1203 | place_tagged(GntBindable *b, GList *params) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1204 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1205 | GntWM *wm = GNT_WM(b); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1206 | g_list_foreach(wm->tagged, widget_move_ws, wm); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1207 | g_list_foreach(wm->tagged, remove_tag, wm); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1208 | g_list_free(wm->tagged); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1209 | wm->tagged = NULL; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1210 | return TRUE; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1211 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1212 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1213 | static gboolean |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1214 | workspace_list(GntBindable *b, GList *params) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1215 | { |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1216 | GntWM *wm = GNT_WM(b); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1217 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1218 | if (wm->_list.window || wm->menu) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1219 | return TRUE; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1220 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1221 | list_of_windows(wm, TRUE); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1222 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1223 | return TRUE; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1224 | } |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1225 | |
|
18137
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1226 | static gboolean |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1227 | workspace_new(GntBindable *bindable, GList *null) |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1228 | { |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1229 | GntWM *wm = GNT_WM(bindable); |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1230 | GntWS *ws = gnt_ws_new(NULL); |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1231 | gnt_wm_add_workspace(wm, ws); |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1232 | gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1233 | return TRUE; |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1234 | } |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1235 | |
|
18286
c67fe80f0325
propagate from branch 'im.pidgin.pidgin' (head 1b2a6ef120661e9253743c44546887c5d980aa21)
Eric Polino <aluink@pidgin.im>
diff
changeset
|
1236 | static gboolean |
|
17590
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1237 | ignore_keys_start(GntBindable *bindable, GList *n) |
|
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1238 | { |
|
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
|
1239 | 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
|
1240 | |
|
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
|
1241 | 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
|
1242 | 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
|
1243 | 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
|
1244 | } |
|
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
|
1245 | 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
|
1246 | } |
|
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
|
1247 | |
|
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
|
1248 | static gboolean |
|
17590
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1249 | ignore_keys_end(GntBindable *bindable, GList *n) |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1250 | { |
|
33797
abc9e0edacc9
Simplify some confusing code
Daniel Atallah <datallah@pidgin.im>
parents:
32040
diff
changeset
|
1251 | if (ignore_keys) { |
|
abc9e0edacc9
Simplify some confusing code
Daniel Atallah <datallah@pidgin.im>
parents:
32040
diff
changeset
|
1252 | ignore_keys = FALSE; |
|
abc9e0edacc9
Simplify some confusing code
Daniel Atallah <datallah@pidgin.im>
parents:
32040
diff
changeset
|
1253 | return TRUE; |
|
abc9e0edacc9
Simplify some confusing code
Daniel Atallah <datallah@pidgin.im>
parents:
32040
diff
changeset
|
1254 | } |
|
abc9e0edacc9
Simplify some confusing code
Daniel Atallah <datallah@pidgin.im>
parents:
32040
diff
changeset
|
1255 | return FALSE; |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1256 | } |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1257 | |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1258 | static gboolean |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1259 | window_next_urgent(GntBindable *bindable, GList *n) |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1260 | { |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1261 | GntWM *wm = GNT_WM(bindable); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1262 | switch_window(wm, 1, TRUE); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1263 | return TRUE; |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1264 | } |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1265 | |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1266 | static gboolean |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1267 | window_prev_urgent(GntBindable *bindable, GList *n) |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1268 | { |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1269 | GntWM *wm = GNT_WM(bindable); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1270 | switch_window(wm, -1, TRUE); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1271 | return TRUE; |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1272 | } |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1273 | |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1274 | #ifdef USE_PYTHON |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1275 | static void |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1276 | python_script_selected(GntFileSel *fs, const char *path, const char *f, gpointer n) |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1277 | { |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1278 | char *dir = g_path_get_dirname(path); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1279 | FILE *file = fopen(path, "r"); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1280 | PyObject *pp = PySys_GetObject("path"), *dirobj = PyString_FromString(dir); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1281 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1282 | PyList_Insert(pp, 0, dirobj); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1283 | Py_DECREF(dirobj); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1284 | PyRun_SimpleFile(file, path); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1285 | fclose(file); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1286 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1287 | if (PyErr_Occurred()) { |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1288 | PyErr_Print(); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1289 | } |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1290 | g_free(dir); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1291 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1292 | gnt_widget_destroy(GNT_WIDGET(fs)); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1293 | } |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1294 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1295 | static gboolean |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1296 | run_python(GntBindable *bindable, GList *n) |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1297 | { |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1298 | GntWidget *window = gnt_file_sel_new(); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1299 | GntFileSel *sel = GNT_FILE_SEL(window); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1300 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1301 | g_object_set(G_OBJECT(window), "vertical", TRUE, NULL); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1302 | gnt_box_add_widget(GNT_BOX(window), gnt_label_new("Please select the python script you want to run.")); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1303 | gnt_box_set_title(GNT_BOX(window), "Select Python Script..."); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1304 | |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1305 | g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(python_script_selected), NULL); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1306 | g_signal_connect_swapped(G_OBJECT(sel->cancel), "activate", G_CALLBACK(gnt_widget_destroy), sel); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1307 | gnt_widget_show(window); |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1308 | return TRUE; |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1309 | } |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1310 | #endif /* USE_PYTHON */ |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1311 | |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1312 | static gboolean |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1313 | help_for_bindable(GntWM *wm, GntBindable *bindable) |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1314 | { |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1315 | gboolean ret = TRUE; |
|
17590
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1316 | GntBindableClass *klass = GNT_BINDABLE_GET_CLASS(bindable); |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1317 | |
|
17590
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1318 | if (klass->help_window) { |
|
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1319 | gnt_wm_raise_window(wm, GNT_WIDGET(klass->help_window)); |
|
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1320 | } else { |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1321 | ret = gnt_bindable_build_help_window(bindable); |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1322 | } |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1323 | return ret; |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1324 | } |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1325 | |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1326 | static gboolean |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1327 | help_for_wm(GntBindable *bindable, GList *null) |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1328 | { |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1329 | return help_for_bindable(GNT_WM(bindable),bindable); |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1330 | } |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1331 | |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1332 | static gboolean |
|
17591
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1333 | help_for_window(GntBindable *bindable, GList *null) |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1334 | { |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1335 | GntWM *wm = GNT_WM(bindable); |
|
18690
85033822cf93
merge of '63410823a172d188421e84f73dfbaed4a20be58a'
Eric Polino <aluink@pidgin.im>
parents:
18688
diff
changeset
|
1336 | GntWidget *widget; |
|
19314
472ad9489d68
Fix some white-space and other similar issues. Preparing for a merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19307
diff
changeset
|
1337 | |
|
18690
85033822cf93
merge of '63410823a172d188421e84f73dfbaed4a20be58a'
Eric Polino <aluink@pidgin.im>
parents:
18688
diff
changeset
|
1338 | if(!wm->cws->ordered) |
|
85033822cf93
merge of '63410823a172d188421e84f73dfbaed4a20be58a'
Eric Polino <aluink@pidgin.im>
parents:
18688
diff
changeset
|
1339 | return FALSE; |
|
19314
472ad9489d68
Fix some white-space and other similar issues. Preparing for a merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19307
diff
changeset
|
1340 | |
|
18690
85033822cf93
merge of '63410823a172d188421e84f73dfbaed4a20be58a'
Eric Polino <aluink@pidgin.im>
parents:
18688
diff
changeset
|
1341 | widget = wm->cws->ordered->data; |
|
17591
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1342 | |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1343 | return help_for_bindable(wm,GNT_BINDABLE(widget)); |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1344 | } |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1345 | |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1346 | static gboolean |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1347 | help_for_widget(GntBindable *bindable, GList *null) |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1348 | { |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1349 | GntWM *wm = GNT_WM(bindable); |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1350 | GntWidget *widget; |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1351 | |
|
18154
9f5fc643a2ad
Fixed a few problems that were created by the merge from the propagate.
Eric Polino <aluink@pidgin.im>
parents:
18153
diff
changeset
|
1352 | if (!wm->cws->ordered) |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1353 | return TRUE; |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1354 | |
|
18154
9f5fc643a2ad
Fixed a few problems that were created by the merge from the propagate.
Eric Polino <aluink@pidgin.im>
parents:
18153
diff
changeset
|
1355 | widget = wm->cws->ordered->data; |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1356 | if (!GNT_IS_BOX(widget)) |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1357 | return TRUE; |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1358 | |
|
17590
b6e8c396671a
Mostly whitespace changes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17589
diff
changeset
|
1359 | return help_for_bindable(wm, GNT_BINDABLE(GNT_BOX(widget)->active)); |
|
17589
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1360 | } |
|
193d380e5261
Moved rebinding functionality into GntBindable.
Eric Polino <aluink@pidgin.im>
parents:
17588
diff
changeset
|
1361 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1362 | static void |
|
19180
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1363 | accumulate_windows(gpointer window, gpointer node, gpointer p) |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1364 | { |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1365 | GList *list = *(GList**)p; |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1366 | list = g_list_prepend(list, window); |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1367 | *(GList**)p = list; |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1368 | } |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1369 | |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1370 | static void |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1371 | gnt_wm_destroy(GObject *obj) |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1372 | { |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1373 | GntWM *wm = GNT_WM(obj); |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1374 | GList *list = NULL; |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1375 | g_hash_table_foreach(wm->nodes, accumulate_windows, &list); |
|
19197
172671e74863
Add two more missing characters for the HTML dump.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19180
diff
changeset
|
1376 | g_list_foreach(list, (GFunc)gnt_widget_destroy, NULL); |
|
19180
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1377 | g_list_free(list); |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1378 | g_hash_table_destroy(wm->nodes); |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1379 | wm->nodes = NULL; |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1380 | |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1381 | while (wm->workspaces) { |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1382 | g_object_unref(wm->workspaces->data); |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1383 | wm->workspaces = g_list_delete_link(wm->workspaces, wm->workspaces); |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1384 | } |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1385 | #ifdef USE_PYTHON |
|
22642
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1386 | if (started_python) { |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1387 | Py_Finalize(); |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1388 | started_python = FALSE; |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1389 | } |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1390 | #endif |
|
19180
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1391 | } |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1392 | |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1393 | static void |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1394 | gnt_wm_class_init(GntWMClass *klass) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1395 | { |
|
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
|
1396 | int i; |
|
19180
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1397 | GObjectClass *gclass = G_OBJECT_CLASS(klass); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1398 | char key[32]; |
|
19180
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1399 | |
|
a814189b2782
This fixes a few weird crashes in pygnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18809
diff
changeset
|
1400 | gclass->dispose = gnt_wm_destroy; |
|
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
|
1401 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1402 | klass->new_window = gnt_wm_new_window_real; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1403 | klass->decorate_window = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1404 | klass->close_window = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1405 | klass->window_resize_confirm = return_true; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1406 | klass->window_resized = gnt_wm_win_resized; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1407 | klass->window_move_confirm = return_true; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1408 | klass->window_moved = gnt_wm_win_moved; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1409 | klass->window_update = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1410 | klass->key_pressed = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1411 | klass->mouse_clicked = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1412 | klass->give_focus = gnt_wm_give_focus; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1413 | |
|
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1414 | signals[SIG_NEW_WIN] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1415 | g_signal_new("new_win", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1416 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1417 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1418 | G_STRUCT_OFFSET(GntWMClass, new_window), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1419 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1420 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1421 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1422 | signals[SIG_DECORATE_WIN] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1423 | g_signal_new("decorate_win", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1424 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1425 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1426 | G_STRUCT_OFFSET(GntWMClass, decorate_window), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1427 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1428 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1429 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1430 | signals[SIG_CLOSE_WIN] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1431 | g_signal_new("close_win", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1432 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1433 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1434 | G_STRUCT_OFFSET(GntWMClass, close_window), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1435 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1436 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1437 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1438 | signals[SIG_CONFIRM_RESIZE] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1439 | g_signal_new("confirm_resize", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1440 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1441 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1442 | G_STRUCT_OFFSET(GntWMClass, window_resize_confirm), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1443 | gnt_boolean_handled_accumulator, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1444 | gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1445 | 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
|
1446 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1447 | signals[SIG_CONFIRM_MOVE] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1448 | g_signal_new("confirm_move", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1449 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1450 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1451 | G_STRUCT_OFFSET(GntWMClass, window_move_confirm), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1452 | gnt_boolean_handled_accumulator, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1453 | gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1454 | 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
|
1455 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1456 | signals[SIG_RESIZED] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1457 | g_signal_new("window_resized", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1458 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1459 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1460 | G_STRUCT_OFFSET(GntWMClass, window_resized), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1461 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1462 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1463 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1464 | signals[SIG_MOVED] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1465 | g_signal_new("window_moved", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1466 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1467 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1468 | G_STRUCT_OFFSET(GntWMClass, window_moved), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1469 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1470 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1471 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1472 | signals[SIG_UPDATE_WIN] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1473 | g_signal_new("window_update", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1474 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1475 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1476 | G_STRUCT_OFFSET(GntWMClass, window_update), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1477 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1478 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1479 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1480 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1481 | signals[SIG_GIVE_FOCUS] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1482 | g_signal_new("give_focus", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1483 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1484 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1485 | G_STRUCT_OFFSET(GntWMClass, give_focus), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1486 | NULL, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1487 | g_cclosure_marshal_VOID__POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1488 | G_TYPE_NONE, 1, G_TYPE_POINTER); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1489 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1490 | signals[SIG_MOUSE_CLICK] = |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1491 | g_signal_new("mouse_clicked", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1492 | G_TYPE_FROM_CLASS(klass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1493 | G_SIGNAL_RUN_LAST, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1494 | G_STRUCT_OFFSET(GntWMClass, mouse_clicked), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1495 | gnt_boolean_handled_accumulator, NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1496 | gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1497 | 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
|
1498 | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
29237
diff
changeset
|
1499 | signals[SIG_TERMINAL_REFRESH] = |
|
18420
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1500 | g_signal_new("terminal-refresh", |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1501 | G_TYPE_FROM_CLASS(klass), |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1502 | G_SIGNAL_RUN_LAST, |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1503 | G_STRUCT_OFFSET(GntWMClass, terminal_refresh), |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1504 | NULL, NULL, |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1505 | g_cclosure_marshal_VOID__VOID, |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1506 | G_TYPE_NONE, 0); |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18308
diff
changeset
|
1507 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1508 | 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
|
1509 | "\033" "n", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1510 | 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
|
1511 | "\033" "p", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1512 | 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
|
1513 | "\033" "c", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1514 | 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
|
1515 | "\033" "w", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1516 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "dump-screen", dump_screen, |
|
21793
ce2c1014f6af
Fix cursor-next-word behaviour, noticed by jtb.
Richard Nelson <wabz@pidgin.im>
parents:
21720
diff
changeset
|
1517 | "\033" "D", NULL); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1518 | 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
|
1519 | "\033" ",", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1520 | 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
|
1521 | "\033" ".", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1522 | 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
|
1523 | "\033" "a", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1524 | 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
|
1525 | "\033" "m", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1526 | 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
|
1527 | "\033" "r", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1528 | 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
|
1529 | "\033" "q", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1530 | 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
|
1531 | "\033" "l", NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1532 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "switch-window-n", switch_window_n, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1533 | 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
|
1534 | 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
|
1535 | "\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
|
1536 | 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
|
1537 | "\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
|
1538 | 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
|
1539 | "\033" "/", NULL); |
|
18137
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1540 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-new", workspace_new, |
|
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1541 | GNT_KEY_F9, NULL); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1542 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-next", workspace_next, |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1543 | "\033" ">", NULL); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1544 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-prev", workspace_prev, |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1545 | "\033" "<", NULL); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1546 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-tag", tag_widget, |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1547 | "\033" "t", NULL); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1548 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "place-tagged", place_tagged, |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1549 | "\033" "T", NULL); |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1550 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-list", workspace_list, |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1551 | "\033" "s", NULL); |
|
19314
472ad9489d68
Fix some white-space and other similar issues. Preparing for a merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19307
diff
changeset
|
1552 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", toggle_clipboard, |
|
472ad9489d68
Fix some white-space and other similar issues. Preparing for a merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19307
diff
changeset
|
1553 | "\033" "C", NULL); |
|
17582
3d9f7bafa2a0
Alt-\ allows to rebind keys to the wm
Eric Polino <aluink@pidgin.im>
parents:
17581
diff
changeset
|
1554 | 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
|
1555 | "\033" "\\", NULL); |
|
17591
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1556 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-window", help_for_window, |
|
9496232d1cf0
Added the ability to change the key bindings on the active window.
Eric Polino <aluink@pidgin.im>
parents:
17590
diff
changeset
|
1557 | "\033" "|", NULL); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1558 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-start", ignore_keys_start, |
|
22952
32963b46955c
Remove the undocumented default binding (ctrl+g) to start ignoring
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22642
diff
changeset
|
1559 | NULL, NULL); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1560 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-end", ignore_keys_end, |
|
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
|
1561 | "\033" GNT_KEY_CTRL_G, NULL); |
|
22109
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1562 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next-urgent", window_next_urgent, |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1563 | "\033" "\t", NULL); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1564 | snprintf(key, sizeof(key), "\033%s", GNT_KEY_BACK_TAB); |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1565 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev-urgent", window_prev_urgent, |
|
1a242fadcb38
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21915
diff
changeset
|
1566 | key[1] ? key : NULL, NULL); |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1567 | #ifdef USE_PYTHON |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1568 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "run-python", run_python, |
|
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1569 | GNT_KEY_F3, NULL); |
|
22642
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1570 | if (!Py_IsInitialized()) { |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1571 | Py_SetProgramName("gnt"); |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1572 | Py_Initialize(); |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1573 | started_python = TRUE; |
|
173a4cdf0241
Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22524
diff
changeset
|
1574 | } |
|
21915
c08dfd143ca9
Allow loading python scripts at runtime.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21835
diff
changeset
|
1575 | #endif |
|
14962
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 | 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
|
1578 | |
|
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
|
1579 | /* 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
|
1580 | 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
|
1581 | 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
|
1582 | 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
|
1583 | 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
|
1584 | } |
|
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
|
1585 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1586 | GNTDEBUG; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1587 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1588 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1589 | /****************************************************************************** |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1590 | * GntWM API |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1591 | *****************************************************************************/ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1592 | GType |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1593 | gnt_wm_get_gtype(void) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1594 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1595 | static GType type = 0; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1596 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1597 | if(type == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1598 | static const GTypeInfo info = { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1599 | sizeof(GntWMClass), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1600 | NULL, /* base_init */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1601 | NULL, /* base_finalize */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1602 | (GClassInitFunc)gnt_wm_class_init, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1603 | NULL, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1604 | NULL, /* class_data */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1605 | sizeof(GntWM), |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1606 | 0, /* n_preallocs */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1607 | 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
|
1608 | NULL /* value_table */ |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1609 | }; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1610 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1611 | type = g_type_register_static(GNT_TYPE_BINDABLE, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1612 | "GntWM", |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1613 | &info, 0); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1614 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1615 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1616 | return type; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1617 | } |
|
18137
a8c54ed05eee
F9 to create a new workspace.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18133
diff
changeset
|
1618 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1619 | void |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1620 | gnt_wm_add_workspace(GntWM *wm, GntWS *ws) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1621 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1622 | wm->workspaces = g_list_append(wm->workspaces, ws); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1623 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1624 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1625 | gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1626 | gnt_wm_switch_workspace(GntWM *wm, gint n) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1627 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1628 | GntWS *s = g_list_nth_data(wm->workspaces, n); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1629 | if (!s) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1630 | return FALSE; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1631 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1632 | if (wm->_list.window) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1633 | gnt_widget_destroy(wm->_list.window); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1634 | } |
|
21708
f59ef4108e67
Switch to 'normal' state when: switching windows or workspaces, closing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21572
diff
changeset
|
1635 | ensure_normal_mode(wm); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1636 | gnt_ws_hide(wm->cws, wm->nodes); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1637 | wm->cws = s; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1638 | gnt_ws_show(wm->cws, wm->nodes); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1639 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1640 | gnt_ws_draw_taskbar(wm->cws, TRUE); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1641 | update_screen(wm); |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1642 | if (wm->cws->ordered) { |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1643 | gnt_wm_raise_window(wm, wm->cws->ordered->data); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1644 | } |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1645 | |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1646 | if (act && g_list_find(act, wm->cws)) { |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1647 | act = g_list_remove(act, wm->cws); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1648 | update_act_msg(); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
1649 | } |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1650 | return TRUE; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1651 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1652 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1653 | gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1654 | gnt_wm_switch_workspace_prev(GntWM *wm) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1655 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1656 | int n = g_list_index(wm->workspaces, wm->cws); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1657 | return gnt_wm_switch_workspace(wm, --n); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1658 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1659 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1660 | gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1661 | gnt_wm_switch_workspace_next(GntWM *wm) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1662 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1663 | int n = g_list_index(wm->workspaces, wm->cws); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1664 | return gnt_wm_switch_workspace(wm, ++n); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1665 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1666 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1667 | static gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1668 | workspace_next(GntBindable *wm, GList *n) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1669 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1670 | return gnt_wm_switch_workspace_next(GNT_WM(wm)); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1671 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1672 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1673 | static gboolean |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1674 | workspace_prev(GntBindable *wm, GList *n) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1675 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1676 | return gnt_wm_switch_workspace_prev(GNT_WM(wm)); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1677 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1678 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1679 | void |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1680 | gnt_wm_widget_move_workspace(GntWM *wm, GntWS *neww, GntWidget *widget) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1681 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1682 | GntWS *oldw = gnt_wm_widget_find_workspace(wm, widget); |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1683 | GntNode *node; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1684 | if (!oldw || oldw == neww) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1685 | return; |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1686 | node = g_hash_table_lookup(wm->nodes, widget); |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1687 | if (node && node->ws == neww) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1688 | return; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1689 | |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1690 | if (node) |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1691 | node->ws = neww; |
|
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1692 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1693 | gnt_ws_remove_widget(oldw, widget); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1694 | gnt_ws_add_widget(neww, widget); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1695 | if (neww == wm->cws) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1696 | gnt_ws_widget_show(widget, wm->nodes); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1697 | } else { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1698 | gnt_ws_widget_hide(widget, wm->nodes); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1699 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1700 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1701 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1702 | static gint widget_in_workspace(gconstpointer workspace, gconstpointer wid) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1703 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1704 | GntWS *s = (GntWS *)workspace; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1705 | if (s->list && g_list_find(s->list, wid)) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1706 | return 0; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1707 | return 1; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1708 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1709 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1710 | GntWS *gnt_wm_widget_find_workspace(GntWM *wm, GntWidget *widget) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1711 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1712 | GList *l = g_list_find_custom(wm->workspaces, widget, widget_in_workspace); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1713 | if (l) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1714 | return l->data; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1715 | return NULL; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1716 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1717 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1718 | static void free_workspaces(gpointer data, gpointer n) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1719 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1720 | GntWS *s = data; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1721 | g_free(s->name); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1722 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1723 | |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1724 | void gnt_wm_set_workspaces(GntWM *wm, GList *workspaces) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1725 | { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1726 | g_list_foreach(wm->workspaces, free_workspaces, NULL); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1727 | wm->workspaces = workspaces; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1728 | gnt_wm_switch_workspace(wm, 0); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1729 | } |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1730 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1731 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1732 | update_window_in_list(GntWM *wm, GntWidget *wid) |
|
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 | GntTextFormatFlags flag = 0; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1735 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1736 | if (wm->windows == NULL) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1737 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1738 | |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1739 | if (wm->cws->ordered && wid == wm->cws->ordered->data) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1740 | flag |= GNT_TEXT_FLAG_DIM; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1741 | else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT)) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1742 | flag |= GNT_TEXT_FLAG_BOLD; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1743 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1744 | 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
|
1745 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1746 | |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1747 | static gboolean |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1748 | match_title(gpointer title, gpointer n, gpointer wid_title) |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1749 | { |
|
18308
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1750 | /* XXX: do any regex magic here. */ |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1751 | if (g_strrstr((gchar *)wid_title, (gchar *)title)) |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1752 | return TRUE; |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1753 | return FALSE; |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1754 | } |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1755 | |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1756 | static GntWS * |
|
18308
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1757 | new_widget_find_workspace(GntWM *wm, GntWidget *widget) |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1758 | { |
|
18308
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1759 | GntWS *ret = NULL; |
|
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1760 | const gchar *name, *title; |
|
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1761 | title = GNT_BOX(widget)->title; |
|
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1762 | if (title) |
|
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1763 | ret = g_hash_table_find(wm->title_places, match_title, (gpointer)title); |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1764 | if (ret) |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1765 | return ret; |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1766 | name = gnt_widget_get_name(widget); |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1767 | if (name) |
|
18308
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1768 | ret = g_hash_table_find(wm->name_places, match_title, (gpointer)name); |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1769 | return ret ? ret : wm->cws; |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1770 | } |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1771 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1772 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1773 | gnt_wm_new_window_real(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1774 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1775 | GntNode *node; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1776 | gboolean transient = FALSE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1777 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1778 | if (widget->window == NULL) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1779 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1780 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1781 | node = g_new0(GntNode, 1); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1782 | 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
|
1783 | node->scroll = 0; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1784 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1785 | g_hash_table_replace(wm->nodes, widget, node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1786 | |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
1787 | refresh_node(widget, node, GINT_TO_POINTER(TRUE)); |
|
14962
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 | transient = !!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1790 | |
|
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
|
1791 | #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
|
1792 | { |
|
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
|
1793 | 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
|
1794 | 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
|
1795 | |
|
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
|
1796 | 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
|
1797 | 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
|
1798 | 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
|
1799 | y = widget->priv.y; |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1800 | w = widget->priv.width + shadow; |
|
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1801 | h = widget->priv.height + shadow; |
|
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
|
1802 | |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1803 | maxx = getmaxx(stdscr); |
|
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1804 | maxy = getmaxy(stdscr) - 1; /* room for the taskbar */ |
|
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
|
1805 | |
|
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
|
1806 | 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
|
1807 | 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
|
1808 | 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
|
1809 | 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
|
1810 | 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
|
1811 | 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
|
1812 | |
|
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
|
1813 | 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
|
1814 | h = MIN(h, maxy); |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
1815 | node->window = newwin(h, w, y, x); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1816 | gnt_wm_copy_win(widget, 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
|
1817 | } |
|
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
|
1818 | #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
|
1819 | |
|
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
|
1820 | node->panel = new_panel(node->window); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1821 | set_panel_userptr(node->panel, node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1822 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1823 | if (!transient) { |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1824 | GntWS *ws = wm->cws; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1825 | if (node->me != wm->_list.window) { |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1826 | if (GNT_IS_BOX(widget)) { |
|
18308
3424730fd9e5
Plucked revision from finchfeat to allow partial matching for window-titles
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18279
diff
changeset
|
1827 | ws = new_widget_find_workspace(wm, widget); |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1828 | } |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1829 | node->ws = ws; |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1830 | ws->list = g_list_append(ws->list, widget); |
|
18596
02e5ec52243c
Some more focus fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18567
diff
changeset
|
1831 | ws->ordered = g_list_append(ws->ordered, widget); |
|
14962
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 | |
|
18567
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
1834 | if (wm->event_stack || node->me == wm->_list.window || |
|
18596
02e5ec52243c
Some more focus fixes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18567
diff
changeset
|
1835 | node->me == ws->ordered->data) { |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1836 | gnt_wm_raise_window(wm, node->me); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1837 | } else { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1838 | bottom_panel(node->panel); /* New windows should not grab focus */ |
|
18170
477cfc0d7254
Notify a window on startup if it didn't get the focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18139
diff
changeset
|
1839 | gnt_widget_set_focus(node->me, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1840 | gnt_widget_set_urgent(node->me); |
|
16525
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1841 | if (wm->cws != ws) |
|
6e207d99ffd9
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
16524
diff
changeset
|
1842 | gnt_ws_widget_hide(widget, wm->nodes); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1843 | } |
|
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 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1846 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1847 | void gnt_wm_new_window(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1848 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1849 | while (widget->parent) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1850 | widget = widget->parent; |
|
20293
81d324f460bd
applied changes from 1f57ebe4e6d16159c74db823ecff2ec0f4c46936
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20220
diff
changeset
|
1851 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1852 | if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_INVISIBLE) || |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1853 | g_hash_table_lookup(wm->nodes, widget)) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1854 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1855 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1856 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1857 | |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1858 | if (GNT_IS_BOX(widget)) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1859 | const char *title = GNT_BOX(widget)->title; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1860 | GntPosition *p = NULL; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1861 | if (title && (p = g_hash_table_lookup(wm->positions, title)) != NULL) { |
|
21540
2a3ffe144ae1
Add maximize flags for windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21471
diff
changeset
|
1862 | sanitize_position(widget, &p->x, &p->y, TRUE); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1863 | gnt_widget_set_position(widget, p->x, p->y); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1864 | mvwin(widget->window, p->y, p->x); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1865 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1866 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
1867 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1868 | g_signal_emit(wm, signals[SIG_NEW_WIN], 0, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1869 | g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, 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 | 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
|
1872 | 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
|
1873 | && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1874 | gnt_tree_add_row_last(GNT_TREE(wm->windows->tree), widget, |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1875 | gnt_tree_create_row(GNT_TREE(wm->windows->tree), GNT_BOX(widget)->title), |
|
16523
d774ca89d340
Alt+s to see the list of workspaces and windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16519
diff
changeset
|
1876 | g_object_get_data(G_OBJECT(wm->windows->tree), "workspace") ? wm->cws : NULL); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1877 | update_window_in_list(wm, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1878 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1879 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1880 | |
|
26650
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
1881 | gnt_ws_draw_taskbar(wm->cws, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1882 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1883 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1884 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1885 | void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1886 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1887 | g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1888 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1889 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1890 | void gnt_wm_window_close(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1891 | { |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1892 | GntWS *s; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1893 | int pos; |
|
26654
8812a857eddd
Update hardware cursor correctly after a transient window is closed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26651
diff
changeset
|
1894 | gboolean transient = !!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1895 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1896 | s = gnt_wm_widget_find_workspace(wm, widget); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1897 | |
|
20220
6d7683248222
applied changes from 2495a1b6a3619d8188151eaf2822ce2ecd435dbf
Luke Schierer <lschiere@pidgin.im>
parents:
20180
diff
changeset
|
1898 | if (g_hash_table_lookup(wm->nodes, widget) == NULL) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1899 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1900 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1901 | g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1902 | g_hash_table_remove(wm->nodes, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1903 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1904 | if (wm->windows) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1905 | gnt_tree_remove(GNT_TREE(wm->windows->tree), widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1906 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1907 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1908 | if (s) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1909 | pos = g_list_index(s->list, widget); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1910 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1911 | if (pos != -1) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1912 | s->list = g_list_remove(s->list, widget); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1913 | s->ordered = g_list_remove(s->ordered, widget); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1914 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1915 | if (s->ordered && wm->cws == s) |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1916 | gnt_wm_raise_window(wm, s->ordered->data); |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1917 | } |
|
26654
8812a857eddd
Update hardware cursor correctly after a transient window is closed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26651
diff
changeset
|
1918 | } else if (transient && wm->cws && wm->cws->ordered) { |
|
8812a857eddd
Update hardware cursor correctly after a transient window is closed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26651
diff
changeset
|
1919 | gnt_wm_update_window(wm, wm->cws->ordered->data); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1920 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1921 | |
|
26650
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
1922 | gnt_ws_draw_taskbar(wm->cws, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1923 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1924 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1925 | |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1926 | time_t gnt_wm_get_idle_time() |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1927 | { |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1928 | return time(NULL) - last_active_time; |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1929 | } |
|
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1930 | |
|
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
|
1931 | gboolean gnt_wm_process_input(GntWM *wm, const char *keys) |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1932 | { |
|
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
|
1933 | 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
|
1934 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1935 | keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1936 | |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1937 | idle_update = TRUE; |
|
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
|
1938 | 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
|
1939 | 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
|
1940 | 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
|
1941 | 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
|
1942 | } |
|
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
|
1943 | } |
|
18153
cfde4575d02b
propagate from branch 'im.pidgin.pidgin.2.1.0' (head a0178de25d1892b2f929c84c59e8ba429de439d7)
Eric Polino <aluink@pidgin.im>
diff
changeset
|
1944 | return wm->cws->ordered ? gnt_widget_key_pressed(GNT_WIDGET(wm->cws->ordered->data), keys) : FALSE; |
|
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
|
1945 | } |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
1946 | |
|
16188
2c7ee371f005
alt-/ to get a list of keybindings for the focused widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16056
diff
changeset
|
1947 | 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
|
1948 | 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
|
1949 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1950 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1951 | /* Do some manual checking */ |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1952 | if (wm->cws->ordered && wm->mode != GNT_KP_MODE_NORMAL) { |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1953 | 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
|
1954 | int x, y, w, h; |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
1955 | GntWidget *widget = GNT_WIDGET(wm->cws->ordered->data); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1956 | int ox, oy, ow, oh; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1957 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1958 | gnt_widget_get_position(widget, &x, &y); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1959 | gnt_widget_get_size(widget, &w, &h); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1960 | ox = x; oy = y; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1961 | ow = w; oh = h; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1962 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1963 | if (wm->mode == GNT_KP_MODE_MOVE) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1964 | if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1965 | if (x > xmin) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1966 | x--; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1967 | } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1968 | if (x + w < xmax) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1969 | x++; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1970 | } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1971 | if (y > ymin) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1972 | y--; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1973 | } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1974 | if (y + h < ymax) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1975 | y++; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1976 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1977 | if (ox != x || oy != y) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1978 | 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
|
1979 | 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
|
1980 | return TRUE; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1981 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1982 | } else if (wm->mode == GNT_KP_MODE_RESIZE) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1983 | if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1984 | w--; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1985 | } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1986 | if (x + w < xmax) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1987 | w++; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1988 | } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1989 | h--; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1990 | } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1991 | if (y + h < ymax) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1992 | h++; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1993 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1994 | if (oh != h || ow != w) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1995 | 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
|
1996 | 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
|
1997 | return TRUE; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1998 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1999 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2000 | 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
|
2001 | window_reverse(widget, FALSE, wm); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2002 | wm->mode = GNT_KP_MODE_NORMAL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2003 | } |
|
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
|
2004 | return TRUE; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2005 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2006 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2007 | /* Escape to close the window-list or action-list window */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2008 | if (strcmp(keys, "\033") == 0) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2009 | if (wm->_list.window) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2010 | 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
|
2011 | return TRUE; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2012 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2013 | } else if (keys[0] == '\033' && isdigit(keys[1]) && keys[2] == '\0') { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2014 | /* Alt+x for quick switch */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2015 | int n = *(keys + 1) - '0'; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2016 | GList *list = NULL; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2017 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2018 | if (n == 0) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2019 | n = 10; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2020 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2021 | list = g_list_append(list, GINT_TO_POINTER(n - 1)); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2022 | switch_window_n(GNT_BINDABLE(wm), list); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2023 | 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
|
2024 | return TRUE; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2025 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2026 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2027 | 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
|
2028 | ret = gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2029 | 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
|
2030 | ret = gnt_widget_key_pressed(wm->_list.window, keys); |
|
20821
51bd63176b50
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20180
diff
changeset
|
2031 | else if (wm->cws->ordered) { |
|
51bd63176b50
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20180
diff
changeset
|
2032 | GntWidget *win = wm->cws->ordered->data; |
|
20822
b1ed85d89a4a
Toplevel boxes don't have menus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20821
diff
changeset
|
2033 | if (GNT_IS_WINDOW(win)) { |
|
b1ed85d89a4a
Toplevel boxes don't have menus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20821
diff
changeset
|
2034 | GntMenu *menu = GNT_WINDOW(win)->menu; |
|
b1ed85d89a4a
Toplevel boxes don't have menus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20821
diff
changeset
|
2035 | if (menu) { |
|
b1ed85d89a4a
Toplevel boxes don't have menus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20821
diff
changeset
|
2036 | const char *id = gnt_window_get_accel_item(GNT_WINDOW(win), keys); |
|
21572
0f01980b0366
Update the ChangeLog.API and change how gnt_menu_get_item works.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21540
diff
changeset
|
2037 | if (id) { |
|
0f01980b0366
Update the ChangeLog.API and change how gnt_menu_get_item works.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21540
diff
changeset
|
2038 | GntMenuItem *item = gnt_menu_get_item(menu, id); |
|
0f01980b0366
Update the ChangeLog.API and change how gnt_menu_get_item works.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21540
diff
changeset
|
2039 | if (item) |
|
0f01980b0366
Update the ChangeLog.API and change how gnt_menu_get_item works.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21540
diff
changeset
|
2040 | ret = gnt_menuitem_activate(item); |
|
0f01980b0366
Update the ChangeLog.API and change how gnt_menu_get_item works.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21540
diff
changeset
|
2041 | } |
|
20822
b1ed85d89a4a
Toplevel boxes don't have menus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20821
diff
changeset
|
2042 | } |
|
20821
51bd63176b50
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20180
diff
changeset
|
2043 | } |
|
51bd63176b50
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20180
diff
changeset
|
2044 | if (!ret) |
|
51bd63176b50
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20180
diff
changeset
|
2045 | ret = gnt_widget_key_pressed(win, keys); |
|
51bd63176b50
Allow binding key-shortcuts to menuitems.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20180
diff
changeset
|
2046 | } |
|
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
|
2047 | return ret; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2048 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2049 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2050 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2051 | gnt_wm_win_resized(GntWM *wm, GntNode *node) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2052 | { |
|
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
|
2053 | /*refresh_node(node->me, node, NULL);*/ |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2054 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2055 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2056 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2057 | gnt_wm_win_moved(GntWM *wm, GntNode *node) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2058 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2059 | refresh_node(node->me, node, NULL); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2060 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2061 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2062 | 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
|
2063 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2064 | gboolean ret = TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2065 | 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
|
2066 | int maxx, maxy; |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
2067 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2068 | while (widget->parent) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2069 | widget = widget->parent; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2070 | node = g_hash_table_lookup(wm->nodes, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2071 | if (!node) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2072 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2073 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2074 | 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
|
2075 | if (!ret) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2076 | return; /* resize is not permitted */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2077 | hide_panel(node->panel); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2078 | gnt_widget_set_size(widget, width, height); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2079 | gnt_widget_draw(widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2080 | |
|
21471
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
2081 | maxx = getmaxx(stdscr); |
|
4dcb5c206238
Fix size calculation when shadow is enabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21453
diff
changeset
|
2082 | maxy = getmaxy(stdscr) - 1; |
|
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
|
2083 | 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
|
2084 | 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
|
2085 | 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
|
2086 | 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
|
2087 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2088 | g_signal_emit(wm, signals[SIG_RESIZED], 0, node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2089 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2090 | show_panel(node->panel); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2091 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2092 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2093 | |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2094 | static void |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2095 | write_gdi(gpointer key, gpointer value, gpointer data) |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2096 | { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2097 | 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
|
2098 | 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
|
2099 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2100 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2101 | static gboolean |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2102 | write_already(gpointer data) |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2103 | { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2104 | GntWM *wm = data; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2105 | FILE *file; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2106 | char *filename; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2107 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2108 | filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2109 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2110 | file = fopen(filename, "wb"); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2111 | if (file == NULL) { |
|
24822
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24816
diff
changeset
|
2112 | gnt_warning("error opening file (%s) to save positions", filename); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2113 | } else { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2114 | fprintf(file, "[positions]\n"); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2115 | g_hash_table_foreach(wm->positions, write_gdi, file); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2116 | fclose(file); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2117 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2118 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2119 | g_free(filename); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2120 | g_source_remove(write_timeout); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2121 | write_timeout = 0; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2122 | return FALSE; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2123 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2124 | |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2125 | static void |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2126 | write_positions_to_file(GntWM *wm) |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2127 | { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2128 | if (write_timeout) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2129 | g_source_remove(write_timeout); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2130 | } |
|
26651
d9f1eeefb89c
Save the world.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26650
diff
changeset
|
2131 | write_timeout = g_timeout_add_seconds(10, write_already, wm); |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2132 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2133 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2134 | 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
|
2135 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2136 | gboolean ret = TRUE; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2137 | GntNode *node; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2138 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2139 | while (widget->parent) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2140 | widget = widget->parent; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2141 | node = g_hash_table_lookup(wm->nodes, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2142 | if (!node) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2143 | return; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2144 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2145 | 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
|
2146 | if (!ret) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2147 | return; /* resize is not permitted */ |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2148 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2149 | gnt_widget_set_position(widget, x, y); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2150 | move_panel(node->panel, y, x); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2151 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2152 | 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
|
2153 | 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
|
2154 | !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
|
15129
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2155 | const char *title = GNT_BOX(widget)->title; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2156 | if (title) { |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2157 | GntPosition *p = g_new0(GntPosition, 1); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2158 | GntWidget *wid = node->me; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2159 | p->x = wid->priv.x; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2160 | p->y = wid->priv.y; |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2161 | g_hash_table_replace(wm->positions, g_strdup(title), p); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2162 | write_positions_to_file(wm); |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2163 | } |
|
4722d1cf7938
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15020
diff
changeset
|
2164 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2165 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2166 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2167 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2168 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2169 | static void |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2170 | gnt_wm_give_focus(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2171 | { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2172 | GntNode *node = g_hash_table_lookup(wm->nodes, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2173 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2174 | if (!node) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2175 | return; |
|
18690
85033822cf93
merge of '63410823a172d188421e84f73dfbaed4a20be58a'
Eric Polino <aluink@pidgin.im>
parents:
18688
diff
changeset
|
2176 | |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2177 | if (widget != wm->_list.window && !GNT_IS_MENU(widget) && |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2178 | wm->cws->ordered->data != widget) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2179 | GntWidget *w = wm->cws->ordered->data; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2180 | wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2181 | gnt_widget_set_focus(w, FALSE); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2182 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2183 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2184 | gnt_widget_set_focus(widget, TRUE); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2185 | GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_URGENT); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2186 | gnt_widget_draw(widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2187 | top_panel(node->panel); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2188 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2189 | if (wm->_list.window) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2190 | GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2191 | top_panel(nd->panel); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2192 | } |
|
26650
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
2193 | gnt_ws_draw_taskbar(wm->cws, FALSE); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2194 | update_screen(wm); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2195 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2196 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2197 | void gnt_wm_update_window(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2198 | { |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2199 | GntNode *node = NULL; |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2200 | GntWS *ws; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2201 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2202 | while (widget->parent) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2203 | widget = widget->parent; |
|
18638
cf86c3ae160f
Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18600
diff
changeset
|
2204 | if (!GNT_IS_MENU(widget)) { |
|
cf86c3ae160f
Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18600
diff
changeset
|
2205 | if (!GNT_IS_BOX(widget)) |
|
cf86c3ae160f
Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18600
diff
changeset
|
2206 | return; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2207 | gnt_box_sync_children(GNT_BOX(widget)); |
|
18638
cf86c3ae160f
Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18600
diff
changeset
|
2208 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2209 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2210 | ws = gnt_wm_widget_find_workspace(wm, widget); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2211 | node = g_hash_table_lookup(wm->nodes, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2212 | if (node == NULL) { |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2213 | gnt_wm_new_window(wm, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2214 | } else |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2215 | g_signal_emit(wm, signals[SIG_UPDATE_WIN], 0, node); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2216 | |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2217 | if (ws == wm->cws || GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
|
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2218 | gnt_wm_copy_win(widget, node); |
|
26650
cfa29f8cf9b7
Update hardware cursor correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25601
diff
changeset
|
2219 | gnt_ws_draw_taskbar(wm->cws, FALSE); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2220 | update_screen(wm); |
|
18638
cf86c3ae160f
Some extra checks to avoid weird crashes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18600
diff
changeset
|
2221 | } else if (ws && ws != wm->cws && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_URGENT)) { |
|
16524
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
2222 | if (!act || (act && !g_list_find(act, ws))) |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
2223 | act = g_list_prepend(act, ws); |
|
1f114ebacb0d
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16523
diff
changeset
|
2224 | update_act_msg(); |
|
16519
9458657f5b99
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
16356
diff
changeset
|
2225 | } |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2226 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2227 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2228 | 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
|
2229 | { |
|
15838
45289a1439b2
Get rid of some minor C99isms
Mark Doliner <markdoliner@pidgin.im>
parents:
15804
diff
changeset
|
2230 | gboolean ret = TRUE; |
|
15802
1e124a68997e
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15714
diff
changeset
|
2231 | idle_update = TRUE; |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2232 | 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
|
2233 | return ret; |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2234 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2235 | |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2236 | void gnt_wm_raise_window(GntWM *wm, GntWidget *widget) |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2237 | { |
| 18133 | 2238 | GntWS *ws = gnt_wm_widget_find_workspace(wm, widget); |
| 2239 | if (wm->cws != ws) | |
| 2240 | gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); | |
|
18567
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2241 | if (widget != wm->cws->ordered->data) { |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2242 | GntWidget *wid = wm->cws->ordered->data; |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2243 | wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget); |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2244 | gnt_widget_set_focus(wid, FALSE); |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2245 | gnt_widget_draw(wid); |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2246 | } |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2247 | gnt_widget_set_focus(widget, TRUE); |
|
8dd8eae7a1aa
Fix some focus issues.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
2248 | gnt_widget_draw(widget); |
|
14962
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2249 | g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget); |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2250 | } |
|
abfaa2e03ac7
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2251 | |
|
16356
13cc89b3ab7c
Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16189
diff
changeset
|
2252 | 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
|
2253 | { |
|
13cc89b3ab7c
Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16189
diff
changeset
|
2254 | 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
|
2255 | } |
|
13cc89b3ab7c
Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16189
diff
changeset
|
2256 | |
|
19317
61e0384e95d1
merge of 'a6866f1419c4de85b909b43494d0f6a71018f9bc'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
2257 |