comparison console/libgnt/gntmain.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 985e5e3f6f2c
children 0387a167f342
comparison
equal deleted inserted replaced
14334:17eba43f98a9 14335:b1b76fb9c739
1 #ifdef HAVE_NCURSESW_INC 1 #ifdef HAVE_NCURSESW_INC
2 #include <ncursesw/panel.h> 2 #include <ncursesw/panel.h>
3 #else 3 #else
4 #include <panel.h> 4 #include <panel.h>
5 #endif 5 #endif
6
7 #include <gmodule.h>
6 8
7 #include "gnt.h" 9 #include "gnt.h"
8 #include "gntbox.h" 10 #include "gntbox.h"
9 #include "gntcolors.h" 11 #include "gntcolors.h"
10 #include "gntkeys.h" 12 #include "gntkeys.h"
11 #include "gntstyle.h" 13 #include "gntstyle.h"
12 #include "gnttree.h" 14 #include "gnttree.h"
15 #include "gntwm.h"
13 16
14 #include <stdio.h> 17 #include <stdio.h>
15 #include <stdlib.h> 18 #include <stdlib.h>
16 #include <locale.h> 19 #include <locale.h>
17 #include <unistd.h> 20 #include <unistd.h>
35 static int Y_MIN; 38 static int Y_MIN;
36 static int Y_MAX; 39 static int Y_MAX;
37 40
38 static gboolean ascii_only; 41 static gboolean ascii_only;
39 static gboolean mouse_enabled; 42 static gboolean mouse_enabled;
43
44 static GntWM wm;
40 45
41 static GMainLoop *loop; 46 static GMainLoop *loop;
42 static struct 47 static struct
43 { 48 {
44 GntWidget *window; 49 GntWidget *window;
844 849
845 signal(SIGWINCH, sighandler); 850 signal(SIGWINCH, sighandler);
846 } 851 }
847 #endif 852 #endif
848 853
854 static void
855 init_wm()
856 {
857 const char *name = gnt_style_get(GNT_STYLE_WM);
858 gpointer handle;
859
860 if (!name || !*name)
861 return;
862
863 handle = g_module_open(name, G_MODULE_BIND_LAZY);
864 if (handle) {
865 gboolean (*init)(GntWM *);
866 if (g_module_symbol(handle, "gntwm_init", &init)) {
867 init(&wm);
868 }
869 }
870 }
871
849 void gnt_init() 872 void gnt_init()
850 { 873 {
851 static GIOChannel *channel = NULL; 874 static GIOChannel *channel = NULL;
852 char *filename; 875 char *filename;
853 int result; 876 int result;
913 #ifdef SIGWINCH 936 #ifdef SIGWINCH
914 signal(SIGWINCH, sighandler); 937 signal(SIGWINCH, sighandler);
915 #endif 938 #endif
916 939
917 g_type_init(); 940 g_type_init();
941
942 init_wm();
918 } 943 }
919 944
920 void gnt_main() 945 void gnt_main()
921 { 946 {
922 loop = g_main_loop_new(NULL, FALSE); 947 loop = g_main_loop_new(NULL, FALSE);
997 1022
998 gnt_box_sync_children(GNT_BOX(widget)); 1023 gnt_box_sync_children(GNT_BOX(widget));
999 node = g_hash_table_lookup(nodes, widget); 1024 node = g_hash_table_lookup(nodes, widget);
1000 if (node && !node->panel) 1025 if (node && !node->panel)
1001 { 1026 {
1002 node->panel = new_panel(node->me->window); 1027 if (wm.new_window)
1028 node->panel = wm.new_window(node->me);
1029 else
1030 node->panel = new_panel(node->me->window);
1003 if (!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT)) 1031 if (!GNT_WIDGET_IS_FLAG_SET(node->me, GNT_WIDGET_TRANSIENT))
1004 { 1032 {
1005 bottom_panel(node->panel); /* New windows should not grab focus */ 1033 bottom_panel(node->panel); /* New windows should not grab focus */
1006 gnt_widget_set_urgent(node->me); 1034 gnt_widget_set_urgent(node->me);
1007 } 1035 }