From d6feaa1c752b6bf9f4d18ce164e3ebe3159838df Mon Sep 17 00:00:00 2001 From: kojima Date: Wed, 6 Jun 2001 19:48:31 +0000 Subject: [PATCH] added None option to MoveDisplay and ResizeDisplay fixed window instance enumeration bug --- src/WindowMaker.h | 2 +- src/application.c | 60 +++++++++++++++++++++++++++-------------------- src/application.h | 2 ++ src/defaults.c | 1 + src/dialog.c | 2 +- src/framewin.c | 6 ++--- src/moveres.c | 14 +++++++---- 7 files changed, 52 insertions(+), 35 deletions(-) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 6092ef0f..49a7da48 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -151,7 +151,7 @@ typedef enum { #define WDIS_CENTER 1 /* center of screen */ #define WDIS_TOPLEFT 2 /* top left corner of screen */ #define WDIS_FRAME_CENTER 3 /* center of the frame */ - +#define WDIS_NONE 4 /* keyboard input focus mode */ #define WKF_CLICK 0 diff --git a/src/application.c b/src/application.c index b0f66143..d3acb0d8 100644 --- a/src/application.c +++ b/src/application.c @@ -433,6 +433,40 @@ wApplicationCreate(WScreen *scr, Window main_window) extractClientIcon(wapp->app_icon); } + /* set the application instance index */ + { + WApplication *list = scr->wapp_list; + int index = 0; + WWindow *wwin = wapp->main_window_desc; +/* + if (!WFLAGP(wwin, collapse_appicons)) + return 0; + */ + + /* look for a free index # */ + while (list) { + if (strcmp(wwin->wm_instance, + list->main_window_desc->wm_instance) == 0 + && + strcmp(wwin->wm_class, + list->main_window_desc->wm_class) == 0) { + + if (list->index == index) { + index++; + + /* restart list traversal */ + list = scr->wapp_list; + continue; + } + } + + list = list->next; + } + + wapp->index = index; + } + + wSoundPlay(WSOUND_APPSTART); #ifdef DEBUG @@ -551,30 +585,6 @@ wApplicationSetCollapse(WApplication *app, Bool flag) int wApplicationIndexOfGroup(WApplication *app) { - WApplication *list = app->main_window_desc->screen_ptr->wapp_list; - int index = 0; - WWindow *wwin = app->main_window_desc; -/* - if (!WFLAGP(wwin, collapse_appicons)) - return 0; - */ - - while (list) { - if (app == list) - return index; - - if (strcmp(wwin->wm_instance, - list->main_window_desc->wm_instance) == 0 - && - strcmp(wwin->wm_class, - list->main_window_desc->wm_class) == 0) - index++; - - list = list->next; - } - - puts("OH SHIT!?!?!? HOW THE FUCK DID WE GET HERE!?!?!?!?!"); - - return 0; + return app->index; } diff --git a/src/application.h b/src/application.h index 9d80667c..ecbf10cd 100644 --- a/src/application.h +++ b/src/application.h @@ -36,6 +36,8 @@ typedef struct WApplication { struct WAppIcon *app_icon; + int index; + int refcount; struct WWindow *last_focused; /* focused window before hide */ diff --git a/src/defaults.c b/src/defaults.c index 9136e7bc..2ced103d 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -245,6 +245,7 @@ static WOptionEnumeration sePlacements[] = { }; static WOptionEnumeration seGeomDisplays[] = { + {"None", WDIS_NONE, 0}, {"Center", WDIS_CENTER, 0}, {"Corner", WDIS_TOPLEFT, 0}, {"Floating", WDIS_FRAME_CENTER, 0}, diff --git a/src/dialog.c b/src/dialog.c index 2f234d4b..07e806b9 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -508,7 +508,7 @@ keyPressHandler(XEvent *event, void *data) int didx; int item; WMList *list = NULL; - + if (event->type == KeyRelease) return; diff --git a/src/framewin.c b/src/framewin.c index 57e1b400..86b1105a 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -1229,16 +1229,16 @@ wFrameWindowChangeTitle(WFrameWindow *fwin, char *new_title) if (fwin->title) wfree(fwin->title); - + fwin->title = wstrdup(new_title); - + if (fwin->titlebar) { XClearWindow(dpy, fwin->titlebar->window); wFrameWindowPaint(fwin); } checkTitleSize(fwin); - + return 1; } diff --git a/src/moveres.c b/src/moveres.c index fcde72da..6beac400 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -49,7 +49,7 @@ /* How many different types of geometry/position display thingies are there? */ -#define NUM_DISPLAYS 4 +#define NUM_DISPLAYS 5 #define LEFT 1 #define RIGHT 2 @@ -167,7 +167,8 @@ cyclePositionDisplay(WWindow *wwin, int x, int y, int w, int h) wPreferences.move_display++; wPreferences.move_display %= NUM_DISPLAYS; - if (wPreferences.move_display == WDIS_NEW) { + if (wPreferences.move_display == WDIS_NEW + || wPreferences.move_display == WDIS_NONE) { WMUnmapWidget(scr->gview); } else { if (wPreferences.move_display == WDIS_CENTER) { @@ -188,7 +189,8 @@ mapPositionDisplay(WWindow *wwin, int x, int y, int w, int h) { WScreen *scr = wwin->screen_ptr; - if (wPreferences.move_display == WDIS_NEW) { + if (wPreferences.move_display == WDIS_NEW + || wPreferences.move_display == WDIS_NONE) { return; } else if (wPreferences.move_display == WDIS_CENTER) { moveGeometryDisplayCentered(scr, scr->scr_width / 2, @@ -350,7 +352,8 @@ cycleGeometryDisplay(WWindow *wwin, int x, int y, int w, int h, int dir) wPreferences.size_display++; wPreferences.size_display %= NUM_DISPLAYS; - if (wPreferences.size_display == WDIS_NEW) { + if (wPreferences.size_display == WDIS_NEW + || wPreferences.size_display == WDIS_NONE) { WMUnmapWidget(scr->gview); } else { if (wPreferences.size_display == WDIS_CENTER) { @@ -372,7 +375,8 @@ mapGeometryDisplay(WWindow *wwin, int x, int y, int w, int h) { WScreen *scr = wwin->screen_ptr; - if (wPreferences.size_display == WDIS_NEW) + if (wPreferences.size_display == WDIS_NEW + || wPreferences.size_display == WDIS_NONE) return; if (wPreferences.size_display == WDIS_CENTER) {