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