Mercurial > pidgin
annotate console/libgnt/gntwm.c @ 15741:50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
window when we add more prefs there). The default binding for scrolling in such
a window are, for the moment, alt-ctrl-l and alt-ctrl-k.
Things still to be done:
* Give a clear onscreen indication that there is more to the window than meets the eye.
* Update the scrolling when the window is resized.
* Use some better binding.
* Update the manual.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 27 Feb 2007 09:06:05 +0000 |
parents | 73219517f583 |
children | 909e59dae123 |
rev | line source |
---|---|
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #define _GNU_SOURCE |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #if defined(__APPLE__) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #define _XOPEN_SOURCE_EXTENDED |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 |
14904
0512fddbaaf2
[gaim-migrate @ 17676]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14900
diff
changeset
|
6 #include "config.h" |
0512fddbaaf2
[gaim-migrate @ 17676]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14900
diff
changeset
|
7 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 #include "gntwm.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 #include "gntstyle.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #include "gntmarshal.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #include "gnt.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 #include "gntbox.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 #include "gntmenu.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 #include "gnttextview.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 #include "gnttree.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 #include "gntutils.h" |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 #include <ctype.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 #include <stdlib.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 #include <string.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
22 #define IDLE_CHECK_INTERVAL 5 /* 5 seconds */ |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
23 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 enum |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 SIG_NEW_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 SIG_DECORATE_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 SIG_CLOSE_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 SIG_CONFIRM_RESIZE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 SIG_RESIZED, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 SIG_CONFIRM_MOVE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 SIG_MOVED, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 SIG_UPDATE_WIN, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 SIG_GIVE_FOCUS, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 SIG_KEY_PRESS, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 SIG_MOUSE_CLICK, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 SIGS |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 static guint signals[SIGS] = { 0 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 static void gnt_wm_new_window_real(GntWM *wm, GntWidget *widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 static void gnt_wm_win_resized(GntWM *wm, GntNode *node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 static void gnt_wm_win_moved(GntWM *wm, GntNode *node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 static void gnt_wm_give_focus(GntWM *wm, GntWidget *widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 static void update_window_in_list(GntWM *wm, GntWidget *wid); |
15652
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
46 static void shift_window(GntWM *wm, GntWidget *widget, int dir); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
48 static gboolean write_already(gpointer data); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
49 static int write_timeout; |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
50 static time_t last_active_time; |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
51 static gboolean idle_update; |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
52 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 static GList * |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 g_list_bring_to_front(GList *list, gpointer data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 list = g_list_remove(list, data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 list = g_list_prepend(list, data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 return list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 free_node(gpointer data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 GntNode *node = data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 hide_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 del_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 g_free(node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 draw_taskbar(GntWM *wm, gboolean reposition) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 static WINDOW *taskbar = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 int n, width = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 int i; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 if (taskbar == NULL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 } else if (reposition) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 int Y_MAX = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 mvwin(taskbar, Y_MAX, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 werase(taskbar); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 n = g_list_length(wm->list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 if (n) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 width = getmaxx(stdscr) / n; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 for (i = 0, iter = wm->list; iter; iter = iter->next, i++) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 GntWidget *w = iter->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 int color; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 const char *title; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 if (w == wm->ordered->data) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 /* This is the current window in focus */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 color = GNT_COLOR_TITLE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 /* This is a window with the URGENT hint set */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 color = GNT_COLOR_URGENT; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 } else { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 color = GNT_COLOR_NORMAL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); |
15137
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15067
diff
changeset
|
108 if (iter->next) |
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15067
diff
changeset
|
109 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); |
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15067
diff
changeset
|
110 else |
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15067
diff
changeset
|
111 mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), getmaxx(stdscr) - width * i); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 title = GNT_BOX(w)->title; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 if (i) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | COLOR_PAIR(GNT_COLOR_NORMAL)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 update_window_in_list(wm, w); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 wrefresh(taskbar); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 } |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
122 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
123 static void |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
124 copy_win(GntWidget *widget, GntNode *node) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
125 { |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
126 WINDOW *src, *dst; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
127 int shadow; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
128 if (!node) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
129 return; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
130 src = widget->window; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
131 dst = node->window; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
132 shadow = gnt_widget_has_shadow(widget) ? 1 : 0; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
133 copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
134 } |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
135 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 update_screen(GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 if (wm->menu) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 GntMenu *top = wm->menu; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 while (top) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 GntNode *node = g_hash_table_lookup(wm->nodes, top); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 if (node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 top_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 top = top->submenu; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 update_panels(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 doupdate(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 } |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
152 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
153 static gboolean |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
154 sanitize_position(GntWidget *widget, int *x, int *y) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
155 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
156 int X_MAX = getmaxx(stdscr); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
157 int Y_MAX = getmaxy(stdscr) - 1; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
158 int w, h; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
159 int nx, ny; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
160 gboolean changed = FALSE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
161 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
162 gnt_widget_get_size(widget, &w, &h); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
163 if (x) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
164 if (*x + w > X_MAX) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
165 nx = MAX(0, X_MAX - w); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
166 if (nx != *x) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
167 *x = nx; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
168 changed = TRUE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
169 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
170 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
171 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
172 if (y) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
173 if (*y + h > Y_MAX) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
174 ny = MAX(0, Y_MAX - h); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
175 if (ny != *y) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
176 *y = ny; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
177 changed = TRUE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
178 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
179 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
180 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
181 return changed; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
182 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
183 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 refresh_node(GntWidget *widget, GntNode *node, gpointer null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 int x, y, w, h; |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
188 int nw, nh; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 int X_MAX = getmaxx(stdscr); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 int Y_MAX = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 gnt_widget_get_position(widget, &x, &y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 gnt_widget_get_size(widget, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
196 if (sanitize_position(widget, &x, &y)) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
197 gnt_screen_move_widget(widget, x, y); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 nw = MIN(w, X_MAX); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 nh = MIN(h, Y_MAX); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 if (nw != w || nh != h) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 gnt_screen_resize_widget(widget, nw, nh); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 } |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
204 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
205 static void |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
206 read_window_positions(GntWM *wm) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
207 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
208 #if GLIB_CHECK_VERSION(2,6,0) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
209 GKeyFile *gfile = g_key_file_new(); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
210 char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
211 GError *error = NULL; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
212 char **keys; |
15157 | 213 gsize nk; |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
214 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
215 if (!g_key_file_load_from_file(gfile, filename, G_KEY_FILE_NONE, &error)) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
216 g_printerr("GntWM: %s\n", error->message); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
217 g_error_free(error); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
218 g_free(filename); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
219 return; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
220 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
221 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
222 keys = g_key_file_get_keys(gfile, "positions", &nk, &error); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
223 if (error) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
224 g_printerr("GntWM: %s\n", error->message); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
225 g_error_free(error); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
226 error = NULL; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
227 } else { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
228 while (nk--) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
229 char *title = keys[nk]; |
15157 | 230 gsize l; |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
231 char **coords = g_key_file_get_string_list(gfile, "positions", title, &l, NULL); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
232 if (l == 2) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
233 int x = atoi(coords[0]); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
234 int y = atoi(coords[1]); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
235 GntPosition *p = g_new0(GntPosition, 1); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
236 p->x = x; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
237 p->y = y; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
238 g_hash_table_replace(wm->positions, g_strdup(title + 1), p); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
239 } else { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
240 g_printerr("GntWM: Invalid number of arguments for positioing a window.\n"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
241 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
242 g_strfreev(coords); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
243 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
244 g_strfreev(keys); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
245 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
246 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
247 g_free(filename); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
248 #endif |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
249 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
250 |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
251 static gboolean check_idle(gpointer n) |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
252 { |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
253 if (idle_update) { |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
254 time(&last_active_time); |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
255 idle_update = FALSE; |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
256 } |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
257 return TRUE; |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
258 } |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
259 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
260 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
261 gnt_wm_init(GTypeInstance *instance, gpointer class) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
262 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
263 GntWM *wm = GNT_WM(instance); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
264 wm->list = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
265 wm->ordered = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 wm->windows = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 wm->actions = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 wm->nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node); |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
270 wm->positions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
271 if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE)) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
272 read_window_positions(wm); |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
273 g_timeout_add(IDLE_CHECK_INTERVAL * 1000, check_idle, NULL); |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
274 time(&last_active_time); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 switch_window(GntWM *wm, int direction) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 GntWidget *w = NULL, *wid = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 int pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 if (!wm->ordered || !wm->ordered->next) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 pos = g_list_index(wm->list, w); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 pos += direction; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 if (pos < 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 wid = g_list_last(wm->list)->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 else if (pos >= g_list_length(wm->list)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 wid = wm->list->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 else if (pos >= 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 wid = g_list_nth_data(wm->list, pos); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 wm->ordered = g_list_bring_to_front(wm->ordered, wid); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 gnt_wm_raise_window(wm, wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 if (w != wid) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 window_next(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 switch_window(wm, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
318 window_prev(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 switch_window(wm, -1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 switch_window_n(GntBindable *bind, GList *list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 GntWM *wm = GNT_WM(bind); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
329 GntWidget *w = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
330 GList *l; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 int n; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 |
15210
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15196
diff
changeset
|
333 if (!wm->ordered) |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 |
15210
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15196
diff
changeset
|
336 if (list) |
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15196
diff
changeset
|
337 n = GPOINTER_TO_INT(list->data); |
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15196
diff
changeset
|
338 else |
7d682fc9098f
[gaim-migrate @ 18000]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15196
diff
changeset
|
339 n = 0; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 if ((l = g_list_nth(wm->list, n)) != NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 gnt_wm_raise_window(wm, l->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 if (l && w != l->data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 } |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
354 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
355 static gboolean |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
356 window_scroll_up(GntBindable *bindable, GList *null) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
357 { |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
358 GntWM *wm = GNT_WM(bindable); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
359 GntWidget *window; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
360 GntNode *node; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
361 int w, h; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
362 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
363 if (!wm->ordered) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
364 return TRUE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
365 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
366 window = wm->ordered->data; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
367 node = g_hash_table_lookup(wm->nodes, window); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
368 if (!node) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
369 return TRUE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
370 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
371 if (node->scroll) { |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
372 node->scroll--; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
373 copy_win(window, node); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
374 update_screen(wm); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
375 } |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
376 } |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
377 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
378 static gboolean |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
379 window_scroll_down(GntBindable *bindable, GList *null) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
380 { |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
381 GntWM *wm = GNT_WM(bindable); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
382 GntWidget *window; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
383 GntNode *node; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
384 int w, h; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
385 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
386 if (!wm->ordered) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
387 return TRUE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
388 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
389 window = wm->ordered->data; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
390 node = g_hash_table_lookup(wm->nodes, window); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
391 if (!node) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
392 return TRUE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
393 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
394 gnt_widget_get_size(window, &w, &h); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
395 if (h - node->scroll > getmaxy(node->window)) { |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
396 node->scroll++; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
397 copy_win(window, node); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
398 update_screen(wm); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
399 } |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
400 return TRUE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
401 } |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
402 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 window_close(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
407 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 if (wm->ordered) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
412 gnt_widget_destroy(wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
418 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
419 destroy__list(GntWidget *widget, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
420 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
421 wm->_list.window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
422 wm->_list.tree = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
423 wm->windows = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
424 wm->actions = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
425 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
426 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
428 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
429 setup__list(GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
430 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
431 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
432 win = wm->_list.window = gnt_box_new(FALSE, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
433 gnt_box_set_toplevel(GNT_BOX(win), TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
434 gnt_box_set_pad(GNT_BOX(win), 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
435 GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_TRANSIENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
436 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
437 tree = wm->_list.tree = gnt_tree_new(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
438 gnt_box_add_widget(GNT_BOX(win), tree); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
439 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
440 g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(destroy__list), wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
441 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
443 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
444 window_list_activate(GntTree *tree, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
445 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
446 GntWidget *widget = gnt_tree_get_selection_data(GNT_TREE(tree)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
447 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
448 if (!wm->ordered || !widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
452 gnt_wm_raise_window(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
453 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
454 |
15652
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
455 static void |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
456 populate_window_list(GntWM *wm) |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
457 { |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
458 GList *iter; |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
459 GntTree *tree = GNT_TREE(wm->windows->tree); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
460 for (iter = wm->list; iter; iter = iter->next) { |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
461 GntBox *box = GNT_BOX(iter->data); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
462 |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
463 gnt_tree_add_row_last(tree, box, |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
464 gnt_tree_create_row(tree, box->title), NULL); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
465 update_window_in_list(wm, GNT_WIDGET(box)); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
466 } |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
467 } |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
468 |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
469 static gboolean |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
470 window_list_key_pressed(GntWidget *widget, const char *text, GntWM *wm) |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
471 { |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
472 if (text[1] == 0 && wm->ordered) { |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
473 GntWidget *sel = gnt_tree_get_selection_data(GNT_TREE(widget)); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
474 switch (text[0]) { |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
475 case '-': |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
476 case '<': |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
477 shift_window(wm, sel, -1); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
478 break; |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
479 case '+': |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
480 case '>': |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
481 shift_window(wm, sel, 1); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
482 break; |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
483 default: |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
484 return FALSE; |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
485 } |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
486 gnt_tree_remove_all(GNT_TREE(widget)); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
487 populate_window_list(wm); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
488 gnt_tree_set_selected(GNT_TREE(widget), sel); |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
489 return TRUE; |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
490 } |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
491 return FALSE; |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
492 } |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
493 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
494 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
495 window_list(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
496 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
497 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
498 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
499 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
500 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
501 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
502 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
503 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 setup__list(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 wm->windows = &wm->_list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
509 win = wm->windows->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
510 tree = wm->windows->tree; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
511 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
512 gnt_box_set_title(GNT_BOX(win), "Window List"); |
15652
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
513 |
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
514 populate_window_list(wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
515 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 gnt_tree_set_selected(GNT_TREE(tree), wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), wm); |
15652
995af0f20c27
Allow reordering windows from the window list. I find it much easier and faster.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15210
diff
changeset
|
518 g_signal_connect(G_OBJECT(tree), "key_pressed", G_CALLBACK(window_list_key_pressed), wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
519 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
520 gnt_tree_set_col_width(GNT_TREE(tree), 0, getmaxx(stdscr) / 3); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
522 gnt_widget_set_position(win, getmaxx(stdscr) / 3, getmaxy(stdscr) / 4); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 gnt_widget_show(win); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 dump_screen(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 int x, y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 chtype old = 0, now = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 FILE *file = fopen("dump.html", "w"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 fprintf(file, "<pre>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
536 for (y = 0; y < getmaxy(stdscr); y++) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
537 for (x = 0; x < getmaxx(stdscr); x++) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
538 char ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
539 now = mvwinch(curscr, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
540 ch = now & A_CHARTEXT; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
541 now ^= ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
542 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
543 #define CHECK(attr, start, end) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
544 do \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
545 { \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
546 if (now & attr) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 { \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 if (!(old & attr)) \ |
15196 | 549 fprintf(file, "%s", start); \ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
550 } \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
551 else if (old & attr) \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
552 { \ |
15196 | 553 fprintf(file, "%s", end); \ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
554 } \ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
555 } while (0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
556 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
557 CHECK(A_BOLD, "<b>", "</b>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 CHECK(A_UNDERLINE, "<u>", "</u>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
559 CHECK(A_BLINK, "<blink>", "</blink>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 if ((now & A_COLOR) != (old & A_COLOR) || |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 (now & A_REVERSE) != (old & A_REVERSE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
563 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 int ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
565 short fgp, bgp, r, g, b; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
566 struct |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
567 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
568 int r, g, b; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 } fg, bg; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
571 ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 if (fgp == -1) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
573 fgp = COLOR_BLACK; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
574 if (bgp == -1) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
575 bgp = COLOR_WHITE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
576 if (now & A_REVERSE) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
577 fgp ^= bgp ^= fgp ^= bgp; /* *wink* */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
578 ret = color_content(fgp, &r, &g, &b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
579 fg.r = r; fg.b = b; fg.g = g; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
580 ret = color_content(bgp, &r, &g, &b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
581 bg.r = r; bg.b = b; bg.g = g; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 #define ADJUST(x) (x = x * 255 / 1000) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
583 ADJUST(fg.r); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
584 ADJUST(fg.g); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
585 ADJUST(fg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
586 ADJUST(bg.r); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
587 ADJUST(bg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
588 ADJUST(bg.g); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
589 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
590 if (x) fprintf(file, "</span>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
591 fprintf(file, "<span style=\"background:#%02x%02x%02x;color:#%02x%02x%02x\">", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 bg.r, bg.g, bg.b, fg.r, fg.g, fg.b); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
593 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
594 if (now & A_ALTCHARSET) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
595 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
596 switch (ch) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
597 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
598 case 'q': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
599 ch = '-'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
600 case 't': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
601 case 'u': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
602 case 'x': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
603 ch = '|'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
604 case 'v': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
605 case 'w': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
606 case 'l': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
607 case 'm': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
608 case 'k': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
609 case 'j': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
610 case 'n': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
611 ch = '+'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
612 case '-': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
613 ch = '^'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
614 case '.': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 ch = 'v'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
616 case 'a': |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
617 ch = '#'; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
618 default: |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
619 ch = ' '; break; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
620 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
621 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 if (ch == '&') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 fprintf(file, "&"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 else if (ch == '<') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
625 fprintf(file, "<"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 else if (ch == '>') |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 fprintf(file, ">"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
629 fprintf(file, "%c", ch); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
630 old = now; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
631 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
632 fprintf(file, "</span>\n"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
633 old = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
634 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 fprintf(file, "</pre>"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 fclose(file); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
637 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 shift_window(GntWM *wm, GntWidget *widget, int dir) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
642 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
643 GList *all = wm->list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 GList *list = g_list_find(all, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 int length, pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 if (!list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 length = g_list_length(all); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 pos = g_list_position(all, list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
651 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
652 pos += dir; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
653 if (dir > 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
654 pos++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
655 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
656 if (pos < 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
657 pos = length; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
658 else if (pos > length) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
659 pos = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
660 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
661 all = g_list_insert(all, widget, pos); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
662 all = g_list_delete_link(all, list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
663 wm->list = all; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
664 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
665 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
666 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
667 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
668 shift_left(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
669 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
670 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
671 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
672 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
673 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
674 shift_window(wm, wm->ordered->data, -1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
675 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
676 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
677 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
678 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
679 shift_right(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
680 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
681 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
682 if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
683 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
684 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
685 shift_window(wm, wm->ordered->data, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
686 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
687 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
688 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
689 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
690 action_list_activate(GntTree *tree, GntWM *wm) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
691 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
692 GntAction *action = gnt_tree_get_selection_data(tree); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
693 action->callback(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
694 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
695 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
696 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
697 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
698 compare_action(gconstpointer p1, gconstpointer p2) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
699 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
700 const GntAction *a1 = p1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
701 const GntAction *a2 = p2; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
702 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
703 return g_utf8_collate(a1->label, a2->label); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
704 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
705 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
706 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
707 list_actions(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
708 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
709 GntWidget *tree, *win; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
710 GList *iter; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
711 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
712 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
713 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
714 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
715 if (wm->acts == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
716 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
717 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
718 setup__list(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
719 wm->actions = &wm->_list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
720 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
721 win = wm->actions->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
722 tree = wm->actions->tree; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
723 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
724 gnt_box_set_title(GNT_BOX(win), "Actions"); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
725 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
726 /* XXX: Do we really want this? */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
727 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
728 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
729 for (iter = wm->acts; iter; iter = iter->next) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
730 GntAction *action = iter->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
731 gnt_tree_add_row_last(GNT_TREE(tree), action, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
732 gnt_tree_create_row(GNT_TREE(tree), action->label), NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
733 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
734 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
735 gnt_widget_set_size(tree, 0, g_list_length(wm->acts)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
736 gnt_widget_set_position(win, 0, getmaxy(stdscr) - 3 - g_list_length(wm->acts)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
737 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
738 gnt_widget_show(win); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
739 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
740 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
741 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
742 #ifndef NO_WIDECHAR |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
743 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
744 widestringwidth(wchar_t *wide) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
745 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
746 int len, ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
747 char *string; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
748 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
749 len = wcstombs(NULL, wide, 0) + 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
750 string = g_new0(char, len); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
751 wcstombs(string, wide, len); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
752 ret = gnt_util_onscreen_width(string, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
753 g_free(string); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
754 return ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
755 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
756 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
757 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
758 /* Returns the onscreen width of the character at the position */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
759 static int |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
760 reverse_char(WINDOW *d, int y, int x, gboolean set) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
761 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
762 #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
763 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
764 #ifdef NO_WIDECHAR |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
765 chtype ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
766 ch = mvwinch(d, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
767 mvwaddch(d, y, x, DECIDE(ch)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
768 return 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
769 #else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
770 cchar_t ch; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
771 int wc = 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
772 if (mvwin_wch(d, y, x, &ch) == OK) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
773 wc = widestringwidth(ch.chars); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
774 ch.attr = DECIDE(ch.attr); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
775 ch.attr &= WA_ATTRIBUTES; /* XXX: This is a workaround for a bug */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
776 mvwadd_wch(d, y, x, &ch); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
777 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
778 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
779 return wc; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
780 #endif |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
781 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
782 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
783 static void |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
784 window_reverse(GntWidget *win, gboolean set, GntWM *wm) |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
785 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
786 int i; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
787 int w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
788 WINDOW *d; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
789 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
790 if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
791 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
792 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
793 d = win->window; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
794 gnt_widget_get_size(win, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
795 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
796 if (gnt_widget_has_shadow(win)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
797 --w; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
798 --h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
799 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
800 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
801 /* the top and bottom */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
802 for (i = 0; i < w; i += reverse_char(d, 0, i, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
803 for (i = 0; i < w; i += reverse_char(d, h-1, i, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
804 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
805 /* the left and right */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
806 for (i = 0; i < h; i += reverse_char(d, i, 0, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
807 for (i = 0; i < h; i += reverse_char(d, i, w-1, set)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
808 |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
809 copy_win(win, g_hash_table_lookup(wm->nodes, win)); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
810 update_screen(wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
811 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
812 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
813 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
814 start_move(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
815 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
816 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
817 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
818 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
819 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
820 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
821 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
822 wm->mode = GNT_KP_MODE_MOVE; |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
823 window_reverse(GNT_WIDGET(wm->ordered->data), TRUE, wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
824 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
825 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
826 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
827 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
828 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
829 start_resize(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
830 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
831 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
832 if (wm->_list.window || wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
833 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
834 if (!wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
835 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
836 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
837 wm->mode = GNT_KP_MODE_RESIZE; |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
838 window_reverse(GNT_WIDGET(wm->ordered->data), TRUE, wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
839 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
840 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
841 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
842 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
843 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
844 wm_quit(GntBindable *bindable, GList *list) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
845 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
846 GntWM *wm = GNT_WM(bindable); |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
847 if (write_timeout) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
848 write_already(wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
849 g_main_loop_quit(wm->loop); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
850 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
851 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
852 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
853 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
854 return_true(GntWM *wm, GntWidget *w, int *a, int *b) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
855 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
856 return TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
857 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
858 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
859 static gboolean |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
860 refresh_screen(GntBindable *bindable, GList *null) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
861 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
862 GntWM *wm = GNT_WM(bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
863 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
864 endwin(); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
865 refresh(); |
15137
2409a2508650
[gaim-migrate @ 17923]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15067
diff
changeset
|
866 curs_set(0); /* endwin resets the cursor to normal */ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
867 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
868 g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
869 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
870 draw_taskbar(wm, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
871 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
872 return FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
873 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
874 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
875 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
876 gnt_wm_class_init(GntWMClass *klass) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
877 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
878 klass->new_window = gnt_wm_new_window_real; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
879 klass->decorate_window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
880 klass->close_window = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
881 klass->window_resize_confirm = return_true; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
882 klass->window_resized = gnt_wm_win_resized; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
883 klass->window_move_confirm = return_true; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
884 klass->window_moved = gnt_wm_win_moved; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
885 klass->window_update = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
886 klass->key_pressed = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
887 klass->mouse_clicked = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
888 klass->give_focus = gnt_wm_give_focus; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
889 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
890 signals[SIG_NEW_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
891 g_signal_new("new_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
892 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
893 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
894 G_STRUCT_OFFSET(GntWMClass, new_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
895 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
896 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
897 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
898 signals[SIG_DECORATE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
899 g_signal_new("decorate_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
900 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
901 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
902 G_STRUCT_OFFSET(GntWMClass, decorate_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
903 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
904 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
905 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
906 signals[SIG_CLOSE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
907 g_signal_new("close_win", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
908 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
909 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
910 G_STRUCT_OFFSET(GntWMClass, close_window), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
911 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
912 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
913 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
914 signals[SIG_CONFIRM_RESIZE] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
915 g_signal_new("confirm_resize", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
916 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
917 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
918 G_STRUCT_OFFSET(GntWMClass, window_resize_confirm), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
919 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
920 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
921 G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
922 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
923 signals[SIG_CONFIRM_MOVE] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
924 g_signal_new("confirm_move", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
925 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
926 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
927 G_STRUCT_OFFSET(GntWMClass, window_move_confirm), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
928 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
929 gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
930 G_TYPE_BOOLEAN, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
931 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
932 signals[SIG_RESIZED] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
933 g_signal_new("window_resized", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
934 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
935 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
936 G_STRUCT_OFFSET(GntWMClass, window_resized), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
937 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
938 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
939 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
940 signals[SIG_MOVED] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
941 g_signal_new("window_moved", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
942 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
943 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
944 G_STRUCT_OFFSET(GntWMClass, window_moved), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
945 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
946 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
947 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
948 signals[SIG_UPDATE_WIN] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
949 g_signal_new("window_update", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
950 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
951 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
952 G_STRUCT_OFFSET(GntWMClass, window_update), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
953 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
954 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
955 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
956 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
957 signals[SIG_GIVE_FOCUS] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
958 g_signal_new("give_focus", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
959 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
960 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
961 G_STRUCT_OFFSET(GntWMClass, give_focus), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
962 NULL, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
963 g_cclosure_marshal_VOID__POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
964 G_TYPE_NONE, 1, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
965 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
966 signals[SIG_MOUSE_CLICK] = |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
967 g_signal_new("mouse_clicked", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
968 G_TYPE_FROM_CLASS(klass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
969 G_SIGNAL_RUN_LAST, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
970 G_STRUCT_OFFSET(GntWMClass, mouse_clicked), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
971 gnt_boolean_handled_accumulator, NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
972 gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
973 G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
974 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
975 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next", window_next, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
976 "\033" "n", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
977 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev", window_prev, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
978 "\033" "p", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
979 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-close", window_close, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
980 "\033" "c", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
981 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-list", window_list, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
982 "\033" "w", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
983 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "dump-screen", dump_screen, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
984 "\033" "d", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
985 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "shift-left", shift_left, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
986 "\033" ",", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
987 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "shift-right", shift_right, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
988 "\033" ".", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
989 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "action-list", list_actions, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
990 "\033" "a", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
991 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "start-move", start_move, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
992 "\033" "m", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
993 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "start-resize", start_resize, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
994 "\033" "r", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
995 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "wm-quit", wm_quit, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
996 "\033" "q", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
997 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "refresh-screen", refresh_screen, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
998 "\033" "l", NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
999 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "switch-window-n", switch_window_n, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1000 NULL, NULL); |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1001 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-down", window_scroll_down, |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1002 "\033" GNT_KEY_CTRL_J, NULL); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1003 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-up", window_scroll_up, |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1004 "\033" GNT_KEY_CTRL_K, NULL); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1005 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1006 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1007 GNTDEBUG; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1008 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1009 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1010 /****************************************************************************** |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1011 * GntWM API |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1012 *****************************************************************************/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1013 GType |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1014 gnt_wm_get_gtype(void) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1015 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1016 static GType type = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1017 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1018 if(type == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1019 static const GTypeInfo info = { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1020 sizeof(GntWMClass), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1021 NULL, /* base_init */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1022 NULL, /* base_finalize */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1023 (GClassInitFunc)gnt_wm_class_init, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1024 NULL, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1025 NULL, /* class_data */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1026 sizeof(GntWM), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1027 0, /* n_preallocs */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1028 gnt_wm_init, /* instance_init */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1029 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1030 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1031 type = g_type_register_static(GNT_TYPE_BINDABLE, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1032 "GntWM", |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1033 &info, 0); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1034 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1035 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1036 return type; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1037 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1038 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1039 update_window_in_list(GntWM *wm, GntWidget *wid) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1040 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1041 GntTextFormatFlags flag = 0; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1042 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1043 if (wm->windows == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1044 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1045 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1046 if (wid == wm->ordered->data) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1047 flag |= GNT_TEXT_FLAG_DIM; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1048 else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1049 flag |= GNT_TEXT_FLAG_BOLD; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1050 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1051 gnt_tree_set_row_flags(GNT_TREE(wm->windows->tree), wid, flag); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1052 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1053 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1054 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1055 gnt_wm_new_window_real(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1056 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1057 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1058 gboolean transient = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1059 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1060 if (widget->window == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1061 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1062 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1063 node = g_new0(GntNode, 1); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1064 node->me = widget; |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1065 node->scroll = 0; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1066 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1067 g_hash_table_replace(wm->nodes, widget, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1068 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1069 refresh_node(widget, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1070 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1071 transient = !!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1072 |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1073 #if 1 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1074 { |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1075 int x, y, w, h, maxx, maxy; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1076 gboolean shadow = TRUE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1077 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1078 if (!gnt_widget_has_shadow(widget)) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1079 shadow = FALSE; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1080 x = widget->priv.x; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1081 y = widget->priv.y; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1082 w = widget->priv.width; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1083 h = widget->priv.height; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1084 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1085 getmaxyx(stdscr, maxy, maxx); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1086 maxy -= 1; /* room for the taskbar */ |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1087 maxy -= shadow; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1088 maxx -= shadow; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1089 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1090 x = MAX(0, x); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1091 y = MAX(0, y); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1092 if (x + w >= maxx) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1093 x = MAX(0, maxx - w); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1094 if (y + h >= maxy) |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1095 y = MAX(0, maxy - h); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1096 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1097 w = MIN(w, maxx); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1098 h = MIN(h, maxy); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1099 node->window = newwin(h + shadow, w + shadow, y, x); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1100 copy_win(widget, node); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1101 } |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1102 #endif |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1103 |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1104 node->panel = new_panel(node->window); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1105 set_panel_userptr(node->panel, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1106 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1107 if (!transient) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1108 if (node->me != wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1109 GntWidget *w = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1110 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1111 if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1112 w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1113 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1114 wm->list = g_list_append(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1115 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1116 if (wm->event_stack) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1117 wm->ordered = g_list_prepend(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1118 else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1119 wm->ordered = g_list_append(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1120 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1121 gnt_widget_set_focus(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1122 if (w) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1123 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1124 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1125 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1126 if (wm->event_stack || node->me == wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1127 gnt_wm_raise_window(wm, node->me); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1128 } else { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1129 bottom_panel(node->panel); /* New windows should not grab focus */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1130 gnt_widget_set_urgent(node->me); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1131 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1132 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1133 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1134 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1135 void gnt_wm_new_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1136 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1137 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1138 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1139 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1140 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_INVISIBLE) || |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1141 g_hash_table_lookup(wm->nodes, widget)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1142 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1143 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1144 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1145 |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1146 if (GNT_IS_BOX(widget)) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1147 const char *title = GNT_BOX(widget)->title; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1148 GntPosition *p = NULL; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1149 if (title && (p = g_hash_table_lookup(wm->positions, title)) != NULL) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1150 sanitize_position(widget, &p->x, &p->y); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1151 gnt_widget_set_position(widget, p->x, p->y); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1152 mvwin(widget->window, p->y, p->x); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1153 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1154 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1155 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1156 g_signal_emit(wm, signals[SIG_NEW_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1157 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1158 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1159 if (wm->windows && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1160 if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && wm->_list.window != widget |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1161 && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1162 gnt_tree_add_row_last(GNT_TREE(wm->windows->tree), widget, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1163 gnt_tree_create_row(GNT_TREE(wm->windows->tree), GNT_BOX(widget)->title), |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1164 NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1165 update_window_in_list(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1166 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1167 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1168 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1169 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1170 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1171 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1172 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1173 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1174 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1175 g_signal_emit(wm, signals[SIG_DECORATE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1176 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1177 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1178 void gnt_wm_window_close(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1179 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1180 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1181 int pos; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1182 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1183 if ((node = g_hash_table_lookup(wm->nodes, widget)) == NULL) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1184 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1185 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1186 g_signal_emit(wm, signals[SIG_CLOSE_WIN], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1187 g_hash_table_remove(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1188 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1189 if (wm->windows) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1190 gnt_tree_remove(GNT_TREE(wm->windows->tree), widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1191 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1192 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1193 pos = g_list_index(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1194 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1195 if (pos != -1) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1196 wm->list = g_list_remove(wm->list, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1197 wm->ordered = g_list_remove(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1198 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1199 if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1200 gnt_wm_raise_window(wm, wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1201 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1202 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1203 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1204 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1205 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1206 |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1207 time_t gnt_wm_get_idle_time() |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1208 { |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1209 return time(NULL) - last_active_time; |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1210 } |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1211 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1212 void gnt_wm_process_input(GntWM *wm, const char *keys) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1213 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1214 keys = gnt_bindable_remap_keys(GNT_BINDABLE(wm), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1215 |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1216 idle_update = TRUE; |
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1217 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1218 if (gnt_bindable_perform_action_key(GNT_BINDABLE(wm), keys)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1219 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1220 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1221 /* Do some manual checking */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1222 if (wm->ordered && wm->mode != GNT_KP_MODE_NORMAL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1223 int xmin = 0, ymin = 0, xmax = getmaxx(stdscr), ymax = getmaxy(stdscr) - 1; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1224 int x, y, w, h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1225 GntWidget *widget = GNT_WIDGET(wm->ordered->data); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1226 int ox, oy, ow, oh; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1227 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1228 gnt_widget_get_position(widget, &x, &y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1229 gnt_widget_get_size(widget, &w, &h); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1230 ox = x; oy = y; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1231 ow = w; oh = h; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1232 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1233 if (wm->mode == GNT_KP_MODE_MOVE) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1234 if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1235 if (x > xmin) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1236 x--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1237 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1238 if (x + w < xmax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1239 x++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1240 } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1241 if (y > ymin) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1242 y--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1243 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1244 if (y + h < ymax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1245 y++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1246 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1247 if (ox != x || oy != y) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1248 gnt_screen_move_widget(widget, x, y); |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1249 window_reverse(widget, TRUE, wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1250 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1251 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1252 } else if (wm->mode == GNT_KP_MODE_RESIZE) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1253 if (strcmp(keys, GNT_KEY_LEFT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1254 w--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1255 } else if (strcmp(keys, GNT_KEY_RIGHT) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1256 if (x + w < xmax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1257 w++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1258 } else if (strcmp(keys, GNT_KEY_UP) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1259 h--; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1260 } else if (strcmp(keys, GNT_KEY_DOWN) == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1261 if (y + h < ymax) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1262 h++; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1263 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1264 if (oh != h || ow != w) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1265 gnt_screen_resize_widget(widget, w, h); |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1266 window_reverse(widget, TRUE, wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1267 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1268 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1269 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1270 if (strcmp(keys, "\r") == 0 || strcmp(keys, "\033") == 0) { |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1271 window_reverse(widget, FALSE, wm); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1272 wm->mode = GNT_KP_MODE_NORMAL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1273 } |
14958
c9c1ce4a70b6
[gaim-migrate @ 17737]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14904
diff
changeset
|
1274 return; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1275 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1276 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1277 wm->event_stack = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1278 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1279 /* Escape to close the window-list or action-list window */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1280 if (strcmp(keys, "\033") == 0) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1281 if (wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1282 gnt_widget_destroy(wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1283 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1284 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1285 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1286 } else if (keys[0] == '\033' && isdigit(keys[1]) && keys[2] == '\0') { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1287 /* Alt+x for quick switch */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1288 int n = *(keys + 1) - '0'; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1289 GList *list = NULL; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1290 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1291 if (n == 0) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1292 n = 10; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1293 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1294 list = g_list_append(list, GINT_TO_POINTER(n - 1)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1295 switch_window_n(GNT_BINDABLE(wm), list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1296 g_list_free(list); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1297 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1298 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1299 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1300 if (wm->menu) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1301 gnt_widget_key_pressed(GNT_WIDGET(wm->menu), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1302 else if (wm->_list.window) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1303 gnt_widget_key_pressed(wm->_list.window, keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1304 else if (wm->ordered) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1305 gnt_widget_key_pressed(GNT_WIDGET(wm->ordered->data), keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1306 wm->event_stack = FALSE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1307 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1308 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1309 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1310 gnt_wm_win_resized(GntWM *wm, GntNode *node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1311 { |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1312 /*refresh_node(node->me, node, NULL);*/ |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1313 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1314 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1315 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1316 gnt_wm_win_moved(GntWM *wm, GntNode *node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1317 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1318 refresh_node(node->me, node, NULL); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1319 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1320 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1321 void gnt_wm_resize_window(GntWM *wm, GntWidget *widget, int width, int height) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1322 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1323 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1324 GntNode *node; |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1325 int shadow; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1326 int maxx, maxy; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1327 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1328 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1329 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1330 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1331 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1332 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1333 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1334 g_signal_emit(wm, signals[SIG_CONFIRM_RESIZE], 0, widget, &width, &height, &ret); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1335 if (!ret) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1336 return; /* resize is not permitted */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1337 hide_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1338 gnt_widget_set_size(widget, width, height); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1339 gnt_widget_draw(widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1340 |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1341 shadow = gnt_widget_has_shadow(widget) ? 1 : 0; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1342 maxx = getmaxx(stdscr) - shadow; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1343 maxy = getmaxy(stdscr) - 1 - shadow; |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1344 height = MIN(height, maxy); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1345 width = MIN(width, maxx); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1346 wresize(node->window, height + shadow, width + shadow); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1347 replace_panel(node->panel, node->window); |
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1348 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1349 g_signal_emit(wm, signals[SIG_RESIZED], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1350 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1351 show_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1352 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1353 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1354 |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1355 static void |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1356 write_gdi(gpointer key, gpointer value, gpointer data) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1357 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1358 GntPosition *p = value; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1359 fprintf(data, ".%s = %d;%d\n", key, p->x, p->y); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1360 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1361 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1362 static gboolean |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1363 write_already(gpointer data) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1364 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1365 GntWM *wm = data; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1366 FILE *file; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1367 char *filename; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1368 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1369 filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1370 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1371 file = fopen(filename, "wb"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1372 if (file == NULL) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1373 g_printerr("GntWM: error opening file to save positions\n"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1374 } else { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1375 fprintf(file, "[positions]\n"); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1376 g_hash_table_foreach(wm->positions, write_gdi, file); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1377 fclose(file); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1378 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1379 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1380 g_free(filename); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1381 g_source_remove(write_timeout); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1382 write_timeout = 0; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1383 return FALSE; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1384 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1385 |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1386 static void |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1387 write_positions_to_file(GntWM *wm) |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1388 { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1389 if (write_timeout) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1390 g_source_remove(write_timeout); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1391 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1392 write_timeout = g_timeout_add(10000, write_already, wm); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1393 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1394 |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1395 void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1396 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1397 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1398 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1399 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1400 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1401 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1402 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1403 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1404 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1405 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1406 g_signal_emit(wm, signals[SIG_CONFIRM_MOVE], 0, widget, &x, &y, &ret); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1407 if (!ret) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1408 return; /* resize is not permitted */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1409 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1410 gnt_widget_set_position(widget, x, y); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1411 move_panel(node->panel, y, x); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1412 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1413 g_signal_emit(wm, signals[SIG_MOVED], 0, node); |
15067
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1414 if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE) && GNT_IS_BOX(widget)) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1415 const char *title = GNT_BOX(widget)->title; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1416 if (title) { |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1417 GntPosition *p = g_new0(GntPosition, 1); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1418 GntWidget *wid = node->me; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1419 p->x = wid->priv.x; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1420 p->y = wid->priv.y; |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1421 g_hash_table_replace(wm->positions, g_strdup(title), p); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1422 write_positions_to_file(wm); |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1423 } |
d08d7b7375c7
[gaim-migrate @ 17851]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14958
diff
changeset
|
1424 } |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1425 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1426 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1427 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1428 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1429 static void |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1430 gnt_wm_give_focus(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1431 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1432 GntNode *node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1433 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1434 if (!node) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1435 return; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1436 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1437 if (widget != wm->_list.window && !GNT_IS_MENU(widget) && |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1438 wm->ordered->data != widget) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1439 GntWidget *w = wm->ordered->data; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1440 wm->ordered = g_list_bring_to_front(wm->ordered, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1441 gnt_widget_set_focus(w, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1442 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1443 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1444 gnt_widget_set_focus(widget, TRUE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1445 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_URGENT); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1446 gnt_widget_draw(widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1447 top_panel(node->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1448 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1449 if (wm->_list.window) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1450 GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1451 top_panel(nd->panel); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1452 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1453 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1454 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1455 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1456 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1457 void gnt_wm_update_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1458 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1459 GntNode *node; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1460 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1461 while (widget->parent) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1462 widget = widget->parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1463 if (!GNT_IS_MENU(widget)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1464 gnt_box_sync_children(GNT_BOX(widget)); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1465 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1466 node = g_hash_table_lookup(wm->nodes, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1467 if (node == NULL) { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1468 gnt_wm_new_window(wm, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1469 } else |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1470 g_signal_emit(wm, signals[SIG_UPDATE_WIN], 0, node); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1471 |
15741
50c25be2563b
Better handle large windows that don't fit into the screen (eg. the preference
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15739
diff
changeset
|
1472 copy_win(widget, node); |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1473 update_screen(wm); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1474 draw_taskbar(wm, FALSE); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1475 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1476 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1477 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1478 { |
15739
73219517f583
gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
15652
diff
changeset
|
1479 idle_update = TRUE; |
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1480 gboolean ret = TRUE; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1481 g_signal_emit(wm, signals[SIG_MOUSE_CLICK], 0, event, x, y, widget, &ret); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1482 return ret; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1483 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1484 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1485 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1486 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1487 g_signal_emit(wm, signals[SIG_GIVE_FOCUS], 0, widget); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1488 } |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1489 |