From: <enl...@li...> - 2001-04-08 02:24:13
|
Enlightenment CVS committal Author : raster Project : e17 Module : apps/e Dir : e17/apps/e/src Modified Files: main.c view.c Log Message: detect other wm's.... :) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/main.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- main.c 2001/03/18 01:16:47 1.12 +++ main.c 2001/04/08 02:24:13 1.13 @@ -1,4 +1,5 @@ #include "e.h" +#include <X11/Xproto.h> #ifdef E_PROF Evas_List __e_profiles = NULL; @@ -24,12 +25,23 @@ UN(data); } +static void wm_running_error(Display * d, XErrorEvent * ev); +static void +wm_running_error(Display * d, XErrorEvent * ev) +{ + if ((ev->request_code == X_ChangeWindowAttributes) && (ev->error_code == BadAccess)) + { + fprintf(stderr, "A WM is alreayd running. no point running now is there?\n"); + exit(1); + } +} + void setup(void); void setup(void) { e_grab(); - e_window_set_events(0, XEV_CHILD_REDIRECT | XEV_PROPERTY | XEV_COLORMAP); + e_sync(); e_border_adopt_children(0); e_ungrab(); /* e_add_event_timer("timer", 0.02, ch_col, 0, NULL);*/ @@ -42,10 +54,23 @@ e_exec_set_args(argc, argv); e_config_init(); - e_display_init(NULL); + if (!e_display_init(NULL)) + { + fprintf(stderr, "cannot connect to display!\n"); + exit(1); + } e_ev_signal_init(); e_event_filter_init(); e_ev_x_init(); + + /* become a wm */ + e_grab(); + e_sync(); + e_set_error_handler(wm_running_error); + e_window_set_events(0, XEV_CHILD_REDIRECT | XEV_PROPERTY | XEV_COLORMAP); + e_sync(); + e_reset_error_handler(); + e_ungrab(); e_pack_object_init(); e_fs_init(); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/view.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- view.c 2001/04/07 18:27:00 1.32 +++ view.c 2001/04/08 02:24:13 1.33 @@ -788,8 +788,11 @@ /* v->monitor_id = efsd_start_monitor(e_fs_get_connection(), v->dir); */ v->monitor_id = efsd_start_monitor(e_fs_get_connection(), v->dir, - efsd_ops(2, efsd_op_get_stat(), - efsd_op_get_filetype())); + efsd_ops(2, + efsd_op_get_stat(), + efsd_op_get_filetype() + ) + ); v->is_listing = 1; v->changed = 1; } |