From 5178465bb604ba59c6657d056fdc5d2bcaf83588 Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Wed, 17 Mar 2010 17:44:14 +0100 Subject: [PATCH] Remove DEBUG statements, #if 0 etc ...and some other cleanups. --- src/appicon.c | 15 +------ src/application.c | 17 +------ src/client.c | 5 --- src/cycling.c | 4 -- src/defaults.c | 3 -- src/dock.c | 15 ------- src/event.c | 42 +++-------------- src/icon.c | 24 +--------- src/main.c | 72 +---------------------------- src/misc.c | 32 ------------- src/motif.c | 112 ++++++++-------------------------------------- src/moveres.c | 20 --------- src/placement.c | 41 +---------------- src/rootmenu.c | 7 +-- src/stacking.c | 13 ------ src/startup.c | 33 -------------- src/text.c | 79 +------------------------------- src/texture.c | 29 ------------ src/wconfig.h.in | 2 - src/window.c | 44 ------------------ util/wmgenmenu.c | 1 - 21 files changed, 34 insertions(+), 576 deletions(-) diff --git a/src/appicon.c b/src/appicon.c index 9368c9b4..75fc044b 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -453,13 +453,6 @@ static void iconDblClick(WObjDescriptor * desc, XEvent * event) assert(aicon->icon->owner != NULL); wapp = wApplicationOf(aicon->icon->owner->main_window); -#ifdef DEBUG0 - if (!wapp) { - wwarning("could not find application descriptor for app icon!!"); - return; - } -#endif - unhideHere = (event->xbutton.state & ShiftMask); /* go to the last workspace that the user worked on the app */ @@ -526,9 +519,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event) (*desc->handle_mousedown) (desc, event); return; } -#ifdef DEBUG - puts("Moving icon"); -#endif + if (event->xbutton.state & MOD_MASK) wLowerFrame(icon->core); else @@ -713,8 +704,4 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event) break; } } -#ifdef DEBUG - puts("End icon move"); -#endif - } diff --git a/src/application.c b/src/application.c index b2731f69..f19788b6 100644 --- a/src/application.c +++ b/src/application.c @@ -231,12 +231,8 @@ WApplication *wApplicationCreate(WWindow * wwin) WApplication *wapp; WWindow *leader; - if (main_window == None || main_window == scr->root_win) { -#ifdef DEBUG0 - wwarning("trying to create application for %x", (unsigned)main_window); -#endif + if (main_window == None || main_window == scr->root_win) return NULL; - } { Window root; @@ -397,11 +393,6 @@ WApplication *wApplicationCreate(WWindow * wwin) if (!tmp) extractClientIcon(wapp->app_icon); } - - -#ifdef DEBUG - printf("Created application for %x\n", (unsigned)main_window); -#endif return wapp; } @@ -463,10 +454,6 @@ void wApplicationDestroy(WApplication * wapp) } wfree(wapp); -#ifdef DEBUG - printf("Destroyed application for %x\n", (unsigned)main_window); -#endif - if (wPreferences.auto_arrange_icons) { + if (wPreferences.auto_arrange_icons) wArrangeIcons(scr, True); - } } diff --git a/src/client.c b/src/client.c index 718aef5d..a39e8e4c 100644 --- a/src/client.c +++ b/src/client.c @@ -466,11 +466,6 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event) case 7: break; } -#ifdef DEBUG - if (i) { - printf("window leader update caused state transition %i\n", i); - } -#endif if (wwin->wm_hints) { /* update icon */ diff --git a/src/cycling.c b/src/cycling.c index e1c951e3..94c511b9 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -113,10 +113,6 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl if (hasModifier) { keymap = XGetModifierMapping(dpy); - -#ifdef DEBUG - printf("Grabbing keyboard\n"); -#endif XGrabKeyboard(dpy, scr->root_win, False, GrabModeAsync, GrabModeAsync, CurrentTime); } diff --git a/src/defaults.c b/src/defaults.c index c807de97..6e588adc 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1070,9 +1070,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict) } if (plvalue) { -#ifdef DEBUG - printf("Updating %s to %s\n", entry->key, WMGetPropListDescription(plvalue, False)); -#endif /* convert data */ if ((*entry->convert) (scr, entry, plvalue, entry->addr, &tdata)) { /* diff --git a/src/dock.c b/src/dock.c index 0e932e8a..00f19341 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3358,9 +3358,6 @@ static void handleDockMove(WDock * dock, WAppIcon * aicon, XEvent * event) Pixmap ghost = None; int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */ -#ifdef DEBUG - puts("moving dock"); -#endif if (XGrabPointer(dpy, aicon->icon->core->window, True, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { @@ -3495,9 +3492,6 @@ static void handleDockMove(WDock * dock, WAppIcon * aicon, XEvent * event) XFreePixmap(dpy, ghost); XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel); } -#ifdef DEBUG - puts("End dock move"); -#endif } static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event) @@ -3525,9 +3519,6 @@ static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event) if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { -#ifdef DEBUG0 - wwarning("pointer grab failed for icon move"); -#endif } if (!(event->xbutton.state & MOD_MASK)) @@ -3705,9 +3696,6 @@ static Bool handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event) wDockHideIcons(scr->workspaces[i]->clip); } } -#ifdef DEBUG - puts("End icon move"); -#endif return hasMoved;; } } @@ -3818,9 +3806,6 @@ static void iconMouseDown(WObjDescriptor * desc, XEvent * event) XUnmapWindow(dpy, scr->clip_balloon); scr->flags.clip_balloon_mapped = 0; } -#ifdef DEBUG - puts("handling dock"); -#endif if (event->xbutton.button == Button1) { if (event->xbutton.state & MOD_MASK) wDockLower(dock); diff --git a/src/event.c b/src/event.c index 47ad7173..d29cafc4 100644 --- a/src/event.c +++ b/src/event.c @@ -558,9 +558,6 @@ static void handleMapRequest(XEvent * ev) WScreen *scr = NULL; Window window = ev->xmaprequest.window; -#ifdef DEBUG - printf("got map request for %x\n", (unsigned)window); -#endif if ((wwin = wWindowFor(window))) { if (wwin->flags.shaded) { wUnshadeWindow(wwin); @@ -635,9 +632,6 @@ static void handleDestroyNotify(XEvent * event) WScreen *scr = wScreenForRootWindow(event->xdestroywindow.event); int widx; -#ifdef DEBUG - printf("got destroy notify\n"); -#endif wwin = wWindowFor(window); if (wwin) { wUnmanageWindow(wwin, False, True); @@ -681,9 +675,6 @@ static void handleExpose(XEvent * event) WObjDescriptor *desc; XEvent ev; -#ifdef DEBUG - printf("got expose\n"); -#endif while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev)) ; if (XFindContext(dpy, event->xexpose.window, wWinContext, (XPointer *) & desc) == XCNOENT) { @@ -732,9 +723,6 @@ static void handleButtonPress(XEvent * event) WObjDescriptor *desc; WScreen *scr; -#ifdef DEBUG - printf("got button press\n"); -#endif scr = wScreenForRootWindow(event->xbutton.root); #ifdef BALLOON_TEXT @@ -802,9 +790,7 @@ static void handleButtonPress(XEvent * event) static void handleMapNotify(XEvent * event) { WWindow *wwin; -#ifdef DEBUG - printf("got map\n"); -#endif + wwin = wWindowFor(event->xmap.event); if (wwin && wwin->client_win == event->xmap.event) { if (wwin->flags.miniaturized) { @@ -823,9 +809,7 @@ static void handleUnmapNotify(XEvent * event) WWindow *wwin; XEvent ev; Bool withdraw = False; -#ifdef DEBUG - printf("got unmap\n"); -#endif + /* only process windows with StructureNotify selected * (ignore SubstructureNotify) */ wwin = wWindowFor(event->xunmap.window); @@ -872,9 +856,7 @@ static void handleUnmapNotify(XEvent * event) static void handleConfigureRequest(XEvent * event) { WWindow *wwin; -#ifdef DEBUG - printf("got configure request\n"); -#endif + if (!(wwin = wWindowFor(event->xconfigurerequest.window))) { /* * Configure request for unmapped window @@ -893,9 +875,6 @@ static void handlePropertyNotify(XEvent * event) int ji; unsigned int ju; WScreen *scr; -#ifdef DEBUG - printf("got property notify\n"); -#endif wwin = wWindowFor(event->xproperty.window); if (wwin) { @@ -916,9 +895,7 @@ static void handleClientMessage(XEvent * event) { WWindow *wwin; WObjDescriptor *desc; -#ifdef DEBUG - printf("got client message\n"); -#endif + /* handle transition from Normal to Iconic state */ if (event->xclient.message_type == _XA_WM_CHANGE_STATE && event->xclient.format == 32 && event->xclient.data.l[0] == IconicState) { @@ -1062,9 +1039,6 @@ static void handleEnterNotify(XEvent * event) WObjDescriptor *desc = NULL; XEvent ev; WScreen *scr = wScreenForRootWindow(event->xcrossing.root); -#ifdef DEBUG - printf("got enter notify\n"); -#endif if (XCheckTypedWindowEvent(dpy, event->xcrossing.window, LeaveNotify, &ev)) { /* already left the window... */ @@ -1163,9 +1137,7 @@ static void handleShapeNotify(XEvent * event) XShapeEvent *shev = (XShapeEvent *) event; WWindow *wwin; XEvent ev; -#ifdef DEBUG - printf("got shape notify\n"); -#endif + while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) { XShapeEvent *sev = (XShapeEvent *) & ev; @@ -1712,9 +1684,7 @@ static void handleMotionNotify(XEvent * event) p.x >= (rect.pos.x + rect.size.width - 2) || p.y <= (rect.pos.y + 1) || p.y >= (rect.pos.y + rect.size.height - 2)) { WMenu *menu; -#ifdef DEBUG - printf("pointer at screen edge\n"); -#endif + menu = wMenuUnderPointer(scr); if (menu != NULL) wMenuScroll(menu, event); diff --git a/src/icon.c b/src/icon.c index 79d82920..40ad0228 100644 --- a/src/icon.c +++ b/src/icon.c @@ -380,20 +380,6 @@ RImage *wIconValidateIconSize(WScreen * scr, RImage * icon) icon = tmp; } #endif -#if 0 - if (icon->width > wPreferences.icon_size || icon->height > wPreferences.icon_size) { - if (icon->width > icon->height) { - w = wPreferences.icon_size - 4; - h = w * icon->height / icon->width; - } else { - h = wPreferences.icon_size - 4; - w = h * icon->width / icon->height; - } - tmp = RScaleImage(icon, w, h); - RReleaseImage(icon); - icon = tmp; - } -#endif return icon; } @@ -803,9 +789,7 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event) miniwindowDblClick(desc, event); return; } -#ifdef DEBUG - puts("Moving miniwindow"); -#endif + if (event->xbutton.button == Button1) { if (event->xbutton.state & MOD_MASK) wLowerFrame(icon->core); @@ -831,9 +815,6 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event) if (XGrabPointer(dpy, icon->core->window, False, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { -#ifdef DEBUG0 - wwarning("pointer grab failed for icon move"); -#endif } while (1) { WMMaskEvent(dpy, PointerMotionMask | ButtonReleaseMask | ButtonPressMask @@ -875,9 +856,6 @@ static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event) wwin->icon_x = x; wwin->icon_y = y; -#ifdef DEBUG - puts("End miniwindow move"); -#endif XUngrabPointer(dpy, CurrentTime); if (wPreferences.auto_arrange_icons) diff --git a/src/main.c b/src/main.c index 3c9d9f9a..225ce4b9 100644 --- a/src/main.c +++ b/src/main.c @@ -436,9 +436,6 @@ void print_help() puts(_(" --create-stdcmap create the standard colormap hint in PseudoColor visuals")); puts(_(" --visual-id visualid visual id of visual to use")); puts(_(" --static do not update or save configurations")); -#ifdef DEBUG - puts(_(" --synchronous turn on synchronous display mode")); -#endif puts(_(" --version print version and exit")); puts(_(" --help show this message")); } @@ -450,11 +447,6 @@ void check_defaults() path = wdefaultspathfordomain("WindowMaker"); if (access(path, R_OK) != 0) { -#if 0 - wfatal(_("could not find user GNUstep directory (%s).\n" - "Make sure you have installed Window Maker correctly and run wmaker.inst"), path); - exit(1); -#else wwarning(_("could not find user GNUstep directory (%s)."), path); if (system("wmaker.inst --batch") != 0) { @@ -463,7 +455,6 @@ void check_defaults() } else { wwarning(_("%s directory created with default configuration."), path); } -#endif } wfree(path); @@ -514,13 +505,6 @@ static void execInitScript() if (system(file) != 0) { wsyserror(_("%s:could not execute initialization script"), file); } -#if 0 - if (fork() == 0) { - execl("/bin/sh", "/bin/sh", "-c", file, NULL); - wsyserror(_("%s:could not execute initialization script"), file); - exit(1); - } -#endif wfree(file); } } @@ -539,52 +523,10 @@ void ExecExitScript() if (system(file) != 0) { wsyserror(_("%s:could not execute exit script"), file); } -#if 0 - if (fork() == 0) { - execl("/bin/sh", "/bin/sh", "-c", file, NULL); - wsyserror(_("%s:could not execute exit script"), file); - exit(1); - } -#endif wfree(file); } } -#if 0 -char *getFullPath(char *path) -{ - char buffer[1024]; - char *tmp; - char *basep = (char *)buffer; - - if (*path != '/' && getcwd(buffer, 1023)) { - - for (;;) { - if (strncmp(path, "../", 3) == 0) { - path += 3; - basep = strchr(basep, '/'); - if (!basep || *path == 0) - break; - } - } - if (*path == '/' || strncmp(path, "./", 2) == 0) { - tmp =} - - /* - * path - * ./path - * ../path - * ../../path - */ - - } else { - return wstrconcat(path); - } - - return tmp; -} -#endif - int main(int argc, char **argv) { int i_am_the_monitor, i, len; @@ -642,11 +584,8 @@ static int real_main(int argc, char **argv) char *pos; int d, s; int flag; -#ifdef DEBUG - Bool doSync = False; -#endif - setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); wsetabort(wAbort); /* for telling WPrefs what's the name of the wmaker binary being ran */ @@ -698,10 +637,6 @@ static int real_main(int argc, char **argv) } else if (strcmp(argv[i], "--global_defaults_path") == 0) { printf("%s/%s\n", SYSCONFDIR, GLOBAL_DEFAULTS_SUBDIR); exit(0); -#ifdef DEBUG - } else if (strcmp(argv[i], "--synchronous") == 0) { - doSync = 1; -#endif } else if (strcmp(argv[i], "-locale") == 0 || strcmp(argv[i], "--locale") == 0) { i++; if (i >= argc) { @@ -820,11 +755,6 @@ static int real_main(int argc, char **argv) DisplayName = XDisplayName(DisplayName); setenv("DISPLAY", DisplayName, 1); -#ifdef DEBUG - if (doSync) - XSynchronize(dpy, True); -#endif - wXModifierInitialize(); StartUp(!multiHead); diff --git a/src/misc.c b/src/misc.c index 48596768..9058a830 100644 --- a/src/misc.c +++ b/src/misc.c @@ -171,42 +171,10 @@ char *MakeCPPArgs(char *path) } while ((buf = strtok(NULL, ":")) != NULL); #undef arg -#ifdef DEBUG - puts("CPP ARGS"); - puts(line); -#endif return line; } #endif /* USECPP */ -#if 0 -/* - * Is win2 below win1? - */ -static Bool isBelow(WWindow * win1, WWindow * win2) -{ - int i; - WCoreWindow *tmp; - - tmp = win1->frame->core->stacking->under; - while (tmp) { - if (tmp == win2->frame->core) - return True; - tmp = tmp->stacking->under; - } - - for (i = win1->frame->core->stacking->window_level - 1; i >= 0; i--) { - tmp = win1->screen_ptr->stacking_list[i]; - while (tmp) { - if (tmp == win2->frame->core) - return True; - tmp = tmp->stacking->under; - } - } - return True; -} -#endif - /* XFetchName Wrapper */ Bool wFetchName(Display *dpy, Window win, char **winname) { diff --git a/src/motif.c b/src/motif.c index 7b674d7d..3e9e5e9e 100644 --- a/src/motif.c +++ b/src/motif.c @@ -26,20 +26,17 @@ #include #include - #include #include #include #include "WindowMaker.h" - #include "framewin.h" #include "window.h" #include "properties.h" #include "icon.h" #include "client.h" #include "funcs.h" - #include "motif.h" /* Motif window hints */ @@ -47,12 +44,12 @@ #define MWM_HINTS_DECORATIONS (1L << 1) /* bit definitions for MwmHints.functions */ -#define MWM_FUNC_ALL (1L << 0) -#define MWM_FUNC_RESIZE (1L << 1) -#define MWM_FUNC_MOVE (1L << 2) -#define MWM_FUNC_MINIMIZE (1L << 3) -#define MWM_FUNC_MAXIMIZE (1L << 4) -#define MWM_FUNC_CLOSE (1L << 5) +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) /* bit definitions for MwmHints.decorations */ #define MWM_DECOR_ALL (1L << 0) @@ -63,8 +60,6 @@ #define MWM_DECOR_MINIMIZE (1L << 5) #define MWM_DECOR_MAXIMIZE (1L << 6) -#define PROP_MWM_HINTS_ELEMENTS 5 - /* Motif window hints */ typedef struct { long flags; @@ -76,7 +71,7 @@ typedef struct { static Atom _XA_MOTIF_WM_HINTS; -static void setupMWMHints(WWindow * wwin, MWMHints * mwm_hints) +static void setupMWMHints(WWindow *wwin, MWMHints *mwm_hints) { /* * We will ignore all decoration hints that have an equivalent as @@ -84,18 +79,12 @@ static void setupMWMHints(WWindow * wwin, MWMHints * mwm_hints) */ if (mwm_hints->flags & MWM_HINTS_DECORATIONS) { -# ifdef DEBUG - fprintf(stderr, "has decor hints [ "); -# endif WSETUFLAG(wwin, no_titlebar, 1); WSETUFLAG(wwin, no_close_button, 1); WSETUFLAG(wwin, no_miniaturize_button, 1); WSETUFLAG(wwin, no_resizebar, 1); if (mwm_hints->decorations & MWM_DECOR_ALL) { -# ifdef DEBUG - fprintf(stderr, "ALL "); -# endif WSETUFLAG(wwin, no_titlebar, 0); WSETUFLAG(wwin, no_close_button, 0); WSETUFLAG(wwin, no_closable, 0); @@ -104,118 +93,54 @@ static void setupMWMHints(WWindow * wwin, MWMHints * mwm_hints) WSETUFLAG(wwin, no_resizebar, 0); WSETUFLAG(wwin, no_resizable, 0); } - /* - if (mwm_hints->decorations & MWM_DECOR_BORDER) { - # ifdef DEBUG - fprintf(stderr,"(BORDER) "); - # endif - } - */ - if (mwm_hints->decorations & MWM_DECOR_RESIZEH) { -# ifdef DEBUG - fprintf(stderr, "RESIZEH "); -# endif + if (mwm_hints->decorations & MWM_DECOR_RESIZEH) WSETUFLAG(wwin, no_resizebar, 0); - } if (mwm_hints->decorations & MWM_DECOR_TITLE) { -# ifdef DEBUG - fprintf(stderr, "TITLE+close "); -# endif WSETUFLAG(wwin, no_titlebar, 0); WSETUFLAG(wwin, no_close_button, 0); WSETUFLAG(wwin, no_closable, 0); } - /* - if (mwm_hints->decorations & MWM_DECOR_MENU) { - # ifdef DEBUG - fprintf(stderr,"(MENU) "); - # endif - } - */ if (mwm_hints->decorations & MWM_DECOR_MINIMIZE) { -# ifdef DEBUG - fprintf(stderr, "MINIMIZE "); -# endif WSETUFLAG(wwin, no_miniaturize_button, 0); WSETUFLAG(wwin, no_miniaturizable, 0); } - /* - if (mwm_hints->decorations & MWM_DECOR_MAXIMIZE) { - # ifdef DEBUG - fprintf(stderr,"(MAXIMIZE) "); - # endif - } - */ -# ifdef DEBUG - fprintf(stderr, "]\n"); -# endif } if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) { -# ifdef DEBUG - fprintf(stderr, "has function hints [ "); -# endif WSETUFLAG(wwin, no_closable, 1); WSETUFLAG(wwin, no_miniaturizable, 1); WSETUFLAG(wwin, no_resizable, 1); if (mwm_hints->functions & MWM_FUNC_ALL) { -# ifdef DEBUG - fprintf(stderr, "ALL "); -# endif WSETUFLAG(wwin, no_closable, 0); WSETUFLAG(wwin, no_miniaturizable, 0); WSETUFLAG(wwin, no_resizable, 0); } - if (mwm_hints->functions & MWM_FUNC_RESIZE) { -# ifdef DEBUG - fprintf(stderr, "RESIZE "); -# endif + if (mwm_hints->functions & MWM_FUNC_RESIZE) WSETUFLAG(wwin, no_resizable, 0); - } - /* - if (mwm_hints->functions & MWM_FUNC_MOVE) { - # ifdef DEBUG - fprintf(stderr,"(MOVE) "); - # endif - } - */ - if (mwm_hints->functions & MWM_FUNC_MINIMIZE) { -# ifdef DEBUG - fprintf(stderr, "MINIMIZE "); -# endif + + if (mwm_hints->functions & MWM_FUNC_MINIMIZE) WSETUFLAG(wwin, no_miniaturizable, 0); - } + if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) { -# ifdef DEBUG - fprintf(stderr, "MAXIMIZE "); /* a window must be resizable to be maximizable */ WSETUFLAG(wwin, no_resizable, 0); -# endif } - if (mwm_hints->functions & MWM_FUNC_CLOSE) { -# ifdef DEBUG - fprintf(stderr, "CLOSE "); -# endif + if (mwm_hints->functions & MWM_FUNC_CLOSE) WSETUFLAG(wwin, no_closable, 0); - } -# ifdef DEBUG - fprintf(stderr, "]\n"); -# endif } } -static int getMWMHints(Window window, MWMHints * mwmhints) +static int getMWMHints(Window window, MWMHints *mwmhints) { unsigned long *data; int count; - if (!_XA_MOTIF_WM_HINTS) { + if (!_XA_MOTIF_WM_HINTS) _XA_MOTIF_WM_HINTS = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); - } data = (unsigned long *)PropGetCheckProperty(window, _XA_MOTIF_WM_HINTS, _XA_MOTIF_WM_HINTS, 32, 0, &count); @@ -236,13 +161,12 @@ static int getMWMHints(Window window, MWMHints * mwmhints) return 1; } -void wMWMCheckClientHints(WWindow * wwin) +void wMWMCheckClientHints(WWindow *wwin) { MWMHints hints; - if (getMWMHints(wwin->client_win, &hints)) { + if (getMWMHints(wwin->client_win, &hints)) setupMWMHints(wwin, &hints); - } } -#endif /* MWM_HINTS */ +#endif /* MWM_HINTS */ diff --git a/src/moveres.c b/src/moveres.c index d886f1fa..7b59e966 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -1585,9 +1585,6 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev) /* this window is not selected, unselect others and move only wwin */ wUnselectWindows(scr); } -#ifdef DEBUG - puts("Moving window"); -#endif shiftl = XKeysymToKeycode(dpy, XK_Shift_L); shiftr = XKeysymToKeycode(dpy, XK_Shift_R); while (!done) { @@ -1755,9 +1752,6 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev) WMUnmapWidget(scr->gview); } } -#ifdef DEBUG - puts("End move window"); -#endif done = True; break; @@ -1883,10 +1877,6 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) orig_y = ev->xbutton.y_root; started = 0; -#ifdef DEBUG - puts("Resizing window"); -#endif - wUnselectWindows(scr); rx1 = fx; rx2 = fx + fw - 1; @@ -2067,9 +2057,6 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev) wWindowConfigure(wwin, fx, fy, fw, fh - vert_border); } -#ifdef DEBUG - puts("End resize window"); -#endif return; default: @@ -2138,9 +2125,6 @@ void wSelectWindows(WScreen * scr, XEvent * ev) int w = 0, h = 0; int x = xp, y = yp; -#ifdef DEBUG - puts("Selecting windows"); -#endif if (XGrabPointer(dpy, scr->root_win, False, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, wCursor[WCUR_DEFAULT], CurrentTime) != Success) { @@ -2185,10 +2169,6 @@ void wSelectWindows(WScreen * scr, XEvent * ev) XUngrabServer(dpy); XUngrabPointer(dpy, CurrentTime); selectWindowsInside(scr, x, y, x + w, y + h); - -#ifdef DEBUG - puts("End window selection"); -#endif return; default: diff --git a/src/placement.c b/src/placement.c index 0569b4c2..b891a7a5 100644 --- a/src/placement.c +++ b/src/placement.c @@ -134,15 +134,6 @@ void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int head) sw = sx2 - sx1; sh = sy2 - sy1; -#if 0 - if (scr->dock) { - if (scr->dock->on_right_side) - sx2 -= isize + DOCK_EXTRA_SPACE; - else - sx1 += isize + DOCK_EXTRA_SPACE; - } -#endif - sw = isize * (sw / isize); sh = isize * (sh / isize); fullW = (sx2 - sx1) / isize; @@ -279,16 +270,9 @@ static int calcSumOfCoveredAreas(WWindow *wwin, int x, int y, int w, int h) if (test_window->frame->core->stacking->window_level < WMNormalLevel) { continue; } -#if 0 - tw = test_window->client.width; - if (test_window->flags.shaded) - th = test_window->frame->top_width; - else - th = test_window->client.height + extra_height; -#else + tw = test_window->frame->core->width; th = test_window->frame->core->height; -#endif tx = test_window->frame_x; ty = test_window->frame_y; @@ -409,16 +393,8 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, test_window = test_window->next; continue; } -#if 0 - tw = test_window->client.width; - if (test_window->flags.shaded) - th = test_window->frame->top_width; - else - th = test_window->client.height + extra_height; -#else tw = test_window->frame->core->width; th = test_window->frame->core->height; -#endif tx = test_window->frame_x; ty = test_window->frame_y; @@ -443,16 +419,8 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, test_window = test_window->prev; continue; } -#if 0 - tw = test_window->client.width; - if (test_window->flags.shaded) - th = test_window->frame->top_width; - else - th = test_window->client.height + extra_height; -#else tw = test_window->frame->core->width; th = test_window->frame->core->height; -#endif tx = test_window->frame_x; ty = test_window->frame_y; @@ -553,13 +521,6 @@ void PlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, unsigned width, unsigned case WPM_RANDOM: randomPlaceWindow(wwin, x_ret, y_ret, width, height, usableArea); break; - -#ifdef DEBUG - default: - puts("Invalid window placement!!!"); - *x_ret = 0; - *y_ret = 0; -#endif } /* diff --git a/src/rootmenu.c b/src/rootmenu.c index be8c7d55..29687a94 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -193,12 +193,9 @@ static void exitCommand(WMenu * menu, WMenuEntry * entry) wPreferences.save_session_on_exit = oldSaveSessionFlag; } } - if (result == R_EXIT) { -#ifdef DEBUG - printf("Exiting WindowMaker.\n"); -#endif + if (result == R_EXIT) Shutdown(WSExitMode); - } + #undef R_EXIT #undef R_CANCEL inside = 0; diff --git a/src/stacking.c b/src/stacking.c index aceb9507..8199c8d7 100644 --- a/src/stacking.c +++ b/src/stacking.c @@ -97,11 +97,6 @@ void RemakeStackList(WScreen * scr) WMSetInBag(scr->stacking_list, level, frame); } XFree(windows); -#ifdef DEBUG - if (c != scr->window_count) { - puts("Found different number of windows than in window lists!!!"); - } -#endif scr->window_count = c; } @@ -132,14 +127,6 @@ void CommitStacking(WScreen * scr) i = 0; WM_ETARETI_BAG(scr->stacking_list, tmp, iter) { while (tmp) { -#ifdef DEBUG - if (i >= nwindows) { - puts("Internal inconsistency! window_count is incorrect!!!"); - printf("window_count says %i windows\n", nwindows); - wfree(windows); - return; - } -#endif windows[i++] = tmp->window; tmp = tmp->stacking->under; } diff --git a/src/startup.c b/src/startup.c index cf6b0111..817173a5 100644 --- a/src/startup.c +++ b/src/startup.c @@ -134,9 +134,6 @@ extern Atom _XA_WM_IGNORE_FOCUS_EVENTS; /* cursors */ extern Cursor wCursor[WCUR_LAST]; -/* special flags */ -/*extern char WDelayedActionSet;*/ - /***** Local *****/ static WScreen **wScreen = NULL; @@ -170,14 +167,7 @@ static int catchXError(Display * dpy, XErrorEvent * error) || error->request_code == X_ConfigureWindow)) */ || (error->request_code == X_InstallColormap))) { -#ifndef DEBUG - return 0; -#else - printf("got X error %x %x %x\n", error->request_code, - error->error_code, (unsigned)error->resourceid); - return 0; -#endif } FormatXError(dpy, error, buffer, MAXLINE); wwarning(_("internal X error: %s\n"), buffer); @@ -197,29 +187,6 @@ static int handleXIO(Display * xio_dpy) return 0; } -/* - *---------------------------------------------------------------------- - * delayedAction- - * Action to be executed after the signal() handler is exited. - * This was called every 500ms to 'clean up' signals. Not used now. - *---------------------------------------------------------------------- - */ -#ifdef notused -static void delayedAction(void *cdata) -{ - if (WDelayedActionSet == 0) { - return; - } - WDelayedActionSet--; - /* - * Make the event dispatcher do whatever it needs to do, - * including handling zombie processes, restart and exit - * signals. - */ - DispatchEvent(NULL); -} -#endif - /* *---------------------------------------------------------------------- * handleExitSig-- diff --git a/src/text.c b/src/text.c index e3f5241e..3fc10e98 100644 --- a/src/text.c +++ b/src/text.c @@ -42,16 +42,6 @@ (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) #endif -#ifdef DEBUG -# define ENTER(X) fprintf(stderr,"Entering: %s()\n", X); -# define LEAVE(X) fprintf(stderr,"Leaving: %s()\n", X); -# define PDEBUG(X) fprintf(stderr,"debug: %s()\n", X); -#else -# define ENTER(X) -# define LEAVE(X) -# define PDEBUG(X) -#endif - extern Cursor wCursor[WCUR_LAST]; /******************************************************************** @@ -62,9 +52,6 @@ static void textEventHandler(WObjDescriptor * desc, XEvent * event); static void handleExpose(WObjDescriptor * desc, XEvent * event); static void textInsert(WTextInput * wtext, char *txt); -#if 0 -static void blink(void *data); -#endif /******************************************************************** * handleKeyPress * @@ -189,8 +176,6 @@ WTextInput *wTextCreate(WCoreWindow * core, int x, int y, int width, int height) { WTextInput *wtext; - ENTER("wTextCreate"); - wtext = wmalloc(sizeof(WTextInput)); wtext->core = wCoreCreate(core, x, y, width, height); wtext->core->descriptor.handle_anything = &textEventHandler; @@ -248,9 +233,6 @@ WTextInput *wTextCreate(WCoreWindow * core, int x, int y, int width, int height) * hits "Return" key */ XMapRaised(dpy, wtext->core->window); - - LEAVE("wTextCreate"); - return wtext; } @@ -263,20 +245,12 @@ WTextInput *wTextCreate(WCoreWindow * core, int x, int y, int width, int height) ********************************************************************/ void wTextDestroy(WTextInput * wtext) { - ENTER("wTextDestroy") -#if 0 - if (wtext->magic) - wDeleteTimerHandler(wtext->magic); - wtext->magic = NULL; -#endif XFreeGC(dpy, wtext->gc); XFreeGC(dpy, wtext->regGC); XFreeGC(dpy, wtext->invGC); wfree(wtext->text.txt); wCoreDestroy(wtext->core); wfree(wtext); - - LEAVE("wTextDestroy"); } /* The text-field consists of a frame drawn around the outside, @@ -361,15 +335,12 @@ static void textRefresh(WTextInput * wtext) ********************************************************************/ void wTextPaint(WTextInput * wtext) { - ENTER("wTextPaint"); - /* refresh */ textRefresh(wtext); /* Draw box */ - XDrawRectangle(dpy, wtext->core->window, wtext->gc, 0, 0, wtext->core->width - 1, wtext->core->height - 1); - - LEAVE("wTextPaint"); + XDrawRectangle(dpy, wtext->core->window, wtext->gc, 0, 0, + wtext->core->width - 1, wtext->core->height - 1); } /******************************************************************** @@ -495,30 +466,6 @@ void wTextSelect(WTextInput * wtext, int start, int end) wtext->text.startPos = start; } -#if 0 -static void blink(void *data) -{ - int x; - WTextInput *wtext = (WTextInput *) data; - GC gc; - - /* And draw a quick little line for the cursor position */ - if (wtext->blink_on) { - gc = wtext->regGC; - wtext->blink_on = 0; - } else { - gc = wtext->invGC; - wtext->blink_on = 1; - } - x = WMWidthOfString(wtext->font, wtext->text.txt, wtext->text.endPos) - + wtext->xOffset; - XDrawLine(dpy, wtext->core->window, gc, x, 2, x, wtext->core->height - 3); - - if (wtext->blinking) - wtext->magic = wAddTimerHandler(CURSOR_BLINK_RATE, blink, data); -} -#endif - /******************************************************************** * textEventHandler -- handles and dispatches all the events that * * the text field class supports * @@ -538,54 +485,32 @@ static void textEventHandler(WObjDescriptor * desc, XEvent * event) * event, but otherwise we want to adjust the selected * text so we can wTextRefresh() */ if (event->xmotion.state & (Button1Mask | Button3Mask | Button2Mask)) { - PDEBUG("MotionNotify"); handled = True; wtext->text.endPos = textXtoPos(wtext, event->xmotion.x); } break; case ButtonPress: - PDEBUG("ButtonPress"); handled = True; wtext->text.startPos = textXtoPos(wtext, event->xbutton.x); wtext->text.endPos = wtext->text.startPos; break; case ButtonRelease: - PDEBUG("ButtonRelease"); handled = True; wtext->text.endPos = textXtoPos(wtext, event->xbutton.x); break; case KeyPress: - PDEBUG("KeyPress"); handled = handleKeyPress(wtext, &event->xkey); break; case EnterNotify: - PDEBUG("EnterNotify"); handled = True; -#if 0 - if (!wtext->magic) { - wtext->magic = wAddTimerHandler(CURSOR_BLINK_RATE, blink, wtext); - wtext->blink_on = !wtext->blink_on; - blink(wtext); - wtext->blinking = 1; - } -#endif break; case LeaveNotify: - PDEBUG("LeaveNotify"); handled = True; -#if 0 - wtext->blinking = 0; - if (wtext->blink_on) - blink(wtext); - if (wtext->magic) - wDeleteTimerHandler(wtext->magic); - wtext->magic = NULL; -#endif break; default: diff --git a/src/texture.c b/src/texture.c index d6add836..6414fd37 100644 --- a/src/texture.c +++ b/src/texture.c @@ -116,9 +116,6 @@ WTexSolid *wTextureMakeSolid(WScreen * scr, XColor * color) static int dummyErrorHandler(Display * foo, XErrorEvent * bar) { -#ifdef DEBUG - wwarning("your server is buggy. Tell the author if some error related to color occurs"); -#endif return 0; } @@ -128,13 +125,6 @@ void wTextureDestroy(WScreen * scr, WTexture * texture) int count = 0; unsigned long colors[8]; -#ifdef DEBUG - if (texture == NULL) { - printf("BUG: trying to free NULL texture\n"); - return; - } -#endif - /* * some stupid servers don't like white or black being freed... */ @@ -672,24 +662,5 @@ void wDrawBevel(Drawable d, unsigned width, unsigned height, WTexSolid * texture XDrawSegments(dpy, d, light, segs, 2); } break; -#ifdef unused - case WREL_SUNKEN: - segs[0].x1 = 0; - segs[0].x2 = width - 1; - segs[0].y2 = segs[0].y1 = 0; - segs[1].x1 = segs[1].x2 = 0; - segs[1].y1 = 0; - segs[1].y2 = height - 1; - XDrawSegments(dpy, d, dark, segs, 2); - - segs[0].x1 = 0; - segs[0].y1 = segs[0].y2 = height - 1; - segs[0].x2 = width - 1; - segs[1].x2 = segs[1].x1 = width - 1; - segs[1].y1 = 1; - segs[1].y2 = height - 1; - XDrawSegments(dpy, d, light, segs, 2); - break; -#endif } } diff --git a/src/wconfig.h.in b/src/wconfig.h.in index a3d4a039..0277474f 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -393,8 +393,6 @@ # define DEFAULT_PATH_MAX 512 #endif -#define DEBUG0 - /* some rules */ #ifndef SHAPE #undef SHAPED_BALLOON diff --git a/src/window.c b/src/window.c index 76554986..16f3aca6 100644 --- a/src/window.c +++ b/src/window.c @@ -644,10 +644,6 @@ WWindow *wManageWindow(WScreen *scr, Window window) XSaveContext(dpy, window, wWinContext, (XPointer) & wwin->client_descriptor); -#ifdef DEBUG - printf("managing window %x\n", (unsigned)window); -#endif - #ifdef SHAPE if (wShapeSupported) { int junk; @@ -1678,10 +1674,6 @@ void wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed) if (!wwin->flags.internal_window) WMPostNotificationName(WMNUnmanaged, wwin, NULL); -#ifdef DEBUG - printf("destroying window %x frame %x\n", (unsigned)wwin->client_win, (unsigned)frame->window); -#endif - if (wasFocused) { if (newFocusedWindow != owner && owner) { if (wwin->flags.is_gnustep == 0) @@ -2634,10 +2626,6 @@ WMagicNumber wWindowAddSavedState(char *instance, char *class, char *command, pi wstate->next = windowState; windowState = wstate; -#ifdef DEBUG - printf("Added WindowState with ID %p, for %s.%s : \"%s\"\n", wstate, instance, class, command); -#endif - return wstate; } @@ -2667,10 +2655,6 @@ WMagicNumber wWindowGetSavedState(Window win) wstate = NULL; } -#ifdef DEBUG - printf("Read WindowState with ID %p, for %s.%s : \"%s\"\n", wstate, instance, class, command); -#endif - if (command) wfree(command); if (instance) @@ -2691,10 +2675,6 @@ void wWindowDeleteSavedState(WMagicNumber id) tmp = windowState; if (tmp == wstate) { windowState = wstate->next; -#ifdef DEBUG - printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n", - wstate, wstate->instance, wstate->class, wstate->command); -#endif if (wstate->instance) wfree(wstate->instance); if (wstate->class) @@ -2707,10 +2687,6 @@ void wWindowDeleteSavedState(WMagicNumber id) while (tmp->next) { if (tmp->next == wstate) { tmp->next = wstate->next; -#ifdef DEBUG - printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n", - wstate, wstate->instance, wstate->class, wstate->command); -#endif if (wstate->instance) wfree(wstate->instance); if (wstate->class) @@ -2737,10 +2713,6 @@ void wWindowDeleteSavedStatesForPID(pid_t pid) if (tmp->pid == pid) { wstate = windowState; windowState = tmp->next; -#ifdef DEBUG - printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n", - wstate, wstate->instance, wstate->class, wstate->command); -#endif if (wstate->instance) wfree(wstate->instance); if (wstate->class) @@ -2754,10 +2726,6 @@ void wWindowDeleteSavedStatesForPID(pid_t pid) if (tmp->next->pid == pid) { wstate = tmp->next; tmp->next = wstate->next; -#ifdef DEBUG - printf("Deleted WindowState with ID %p, for %s.%s : \"%s\"\n", - wstate, wstate->instance, wstate->class, wstate->command); -#endif if (wstate->instance) wfree(wstate->instance); if (wstate->class) @@ -2810,9 +2778,6 @@ static void resizebarMouseDown(WCoreWindow *sender, void *data, XEvent *event) if (XGrabPointer(dpy, wwin->frame->resizebar->window, True, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { -#ifdef DEBUG0 - wwarning("pointer grab failed for window move"); -#endif return; } } @@ -2924,9 +2889,6 @@ static void frameMouseDown(WObjDescriptor *desc, XEvent *event) if (XGrabPointer(dpy, wwin->client_win, False, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { -#ifdef DEBUG0 - wwarning("pointer grab failed for window move"); -#endif return; } if (event->xbutton.button == Button3) { @@ -2984,9 +2946,6 @@ static void titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event) && XGrabPointer(dpy, wwin->frame->titlebar->window, False, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { -#ifdef DEBUG0 - wwarning("pointer grab failed for window move"); -#endif return; } @@ -3002,9 +2961,6 @@ static void titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event) && XGrabPointer(dpy, wwin->frame->titlebar->window, False, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { -#ifdef DEBUG0 - wwarning("pointer grab failed for window move"); -#endif return; } diff --git a/util/wmgenmenu.c b/util/wmgenmenu.c index 934ccca7..a9001936 100644 --- a/util/wmgenmenu.c +++ b/util/wmgenmenu.c @@ -26,7 +26,6 @@ char *path; int main(int argc, char *argv[]) { - int fd; char *locale; extern char *path;