Enlightenment CVS committal Author : handyande Project : misc Module : engage
Dir : misc/engage/src Modified Files: Makefile.am config.c engage.h window.c Log Message: Xinerama and partial strut support thanks very much to Rick Yorgason (Skorpion) =================================================================== RCS file: /cvsroot/enlightenment/misc/engage/src/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- Makefile.am 7 Oct 2004 10:39:45 -0000 1.10 +++ Makefile.am 14 Oct 2004 22:38:59 -0000 1.11 @@ -26,7 +26,11 @@ e_file.c \ e_apps.c - +if XINERAMA engage_LDADD = @evas_libs@ @edje_libs@ @ecore_libs@ @imlib2_libs@ @ewl_libs@ \ - @esmart_libs@ -lesmart_trans_x11 - + @esmart_libs@ -lesmart_trans_x11 -lXinerama +engage_CFLAGS = -DXINERAMA +else +engage_LDADD = @evas_libs@ @edje_libs@ @ecore_libs@ @imlib2_libs@ @ewl_libs@ \ + @esmart_libs@ -lesmart_trans_x11 +endif =================================================================== RCS file: /cvsroot/enlightenment/misc/engage/src/config.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -3 -r1.46 -r1.47 --- config.c 13 Oct 2004 17:41:47 -0000 1.46 +++ config.c 14 Oct 2004 22:38:59 -0000 1.47 @@ -97,6 +97,14 @@ ecore_config_int_create_bound("engage.options.mode", OM_BELOW, 0, 1, 1, 'm', "mode", "The display mode, 0 = ontop + shaped, 1 = below + transp"); + + ecore_config_int_create("engage.options.reserve", 52, 'R', "reserve", + "The amount of space reserved at the bottom of the screen"); +#ifdef XINERAMA + ecore_config_int_create("engage.options.head", 0, 'X', "head", + "Which Xinerama head to display the docker on"); +#endif + ecore_config_boolean_create("engage.options.grab_min_icons", 0, 'g', "grab-min", "Capture the icons of minimised applications"); @@ -146,6 +154,12 @@ options.theme = ecore_config_theme_get("engage.options.theme"); ecore_config_listen("theme", "engage.options.theme", theme_listener, 0, NULL); options.mode = ecore_config_int_get("engage.options.mode"); + + options.reserve = ecore_config_int_get("engage.options.reserve"); +#ifdef XINERAMA + options.head = ecore_config_int_get("engage.options.head"); +#endif + options.grab_min_icons = ecore_config_boolean_get("engage.options.grab_min_icons"); options.grab_app_icons = =================================================================== RCS file: /cvsroot/enlightenment/misc/engage/src/engage.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- engage.h 13 Oct 2004 13:45:56 -0000 1.25 +++ engage.h 14 Oct 2004 22:38:59 -0000 1.26 @@ -82,7 +82,10 @@ OD_Window *od_wm_window_prev_by_window_class_get(const char *); struct _OD_Options { - int width, height, zoom; + int width, height, reserve, zoom; +#ifdef XINERAMA + int head; +#endif char *icon_path, *theme, *engine; OD_Mode mode; int grab_min_icons, grab_app_icons; =================================================================== RCS file: /cvsroot/enlightenment/misc/engage/src/window.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- window.c 6 Oct 2004 15:20:19 -0000 1.24 +++ window.c 14 Oct 2004 22:38:59 -0000 1.25 @@ -6,6 +6,9 @@ #include <X11/Xatom.h> #include <X11/Xutil.h> #include <X11/Xlib.h> +#ifdef XINERAMA +#include <X11/extensions/Xinerama.h> +#endif #ifdef DMALLOC #include "dmalloc.h" #endif @@ -136,24 +139,56 @@ od_window_init() { Ecore_X_Display *dsp; - Screen *scr; - int def; + int x, y, xinerama; int res_x, res_y; Evas_Object *o; Evas_Object *eventer; + xinerama = 1; fullheight = options.height; // determine the desktop size dsp = ecore_x_display_get(); - def = DefaultScreen(dsp); - scr = ScreenOfDisplay(dsp, def); - res_x = scr->width; - res_y = scr->height; +#ifdef XINERAMA + XineramaScreenInfo *screen_info; + int num_screens; + + { + int event_base, error_base; + + if(XineramaQueryExtension(dsp, &event_base, &error_base) && + (screen_info = XineramaQueryScreens(dsp, &num_screens))) { + // Double check that the selected head is valid + if(options.head >= num_screens) { + fprintf(stderr, "Head %d does not exist; defaulting to head 0\n", options.head); + options.head = 0; + } + + res_x = screen_info[options.head].width; + x = screen_info[options.head].x_org; + res_y = screen_info[options.head].height; + y = screen_info[options.head].y_org; + } else + xinerama = 0; + } +#else + xinerama = 0; +#endif + + if(!xinerama) { + Screen *scr; + int def; + def = DefaultScreen(dsp); + scr = ScreenOfDisplay(dsp, def); + res_x = scr->width; + x = 0; + res_y = scr->height; + y = 0; + } if (!(strcmp(options.engine, "gl"))) ee = ecore_evas_gl_x11_new(NULL, 0, - (int) ((res_x - options.width) / 2.0), - (int) (res_y - options.height), + (int) ((res_x - options.width) / 2.0 + x), + (int) (res_y - options.height + y), options.width, options.height); else { if (strcmp(options.engine, "software")) { @@ -162,8 +197,8 @@ fprintf(stderr, " Defaulting to software engine.\n"); } ee = ecore_evas_software_x11_new(NULL, 0, - (int) ((res_x - options.width) / 2.0), - (int) (res_y - options.height), + (int) ((res_x - options.width) / 2.0 + x), + (int) (res_y - options.height + y), options.width, options.height); } @@ -200,10 +235,53 @@ od_window = ecore_evas_software_x11_window_get(ee); ecore_x_window_prop_xy_set(od_window, - (int) ((res_x - options.width) / 2.0), - (int) (res_y - options.height)); + (int) ((res_x - options.width) / 2.0 + x), + (int) (res_y - options.height + y)); ecore_x_window_prop_window_type_set(od_window, ECORE_X_WINDOW_TYPE_DOCK); ecore_x_window_prop_sticky_set(od_window, 1); + + // Reserve a strut + if(options.reserve > 0) { + // Double check that there isn't a head below the selected head +#ifdef XINERAMA + bool valid = true; + + if(xinerama) { + int i; + for(i=0; i < num_screens; i++) { + if(i != options.head && + ((screen_info[i].x_org >= screen_info[options.head].x_org && + screen_info[i].x_org < screen_info[options.head].x_org + + screen_info[options.head].width) || + (screen_info[i].x_org + screen_info[i].width + >= screen_info[options.head].x_org && + screen_info[i].x_org + screen_info[i].width + < screen_info[options.head].x_org + + screen_info[options.head].width)) && + screen_info[i].y_org > screen_info[options.head].y_org + + screen_info[options.head].height - options.reserve) { + fprintf(stderr, "Another head is below the selected head; no space will be reserved"); + valid = false; + i = num_screens; + } + } + } + + if(valid) { +#endif + unsigned long struts[12] = { 0, 0, 0, options.reserve, 0, 0, 0, 0, 0, 0, + (res_x - options.width) / 2.0 + x, + (res_x - options.width ) / 2.0 + + options.width + x }; + ecore_x_window_prop_property_set(od_window, XInternAtom(dsp, "_NET_WM_STRUT_PARTIAL", False), + XA_CARDINAL, 32, struts, 12); + ecore_x_window_prop_property_set(od_window, XInternAtom(dsp, "_NET_WM_STRUT", False), + XA_CARDINAL, 32, struts, 4); +#ifdef XINERAMA + } +#endif + } + if (options.mode == OM_ONTOP) ecore_x_window_prop_layer_set(od_window, ECORE_X_WINDOW_LAYER_ABOVE); else ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs