Fri, 08 Jan 2010 01:30:43 +0000
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Fix building finch & libgnt using older gcc or non-gcc compilers that do
not understand G_GNUC_NULL_TERMINATED
|
24449
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
1 | /* |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
2 | * GNT - The GLib Ncurses Toolkit |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
3 | * |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
4 | * GNT is the legal property of its developers, whose names are too numerous |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
6 | * source distribution. |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
7 | * |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
8 | * This library is free software; you can redistribute it and/or modify |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
11 | * (at your option) any later version. |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
12 | * |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
16 | * GNU General Public License for more details. |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
17 | * |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
21 | */ |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
22 | |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
23 | /** |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
24 | * 1. Buddylist is aligned on the left. |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
25 | * 2. The rest of the screen is split into MxN grid for conversation windows. |
|
23153
97303ac5a7bc
Correct the comments, and some position-calculation when the buddylist is not showing.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18602
diff
changeset
|
26 | * - M = split-h in ~/.gntrc:[irssi] |
|
97303ac5a7bc
Correct the comments, and some position-calculation when the buddylist is not showing.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18602
diff
changeset
|
27 | * - N = split-v in ~/.gntrc:[irssi] |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
28 | * - Press alt-shift-k/j/l/h to move the selected window to the frame |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
29 | * above/below/left/right of the current frame. |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
30 | * 3. All the other windows are always centered. |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
31 | */ |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
32 | #include <stdlib.h> |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
33 | #include <string.h> |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | #include <sys/types.h> |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | |
|
29049
ea3c1e7d47f4
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents:
25352
diff
changeset
|
36 | #include "gntinternal.h" |
|
ea3c1e7d47f4
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents:
25352
diff
changeset
|
37 | |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
38 | #include "gnt.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
39 | #include "gntbox.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
40 | #include "gntmenu.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
41 | #include "gntstyle.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
42 | #include "gntwm.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
43 | #include "gntwindow.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
44 | #include "gntlabel.h" |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
45 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
46 | #define TYPE_IRSSI (irssi_get_gtype()) |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
48 | typedef struct _Irssi |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
49 | { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
50 | GntWM inherit; |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
51 | int vert; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
52 | int horiz; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
53 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
54 | /* This is changed whenever the buddylist is opened/closed or resized. */ |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
55 | int buddylistwidth; |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
56 | } Irssi; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
57 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
58 | typedef struct _IrssiClass |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
59 | { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
60 | GntWMClass inherit; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
61 | } IrssiClass; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
62 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
63 | GType irssi_get_gtype(void); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
64 | void gntwm_init(GntWM **wm); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
65 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
66 | static void (*org_new_window)(GntWM *wm, GntWidget *win); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
67 | |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
68 | static void |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
69 | get_xywh_for_frame(Irssi *irssi, int hor, int vert, int *x, int *y, int *w, int *h) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
70 | { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
71 | int width, height, rx, ry; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
72 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
73 | width = (getmaxx(stdscr) - irssi->buddylistwidth) / irssi->horiz; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
74 | height = (getmaxy(stdscr) - 1) / irssi->vert; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
75 | |
|
25352
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
76 | if (width) { |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
77 | rx = irssi->buddylistwidth; |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
78 | } else { |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
79 | rx = 0; |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
80 | width = getmaxx(stdscr) / irssi->horiz; |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
81 | } |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
82 | if (hor) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
83 | rx += hor * width; |
|
23153
97303ac5a7bc
Correct the comments, and some position-calculation when the buddylist is not showing.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18602
diff
changeset
|
84 | if (rx) |
|
97303ac5a7bc
Correct the comments, and some position-calculation when the buddylist is not showing.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18602
diff
changeset
|
85 | rx++; |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
86 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
87 | ry = 0; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
88 | if (vert) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
89 | ry += vert * height + 1; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
90 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
91 | if (x) *x = rx; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
92 | if (y) *y = ry; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
93 | if (w) { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
94 | *w = (hor == irssi->horiz - 1) ? (getmaxx(stdscr) - rx) : (width - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
95 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
96 | if (h) { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
97 | *h = (vert == irssi->vert - 1) ? (getmaxy(stdscr) - 1 - ry) : (height - !!vert); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
98 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
99 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
100 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
101 | static void |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
102 | draw_line_separators(Irssi *irssi) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
103 | { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
104 | int x, y; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
105 | int width, height; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
106 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
107 | wclear(stdscr); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
108 | /* Draw the separator for the buddylist */ |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
109 | if (irssi->buddylistwidth) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
110 | mvwvline(stdscr, 0, irssi->buddylistwidth, |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
111 | ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), getmaxy(stdscr) - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
112 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
113 | /* Now the separators for the conversation windows */ |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
114 | width = (getmaxx(stdscr) - irssi->buddylistwidth) / irssi->horiz; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
115 | height = (getmaxy(stdscr) - 1) / irssi->vert; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
116 | for (x = 1; x < irssi->horiz; x++) { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
117 | mvwvline(stdscr, 0, irssi->buddylistwidth + x * width, |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
118 | ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), getmaxy(stdscr) - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
119 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
120 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
121 | for (y = 1; y < irssi->vert; y++) { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
122 | mvwhline(stdscr, y * height, irssi->buddylistwidth + 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
123 | getmaxx(stdscr) - irssi->buddylistwidth); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
124 | for (x = 1; x < irssi->horiz; x++) { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
125 | mvwaddch(stdscr, y * height, x * width + irssi->buddylistwidth, ACS_PLUS | COLOR_PAIR(GNT_COLOR_NORMAL)); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
126 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
127 | if (irssi->buddylistwidth) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
128 | mvwaddch(stdscr, y * height, irssi->buddylistwidth, ACS_LTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
129 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
130 | } |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
131 | |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
132 | static gboolean |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
133 | is_budddylist(GntWidget *win) |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
134 | { |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
135 | const char *name = gnt_widget_get_name(win); |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
136 | if (name && strcmp(name, "buddylist") == 0) |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
137 | return TRUE; |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
138 | return FALSE; |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
139 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
140 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
141 | static void |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
142 | remove_border_set_position_size(GntWM *wm, GntWidget *win, int x, int y, int w, int h) |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
143 | { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
144 | gnt_box_set_toplevel(GNT_BOX(win), FALSE); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
145 | GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_CAN_TAKE_FOCUS); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
146 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
147 | gnt_widget_set_position(win, x, y); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
148 | mvwin(win->window, y, x); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
149 | gnt_widget_set_size(win, (w < 0) ? -1 : w + 2, h + 2); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
150 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
151 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
152 | static void |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | irssi_new_window(GntWM *wm, GntWidget *win) |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
155 | const char *name; |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
156 | int x, y, w, h; |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
157 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
158 | name = gnt_widget_get_name(win); |
|
18560
de4b84e1e01d
Update the irssi WM to do substring-search instead of string comparison.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
159 | if (!name || !strstr(name, "conversation-window")) { |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
160 | if (!GNT_IS_MENU(win) && !GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_TRANSIENT)) { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
161 | if ((!name || strcmp(name, "buddylist"))) { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
162 | gnt_widget_get_size(win, &w, &h); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
163 | x = (getmaxx(stdscr) - w) / 2; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | y = (getmaxy(stdscr) - h) / 2; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
165 | gnt_widget_set_position(win, x, y); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
166 | mvwin(win->window, y, x); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
167 | } else { |
|
24449
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
168 | gnt_window_set_maximize(GNT_WINDOW(win), GNT_WINDOW_MAXIMIZE_Y); |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
169 | remove_border_set_position_size(wm, win, 0, 0, -1, getmaxy(stdscr) - 1); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
170 | gnt_widget_get_size(win, &((Irssi*)wm)->buddylistwidth, NULL); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
171 | draw_line_separators((Irssi*)wm); |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
172 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
173 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
174 | org_new_window(wm, win); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
175 | return; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
177 | |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
178 | /* The window we have here is a conversation window. */ |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
179 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
180 | /* XXX: There should be some way to remember which frame a conversation window |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
181 | * was in the last time. Perhaps save them in some ~/.gntpositionirssi or some |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
182 | * such. */ |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
183 | get_xywh_for_frame((Irssi*)wm, 0, 0, &x, &y, &w, &h); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
184 | remove_border_set_position_size(wm, win, x, y, w, h); |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
185 | org_new_window(wm, win); |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
186 | } |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
187 | |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
188 | static void |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
189 | irssi_window_resized(GntWM *wm, GntNode *node) |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
190 | { |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
191 | if (!is_budddylist(node->me)) |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
192 | return; |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
193 | |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
194 | gnt_widget_get_size(node->me, &((Irssi*)wm)->buddylistwidth, NULL); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
195 | draw_line_separators((Irssi*)wm); |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
196 | } |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
197 | |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
198 | static gboolean |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
199 | irssi_close_window(GntWM *wm, GntWidget *win) |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
200 | { |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
201 | if (is_budddylist(win)) |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
202 | ((Irssi*)wm)->buddylistwidth = 0; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
203 | return FALSE; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
204 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
205 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
206 | static gboolean |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
207 | update_conv_window_title(GntNode *node) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
208 | { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
209 | char title[256]; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
210 | snprintf(title, sizeof(title), "%d: %s", |
| 18184 | 211 | GPOINTER_TO_INT(g_object_get_data(G_OBJECT(node->me), "irssi-index")) + 1, |
| 212 | GNT_BOX(node->me)->title); | |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
213 | wbkgdset(node->window, '\0' | COLOR_PAIR(gnt_widget_has_focus(node->me) ? GNT_COLOR_TITLE : GNT_COLOR_TITLE_D)); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
214 | mvwaddstr(node->window, 0, 0, title); |
|
18602
93ca53286fa1
Update the irssi WM to not touch the screen when something else is using it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18560
diff
changeset
|
215 | if (!gnt_is_refugee()) { |
|
93ca53286fa1
Update the irssi WM to not touch the screen when something else is using it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18560
diff
changeset
|
216 | update_panels(); |
|
93ca53286fa1
Update the irssi WM to not touch the screen when something else is using it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18560
diff
changeset
|
217 | doupdate(); |
|
93ca53286fa1
Update the irssi WM to not touch the screen when something else is using it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18560
diff
changeset
|
218 | } |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
219 | return FALSE; |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
220 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
221 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
222 | static void |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
223 | irssi_update_window(GntWM *wm, GntNode *node) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
224 | { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
225 | GntWidget *win = node->me; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
226 | const char *name = gnt_widget_get_name(win); |
|
18560
de4b84e1e01d
Update the irssi WM to do substring-search instead of string comparison.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18420
diff
changeset
|
227 | if (!name || !GNT_IS_BOX(win) || !strstr(name, "conversation-window")) |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
228 | return; |
|
18136
2c934db7aedd
Make the irssi wm work.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18107
diff
changeset
|
229 | g_object_set_data(G_OBJECT(win), "irssi-index", GINT_TO_POINTER(g_list_index(wm->cws->list, win))); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
230 | g_timeout_add(0, (GSourceFunc)update_conv_window_title, node); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
231 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
232 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
233 | static void |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
234 | find_window_position(Irssi *irssi, GntWidget *win, int *h, int *v) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
235 | { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
236 | int x, y; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
237 | int width, height; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
238 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
239 | gnt_widget_get_position(win, &x, &y); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
240 | width = (getmaxx(stdscr) - irssi->buddylistwidth) / irssi->horiz; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
241 | height = (getmaxy(stdscr) - 1) / irssi->vert; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
242 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
243 | if (h) |
|
25352
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
244 | *h = width ? (x - irssi->buddylistwidth) / width : x / (getmaxx(stdscr) / irssi->horiz); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
245 | if (v) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
246 | *v = y / height; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
247 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
248 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
249 | static gboolean |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
250 | move_direction(GntBindable *bindable, GList *list) |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
251 | { |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
252 | GntWM *wm = GNT_WM(bindable); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
253 | Irssi *irssi = (Irssi*)wm; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
254 | int vert, hor; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
255 | int x, y, w, h; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
256 | GntWidget *win; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
257 | |
|
18136
2c934db7aedd
Make the irssi wm work.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18107
diff
changeset
|
258 | if (wm->cws->ordered == NULL || is_budddylist(win = GNT_WIDGET(wm->cws->ordered->data))) |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
259 | return FALSE; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
260 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
261 | find_window_position(irssi, win, &hor, &vert); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
262 | |
| 18184 | 263 | switch (GPOINTER_TO_INT(list->data)) { |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
264 | case 'k': |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
265 | vert = MAX(0, vert - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
266 | break; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
267 | case 'j': |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
268 | vert = MIN(vert + 1, irssi->vert - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
269 | break; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
270 | case 'l': |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
271 | hor = MIN(hor + 1, irssi->horiz - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
272 | break; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
273 | case 'h': |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
274 | hor = MAX(0, hor - 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
275 | break; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
276 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
277 | get_xywh_for_frame(irssi, hor, vert, &x, &y, &w, &h); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
278 | gnt_wm_move_window(wm, win, x, y); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
279 | gnt_wm_resize_window(wm, win, w, h); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
280 | return TRUE; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
281 | } |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
282 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
283 | static void |
|
24449
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
284 | refresh_window(GntWidget *widget, GntNode *node, Irssi *irssi) |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
285 | { |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
286 | int vert, hor; |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
287 | int x, y, w, h; |
|
25352
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
288 | const char *name; |
|
24449
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
289 | |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
290 | if (!GNT_IS_WINDOW(widget)) |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
291 | return; |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
292 | |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
293 | if (is_budddylist(widget)) { |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
294 | return; |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
295 | } |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
296 | |
|
25352
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
297 | name = gnt_widget_get_name(widget); |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
298 | if (name && strstr(name, "conversation-window")) { |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
299 | find_window_position(irssi, widget, &hor, &vert); |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
300 | get_xywh_for_frame(irssi, hor, vert, &x, &y, &w, &h); |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
301 | gnt_wm_move_window(GNT_WM(irssi), widget, x, y); |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
302 | gnt_wm_resize_window(GNT_WM(irssi), widget, w, h); |
|
f28ea1231b93
Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24449
diff
changeset
|
303 | } |
|
24449
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
304 | } |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
305 | |
|
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
306 | static void |
|
18420
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
307 | irssi_terminal_refresh(GntWM *wm) |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
308 | { |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
309 | draw_line_separators((Irssi*)wm); |
|
24449
596d0523c041
Fix a bug in the irssi plugin where the windows wouldn't expand when the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23153
diff
changeset
|
310 | g_hash_table_foreach(wm->nodes, (GHFunc)refresh_window, wm); |
|
18420
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
311 | } |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
312 | |
|
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
313 | static void |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
314 | irssi_class_init(IrssiClass *klass) |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
315 | { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
316 | GntWMClass *pclass = GNT_WM_CLASS(klass); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
317 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
318 | org_new_window = pclass->new_window; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
319 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
320 | pclass->new_window = irssi_new_window; |
|
17866
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
321 | pclass->window_resized = irssi_window_resized; |
|
788f26df0842
Draw a separator line between the buddylist and the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17864
diff
changeset
|
322 | pclass->close_window = irssi_close_window; |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
323 | pclass->window_update = irssi_update_window; |
|
18420
fd3ec9457e27
Add a callback that gets triggered by SIGWINCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18370
diff
changeset
|
324 | pclass->terminal_refresh = irssi_terminal_refresh; |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
325 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
326 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "move-up", move_direction, |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
327 | "\033" "K", GINT_TO_POINTER('k'), NULL); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
328 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "move-down", move_direction, |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
329 | "\033" "J", GINT_TO_POINTER('j'), NULL); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
330 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "move-right", move_direction, |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
331 | "\033" "L", GINT_TO_POINTER('l'), NULL); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
332 | gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "move-left", move_direction, |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
333 | "\033" "H", GINT_TO_POINTER('h'), NULL); |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
334 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
335 | gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
336 | GNTDEBUG; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
337 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
338 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
339 | void gntwm_init(GntWM **wm) |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
340 | { |
|
18370
1f3c329fe2b2
Plug a memory leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18361
diff
changeset
|
341 | char *style = NULL; |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
342 | Irssi *irssi; |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
343 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
344 | irssi = g_object_new(TYPE_IRSSI, NULL); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
345 | *wm = GNT_WM(irssi); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
346 | |
|
18361
740fec710f0a
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18184
diff
changeset
|
347 | style = gnt_style_get_from_name("irssi", "split-v"); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
348 | irssi->vert = style ? atoi(style) : 1; |
|
18370
1f3c329fe2b2
Plug a memory leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18361
diff
changeset
|
349 | g_free(style); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
350 | |
|
18361
740fec710f0a
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18184
diff
changeset
|
351 | style = gnt_style_get_from_name("irssi", "split-h"); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
352 | irssi->horiz = style ? atoi(style) : 1; |
|
18370
1f3c329fe2b2
Plug a memory leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18361
diff
changeset
|
353 | g_free(style); |
|
18107
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
354 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
355 | irssi->vert = MAX(irssi->vert, 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
356 | irssi->horiz = MAX(irssi->horiz, 1); |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
357 | |
|
080301575c86
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17866
diff
changeset
|
358 | irssi->buddylistwidth = 0; |
|
17864
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
359 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
360 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
361 | GType irssi_get_gtype(void) |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
362 | { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
363 | static GType type = 0; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
364 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
365 | if(type == 0) { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
366 | static const GTypeInfo info = { |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
367 | sizeof(IrssiClass), |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
368 | NULL, /* base_init */ |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
369 | NULL, /* base_finalize */ |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
370 | (GClassInitFunc)irssi_class_init, |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
371 | NULL, |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
372 | NULL, /* class_data */ |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
373 | sizeof(Irssi), |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
374 | 0, /* n_preallocs */ |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
375 | NULL, /* instance_init */ |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
376 | NULL |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
377 | }; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
378 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
379 | type = g_type_register_static(GNT_TYPE_WM, |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
380 | "GntIrssi", |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
381 | &info, 0); |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
382 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
383 | |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
384 | return type; |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
385 | } |
|
06b4c3fce998
Add a new WM, irssi. Put the wm's in $(libdir)/gnt instead of in /finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
386 |