comparison console/libgnt/wms/s.c @ 14335:b1b76fb9c739

[gaim-migrate @ 17031] Add a sample window-manager. This one removes the border and shadows from the buddylist, shows the conversation windows at the right-end of the screen, and puts all the rest of the dialogs in the middle of the screen. I was not planning on committing this just yet, but I accidentally included the change in configure.ac, and I don't want to get yelled at ;) committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 25 Aug 2006 18:21:22 +0000
parents
children 0387a167f342
comparison
equal deleted inserted replaced
14334:17eba43f98a9 14335:b1b76fb9c739
1 #include "gntbox.h"
2 #include "gntwm.h"
3
4 #include <string.h>
5
6 static PANEL *
7 s_new_window(GntWidget *win)
8 {
9 int x, y, w, h;
10 int maxx, maxy;
11 const char *name;
12
13 getmaxyx(stdscr, maxy, maxx);
14
15 gnt_widget_get_position(win, &x, &y);
16 gnt_widget_get_size(win, &w, &h);
17
18 name = gnt_widget_get_name(win);
19
20 if (name && strcmp(name, "buddylist") == 0) {
21 /* The buddylist doesn't have no border nor nothing! */
22 x = 0;
23 y = 0;
24 h = maxy - 1;
25
26 gnt_box_set_toplevel(GNT_BOX(win), FALSE);
27 GNT_WIDGET_SET_FLAGS(win, GNT_WIDGET_CAN_TAKE_FOCUS);
28 gnt_box_readjust(GNT_BOX(win));
29
30 gnt_widget_set_position(win, x, y);
31 mvwin(win->window, y, x);
32
33 gnt_widget_set_size(win, w, h);
34 } else if (name && strcmp(name, "conversation-window") == 0) {
35 /* Put the conversation windows to the far-right */
36 x = maxx - w;
37 y = 0;
38 gnt_widget_set_position(win, x, y);
39 mvwin(win->window, y, x);
40 } else if (!GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_TRANSIENT)) {
41 /* In the middle of the screen */
42 x = (maxx - w) / 2;
43 y = (maxy - h) / 2;
44
45 gnt_widget_set_position(win, x, y);
46 mvwin(win->window, y, x);
47 }
48
49 return new_panel(win->window);
50 }
51
52 void gntwm_init(GntWM *wm)
53 {
54 wm->new_window = s_new_window;
55 }
56