From 5873385d32a172333240b36b7f53d67f52069e54 Mon Sep 17 00:00:00 2001 From: kojima Date: Fri, 15 Feb 2002 21:30:42 +0000 Subject: [PATCH] fix for soemthing wrong with piped menus --- src/Makefile.am | 2 ++ src/actions.c | 9 ++++--- src/dialog.c | 80 +++++++++++++++++++++++++++++++++++++++++---------------- src/rootmenu.c | 3 ++- src/screen.c | 7 +++++ src/screen.h | 3 +-- src/window.c | 8 +++--- 7 files changed, 79 insertions(+), 33 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 96eccdcb..6159c78b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -80,6 +80,8 @@ wmaker_SOURCES = \ usermenu.h \ xdnd.h \ xdnd.c \ + xinerama.h \ + xinerama.c \ xmodifier.h \ xmodifier.c \ xutil.c \ diff --git a/src/actions.c b/src/actions.c index 478944da..58dd1341 100644 --- a/src/actions.c +++ b/src/actions.c @@ -48,6 +48,7 @@ #include "winspector.h" #include "workspace.h" #include "wsound.h" +#include "xinerama.h" #ifdef GNOME_STUFF # include "gnome.h" @@ -425,13 +426,13 @@ wMaximizeWindow(WWindow *wwin, int directions) && !(directions & MAX_IGNORE_XINERAMA)) { WScreen *scr = wwin->screen_ptr; WMRect rect; - - rect = wGetRectForHead(scr, wGetHeadForWindow(wwin)); + + rect = wGetRectForHead(scr, wGetHeadForPointerLocation(scr)); totalArea.x1 = rect.pos.x; totalArea.y1 = rect.pos.y; totalArea.x2 = totalArea.x1 + rect.size.width; totalArea.y2 = totalArea.y1 + rect.size.height; - + usableArea.x1 = WMAX(totalArea.x1, usableArea.x1); usableArea.y1 = WMAX(totalArea.y1, usableArea.y1); usableArea.x2 = WMIN(totalArea.x2, usableArea.x2); @@ -490,7 +491,7 @@ wMaximizeWindow(WWindow *wwin, int directions) wWindowCropSize(wwin, usableArea.x2-usableArea.x1, usableArea.y2-usableArea.y1, - &new_width, &new_height); + &new_width, &new_height); wWindowConfigure(wwin, new_x, new_y, new_width, new_height); diff --git a/src/dialog.c b/src/dialog.c index 09f4066c..bf5fcc0b 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -60,11 +60,31 @@ #include "window.h" #include "actions.h" #include "defaults.h" - +#include "xinerama.h" extern WPreferences wPreferences; +static WMPoint getCenter(WScreen *scr, int width, int height) +{ + WMPoint pt; + +#ifdef XINERAMA + WMRect rect; + + rect = wGetRectForHead(scr, wGetHeadForPointerLocation(scr)); + + pt.x = rect.pos.x + (rect.size.width - width)/2; + pt.y = rect.pos.y + (rect.size.height - height)/2; +#else + pt.x = (scr->scr_width - width) / 2; + pt.y = (scr->scr_height - height) / 2; +#endif + + return pt; +} + + int wMessageDialog(WScreen *scr, char *title, char *message, @@ -74,6 +94,7 @@ wMessageDialog(WScreen *scr, char *title, char *message, Window parent; WWindow *wwin; int result; + WMPoint center; panel = WMCreateAlertPanel(scr->wmscreen, NULL, title, message, defBtn, altBtn, othBtn); @@ -82,9 +103,10 @@ wMessageDialog(WScreen *scr, char *title, char *message, XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); - wwin = wManageInternalWindow(scr, parent, None, NULL, - (scr->scr_width - 400)/2, - (scr->scr_height - 180)/2, 400, 180); + + center = getCenter(scr, 400, 180); + wwin = wManageInternalWindow(scr, parent, None, NULL, center.x, center.y, + 400, 180); wwin->client_leader = WMWidgetXID(panel->win); WMMapWidget(panel->win); @@ -173,7 +195,7 @@ wInputDialog(WScreen *scr, char *title, char *message, char **text) Window parent; WMInputPanel *panel; char *result; - + WMPoint center; panel = WMCreateInputPanel(scr->wmscreen, NULL, title, message, *text, _("OK"), _("Cancel")); @@ -184,9 +206,9 @@ wInputDialog(WScreen *scr, char *title, char *message, char **text) XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); - wwin = wManageInternalWindow(scr, parent, None, NULL, - (scr->scr_width - 320)/2, - (scr->scr_height - 160)/2, 320, 160); + center = getCenter(scr, 320, 160); + wwin = wManageInternalWindow(scr, parent, None, NULL, center.x, center.y, + 320, 160); wwin->client_leader = WMWidgetXID(panel->win); @@ -753,6 +775,7 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class) char *tmp; int len = (instance ? strlen(instance) : 0) + (class ? strlen(class) : 0) + 32; + WMPoint center; tmp = wmalloc(len); @@ -761,9 +784,10 @@ wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class) else strcpy(tmp, _("Icon Chooser")); - wwin = wManageInternalWindow(scr, parent, None, tmp, - (scr->scr_width - 450)/2, - (scr->scr_height - 280)/2, 450, 280); + center = getCenter(scr, 450, 280); + + wwin = wManageInternalWindow(scr, parent, None, tmp, center.x,center.y, + 450, 280); wfree(tmp); } @@ -1319,7 +1343,7 @@ wShowInfoPanel(WScreen *scr) color2.red = 0x50; color2.green = 0x50; color2.blue = 0x70; - logo = renderText(scr->wmscreen, "GNU Window Maker", + logo = renderText(scr->wmscreen, "Window Maker", "-*-utopia-*-r-*-*-25-*", &color1, &color2); if (logo) { WMSetLabelImagePosition(panel->name1L, WIPImageOnly); @@ -1332,7 +1356,7 @@ wShowInfoPanel(WScreen *scr) WMReleaseFont(font); } WMSetLabelTextAlignment(panel->name1L, WACenter); - WMSetLabelText(panel->name1L, "GNU Window Maker"); + WMSetLabelText(panel->name1L, "Window Maker"); } panel->name2L = WMCreateLabel(panel->win); @@ -1473,9 +1497,13 @@ wShowInfoPanel(WScreen *scr) WMMapWidget(panel->win); - wwin = wManageInternalWindow(scr, parent, None, _("Info"), - (scr->scr_width - 382)/2, - (scr->scr_height - 230)/2, 382, 230); + { + WMPoint center = getCenter(scr, 382, 230); + + wwin = wManageInternalWindow(scr, parent, None, _("Info"), + center.x, center.y, + 382, 230); + } WSETUFLAG(wwin, no_closable, 0); WSETUFLAG(wwin, no_close_button, 0); @@ -1587,9 +1615,13 @@ wShowLegalPanel(WScreen *scr) XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); - wwin = wManageInternalWindow(scr, parent, None, _("Legal"), - (scr->scr_width - 420)/2, - (scr->scr_height - 250)/2, 420, 250); + { + WMPoint center = getCenter(scr, 420, 250); + + wwin = wManageInternalWindow(scr, parent, None, _("Legal"), + center.x, center.y, + 420, 250); + } WSETUFLAG(wwin, no_closable, 0); WSETUFLAG(wwin, no_close_button, 0); @@ -2003,9 +2035,13 @@ wShowGNUstepPanel(WScreen *scr) XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); - wwin = wManageInternalWindow(scr, parent, None, _("About GNUstep"), - (scr->scr_width - 325)/2, - (scr->scr_height - 200)/2, 325, 200); + { + WMPoint center = getCenter(scr, 325, 200); + + wwin = wManageInternalWindow(scr, parent, None, _("About GNUstep"), + center.x, center.y, + 325, 200); + } WSETUFLAG(wwin, no_closable, 0); WSETUFLAG(wwin, no_close_button, 0); diff --git a/src/rootmenu.c b/src/rootmenu.c index 74ef6b66..2f242174 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -1284,7 +1284,8 @@ readMenuPipe(WScreen *scr, char **file_name) strcat(flat_file, file_name[i]); strcat(flat_file, " "); } - filename = flat_file+1; + filename = flat_file + (flat_file[1]=='|'?2:1); + #ifdef USECPP if (!wPreferences.flags.nocpp) { diff --git a/src/screen.c b/src/screen.c index 2f1cd400..3ec878a4 100644 --- a/src/screen.c +++ b/src/screen.c @@ -63,6 +63,8 @@ # include "openlook.h" #endif +#include "xinerama.h" + #include #include "defaults.h" @@ -698,6 +700,11 @@ wScreenInit(int screen_number) wfree(scr); return NULL; } + +#ifdef XINERAMA + wInitXinerama(scr); +#endif + XDefineCursor(dpy, scr->root_win, wCursor[WCUR_ROOT]); diff --git a/src/screen.h b/src/screen.h index 9392823b..22f0ab2c 100644 --- a/src/screen.h +++ b/src/screen.h @@ -50,7 +50,6 @@ typedef struct WReservedArea { } WReservedArea; - typedef struct WAppIconChain { struct WAppIcon *aicon; struct WAppIconChain *next; @@ -97,7 +96,7 @@ typedef struct _WScreen { #ifdef XINERAMA XineramaScreenInfo *xine_screens; int xine_count; /* 0 means not active */ - int xine_primary_screen; /* main working screen */ + int xine_primary_head; /* main working screen */ #endif Window no_focus_win; /* window to get focus when nobody diff --git a/src/window.c b/src/window.c index 73c806d4..430430ed 100644 --- a/src/window.c +++ b/src/window.c @@ -482,13 +482,13 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace) wwin->user_flags.emulate_appicon = 0; //WSETUFLAG(wwin, emulate_appicon, 0); } - - if (wwin->transient_for!=None + + if (wwin->transient_for!=None && wwin->transient_for!=wwin->screen_ptr->root_win) wwin->user_flags.emulate_appicon = 0; //WSETUFLAG(wwin, emulate_appicon, 0); - - if (wwin->user_flags.sunken && wwin->defined_user_flags.sunken + + if (wwin->user_flags.sunken && wwin->defined_user_flags.sunken && wwin->user_flags.floating && wwin->defined_user_flags.floating) wwin->user_flags.sunken = 0; //WSETUFLAG(wwin, sunken, 0); -- 2.11.4.GIT