From c28e61aefba5492014a2e457f68110bfcf759998 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:07:33 +0100 Subject: [PATCH 1/7] Remove ICON_DBG. --- fvwm/add_window.c | 12 ------------ fvwm/events.c | 10 ---------- fvwm/icons.c | 23 ----------------------- fvwm/misc.h | 6 ------ 4 files changed, 51 deletions(-) diff --git a/fvwm/add_window.c b/fvwm/add_window.c index 63900abc5..854183d99 100644 --- a/fvwm/add_window.c +++ b/fvwm/add_window.c @@ -1416,14 +1416,10 @@ static void setup_icon(FvwmWindow *fw, window_style *pstyle) if (SHAS_ICON(&pstyle->flags) && S_ICON_OVERRIDE(SCF(*pstyle)) == ICON_OVERRIDE) { - ICON_DBG((stderr,"si: iwh ignored '%s'\n", - fw->name.name)); fw->icon_bitmap_file = SGET_ICON_NAME(*pstyle); } else { - ICON_DBG((stderr,"si: using iwh '%s'\n", - fw->name.name)); fw->icon_bitmap_file = NULL; } } @@ -1432,27 +1428,21 @@ static void setup_icon(FvwmWindow *fw, window_style *pstyle) if (SHAS_ICON(&pstyle->flags) && S_ICON_OVERRIDE(SCF(*pstyle)) != NO_ICON_OVERRIDE) { - ICON_DBG((stderr,"si: iph ignored '%s'\n", - fw->name.name)); fw->icon_bitmap_file = SGET_ICON_NAME(*pstyle); } else { - ICON_DBG((stderr,"si: using iph '%s'\n", - fw->name.name)); fw->icon_bitmap_file = NULL; } } else if (SHAS_ICON(&pstyle->flags)) { /* an icon was specified */ - ICON_DBG((stderr,"si: using style '%s'\n", fw->name.name)); fw->icon_bitmap_file = SGET_ICON_NAME(*pstyle); } else { /* use default icon */ - ICON_DBG((stderr,"si: using default '%s'\n", fw->name.name)); fw->icon_bitmap_file = Scr.DefaultIcon; } @@ -2228,8 +2218,6 @@ void increase_icon_hint_count(FvwmWindow *fw) default: break; } - ICON_DBG((stderr,"icon hint count++ (%d) '%s'\n", - (int)WAS_ICON_HINT_PROVIDED(fw), fw->name.name)); } return; diff --git a/fvwm/events.c b/fvwm/events.c index 49c23b799..f63a2cf6d 100644 --- a/fvwm/events.c +++ b/fvwm/events.c @@ -3506,13 +3506,11 @@ void HandlePropertyNotify(const evh_args_t *ea) if ((fw->wmhints->flags & IconPixmapHint) || (old_wmhints_flags & IconPixmapHint)) { -ICON_DBG((stderr, "hpn: iph changed (%d) '%s'\n", !!(int)(fw->wmhints->flags & IconPixmapHint), fw->name.name)); has_icon_pixmap_hint_changed = True; } if ((fw->wmhints->flags & IconWindowHint) || (old_wmhints_flags & IconWindowHint)) { -ICON_DBG((stderr, "hpn: iwh changed (%d) '%s'\n", !!(int)(fw->wmhints->flags & IconWindowHint), fw->name.name)); has_icon_window_hint_changed = True; SET_USE_EWMH_ICON(fw, False); } @@ -3522,7 +3520,6 @@ ICON_DBG((stderr, "hpn: iwh changed (%d) '%s'\n", !!(int)(fw->wmhints->flags & I { if (ICON_OVERRIDE_MODE(fw) == ICON_OVERRIDE) { -ICON_DBG((stderr, "hpn: icon override '%s'\n", fw->name.name)); has_icon_changed = False; } else if (ICON_OVERRIDE_MODE(fw) == @@ -3533,7 +3530,6 @@ ICON_DBG((stderr, "hpn: icon override '%s'\n", fw->name.name)); if (WAS_ICON_HINT_PROVIDED(fw) == ICON_HINT_MULTIPLE) { -ICON_DBG((stderr, "hpn: using further iph '%s'\n", fw->name.name)); has_icon_changed = True; } else if (fw->icon_bitmap_file == @@ -3541,7 +3537,6 @@ ICON_DBG((stderr, "hpn: using further iph '%s'\n", fw->name.name)); fw->icon_bitmap_file == Scr.DefaultIcon) { -ICON_DBG((stderr, "hpn: using first iph '%s'\n", fw->name.name)); has_icon_changed = True; } else @@ -3550,24 +3545,20 @@ ICON_DBG((stderr, "hpn: using first iph '%s'\n", fw->name.name)); * hint if the application did * not provide it from the * start */ -ICON_DBG((stderr, "hpn: first iph ignored '%s'\n", fw->name.name)); has_icon_changed = False; } } else if (has_icon_window_hint_changed) { -ICON_DBG((stderr, "hpn: using iwh '%s'\n", fw->name.name)); has_icon_changed = True; } else { -ICON_DBG((stderr, "hpn: iwh not changed, hint ignored '%s'\n", fw->name.name)); has_icon_changed = False; } } else /* NO_ICON_OVERRIDE */ { -ICON_DBG((stderr, "hpn: using hint '%s'\n", fw->name.name)); has_icon_changed = True; } @@ -3578,7 +3569,6 @@ ICON_DBG((stderr, "hpn: using hint '%s'\n", fw->name.name)); if (has_icon_changed) { -ICON_DBG((stderr, "hpn: icon changed '%s'\n", fw->name.name)); /* Okay, the icon hint has changed and style * options tell us to honour this change. Now * let's see if we have to use the application diff --git a/fvwm/icons.c b/fvwm/icons.c index 25579d1ca..a329f6811 100644 --- a/fvwm/icons.c +++ b/fvwm/icons.c @@ -284,7 +284,6 @@ void GetIconPicture(FvwmWindow *fw, Bool no_icon_window) icon_order[1] = 1; icon_order[2] = 2; icon_order[3] = 3; -ICON_DBG((stderr,"ciw: hint order: file iwh iph '%s'\n", fw->name.name)); } else if (ICON_OVERRIDE_MODE(fw) == NO_ACTIVE_ICON_OVERRIDE) { @@ -297,7 +296,6 @@ ICON_DBG((stderr,"ciw: hint order: file iwh iph '%s'\n", fw->name.name)); icon_order[1] = 2; icon_order[2] = 3; icon_order[3] = 0; -ICON_DBG((stderr,"ciw: hint order: iwh iph file '%s'\n", fw->name.name)); } else if (Scr.DefaultIcon && fw->icon_bitmap_file == Scr.DefaultIcon) @@ -308,7 +306,6 @@ ICON_DBG((stderr,"ciw: hint order: iwh iph file '%s'\n", fw->name.name)); icon_order[1] = 2; icon_order[2] = 3; icon_order[3] = 0; -ICON_DBG((stderr,"ciw: hint order: iwh iph file '%s'\n", fw->name.name)); } else { @@ -319,7 +316,6 @@ ICON_DBG((stderr,"ciw: hint order: iwh iph file '%s'\n", fw->name.name)); icon_order[1] = 2; icon_order[2] = 0; icon_order[3] = 3; -ICON_DBG((stderr,"ciw: hint order: iwh file iph '%s'\n", fw->name.name)); } } else @@ -330,7 +326,6 @@ ICON_DBG((stderr,"ciw: hint order: iwh file iph '%s'\n", fw->name.name)); icon_order[1] = 2; icon_order[2] = 3; icon_order[3] = 0; -ICON_DBG((stderr,"ciw: hint order: iwh iph file '%s'\n", fw->name.name)); } fw->icon_g.picture_w_g.width = 0; @@ -350,8 +345,6 @@ ICON_DBG((stderr,"ciw: hint order: iwh iph file '%s'\n", fw->name.name)); { GetIconFromFile(fw); } -ICON_DBG((stderr,"ciw: file%s used '%s'\n", - (fw->icon_g.picture_w_g.height)?"":" not", fw->name.name)); break; case 1: /* Next, See if the app supplies its own icon window */ @@ -364,8 +357,6 @@ ICON_DBG((stderr,"ciw: file%s used '%s'\n", { GetIconWindow(fw); } -ICON_DBG((stderr,"ciw: iwh%s used '%s'\n", - (fw->icon_g.picture_w_g.height)?"":" not",fw->name.name)); break; case 2: /* try an ewmh icon */ @@ -376,8 +367,6 @@ ICON_DBG((stderr,"ciw: iwh%s used '%s'\n", SET_USE_EWMH_ICON(fw, True); } } -ICON_DBG((stderr,"ciw: inh%s used '%s'\n", - (fw->icon_g.picture_w_g.height)?"":" not",fw->name.name)); break; case 3: /* Finally, try to get icon bitmap from the @@ -387,8 +376,6 @@ ICON_DBG((stderr,"ciw: inh%s used '%s'\n", { GetIconBitmap(fw); } -ICON_DBG((stderr,"ciw: iph%s used '%s'\n", - (fw->icon_g.picture_w_g.height)?"":" not",fw->name.name)); break; default: /* can't happen */ @@ -436,12 +423,6 @@ ICON_DBG((stderr,"ciw: iph%s used '%s'\n", int force_centering = False; int nrx, nry; - ICON_DBG((stderr, - "ciw: Changing icon (%s) from %dx%d to" - " %dx%d\n", fw->name.name, - fw->icon_g.picture_w_g.width, - fw->icon_g.picture_w_g.height, - newWidth, newHeight)); /* Resize the icon Pixmap */ /* force to center if the icon has a bg */ if (fw->icon_background_cs >= 0 || @@ -1546,15 +1527,11 @@ void ChangeIconPixmap(FvwmWindow *fw) if (!IS_ICONIFIED(fw)) { - ICON_DBG((stderr,"hpn: postpone icon change '%s'\n", - fw->name.name)); /* update the icon later when application is iconified */ SET_HAS_ICON_CHANGED(fw, 1); } else if (IS_ICONIFIED(fw)) { - ICON_DBG((stderr,"hpn: applying new icon '%s'\n", - fw->name.name)); SET_ICONIFIED(fw, 0); SET_ICON_UNMAPPED(fw, 0); get_icon_geometry(fw, &g); diff --git a/fvwm/misc.h b/fvwm/misc.h index 5fb1aabbf..7bdc602fb 100644 --- a/fvwm/misc.h +++ b/fvwm/misc.h @@ -26,12 +26,6 @@ enum /* ---------------------------- global macros ------------------------------ */ -#ifdef ICON_DEBUG -#define ICON_DBG(X) fprintf X; -#else -#define ICON_DBG(X) -#endif - /* ---------------------------- type definitions --------------------------- */ typedef enum From 1048b731cdbb74ec6119ea4cdf3d51c3105eefb3 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:09:54 +0100 Subject: [PATCH 2/7] Remove NO_ICONS. --- fvwm/icons.h | 7 +------ modules/FvwmButtons/icons.c | 6 ------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/fvwm/icons.h b/fvwm/icons.h index f4d68db84..286bef497 100644 --- a/fvwm/icons.h +++ b/fvwm/icons.h @@ -5,12 +5,7 @@ #include "fvwm.h" -#ifdef NO_ICONS -#define ICON_HEIGHT(t) 1 -#else -#define ICON_HEIGHT(t) \ - ((t)->icon_font->height + 2*abs((t)->icon_title_relief)) -#endif +#define ICON_HEIGHT(t) ((t)->icon_font->height + 2*abs((t)->icon_title_relief)) int get_visible_icon_window_count(FvwmWindow *fw); void clear_icon(FvwmWindow *fw); diff --git a/modules/FvwmButtons/icons.c b/modules/FvwmButtons/icons.c index 456715bd1..891e2a3ab 100644 --- a/modules/FvwmButtons/icons.c +++ b/modules/FvwmButtons/icons.c @@ -53,9 +53,6 @@ Bool GetIconPosition(button_info *b, FvwmPicture *pic, int *r_x, int *r_y, int *r_w, int *r_h) { -#ifdef NO_ICONS - return False; -#else int x, y, width, height; int xoff, yoff; int framew, xpad, ypad; @@ -131,12 +128,10 @@ Bool GetIconPosition(button_info *b, *r_h = height; return True; -#endif } void DrawForegroundIcon(button_info *b, XEvent *pev) { -#ifndef NO_ICONS int x, y, w, h; int cset; XRectangle clip; @@ -190,5 +185,4 @@ void DrawForegroundIcon(button_info *b, XEvent *pev) NormalGC, None, None, clip.x - x, clip.y - y, clip.width, clip.height, clip.x, clip.y, clip.width, clip.height, False); -#endif } From 43f6e3c7c4c167a23248b3fd10222cf36bf3ee45 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:30:32 +0100 Subject: [PATCH 3/7] Remove duplicate code. --- fvwm/add_window.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fvwm/add_window.c b/fvwm/add_window.c index 854183d99..f05fc07c4 100644 --- a/fvwm/add_window.c +++ b/fvwm/add_window.c @@ -1608,16 +1608,6 @@ static void destroy_mini_icon(FvwmWindow *fw) static void setup_key_and_button_grabs(FvwmWindow *fw) { -#ifdef BUGS_ARE_COOL - /* dv (29-May-2001): If keys are grabbed separately for C_WINDOW and - * the other contexts, new windows have problems when bindings are - * removed. Therefore, grab all keys in a single pass through the - * list. */ - GrabAllWindowKeys( - dpy, FW_W_FRAME(fw), Scr.AllBindings, - C_WINDOW|C_TITLE|C_RALL|C_LALL|C_SIDEBAR, GetUnusedModifiers(), - True); -#endif GrabAllWindowKeys( dpy, FW_W_FRAME(fw), Scr.AllBindings, C_TITLE|C_RALL|C_LALL|C_SIDEBAR|C_WINDOW, GetUnusedModifiers(), From f0e71222664b34854140372f39515ea095518b9b Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:30:42 +0100 Subject: [PATCH 4/7] Remove MINI_ICON ifdef that wasn't used anyway. --- fvwm/add_window.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fvwm/add_window.c b/fvwm/add_window.c index f05fc07c4..dbd062e29 100644 --- a/fvwm/add_window.c +++ b/fvwm/add_window.c @@ -3481,9 +3481,7 @@ void destroy_window(FvwmWindow *fw) /****** destroy mini icon ******/ -#ifdef MINI_ICON destroy_mini_icon(fw); -#endif /****** free strings ******/ From c0708224f697eca939bf2ce0d631836d68ec022c Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:34:41 +0100 Subject: [PATCH 5/7] Remove undefined FOCUS_EXPANFS_TITLE stuff. --- fvwm/events.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fvwm/events.c b/fvwm/events.c index f63a2cf6d..23d647014 100644 --- a/fvwm/events.c +++ b/fvwm/events.c @@ -2758,14 +2758,6 @@ ENTER_DBG((stderr, "-------- ln (%d): fw %p w 0x%08x sw 0x%08x mode 0x%x detail ENTER_DBG((stderr, "ln: *** lgw = %p\n", fw)); xcrossing_last_grab_window = fw; } -#ifdef FOCUS_EXPANDS_TITLE - if (fw && IS_ICONIFIED(fw)) - { - SET_ICON_ENTERED(fw, 0); - DrawIconWindow( - fw, True, False, False, False, NULL); - } -#endif return; } /* CDE-like behaviour of raising the icon title if the icon From 5d32940e398ba079b3cc2f1c5a810df352658725 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:43:41 +0100 Subject: [PATCH 6/7] Hard code EXPERIMENTAL_ROU_HANDLING_V2. The old stuff hasn't been enabled in twenty years. --- fvwm/events.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/fvwm/events.c b/fvwm/events.c index 23d647014..d22b41bd7 100644 --- a/fvwm/events.c +++ b/fvwm/events.c @@ -1427,13 +1427,7 @@ static void __check_click_to_focus_or_raise( } ret_args->do_raise = focus_query_click_to_raise(fw, f.is_focused, exc->w.wcontext); -#define EXPERIMENTAL_ROU_HANDLING_V2 -#ifdef EXPERIMENTAL_ROU_HANDLING_V2 -/* RBW -- Dang! This works without the one in HandleEnterNotify! */ if (ret_args->do_raise && is_on_top_of_layer_and_above_unmanaged(fw)) -#else - if (ret_args->do_raise && is_on_top_of_layer(fw)) -#endif { ret_args->do_raise = 0; } @@ -2295,14 +2289,7 @@ ENTER_DBG((stderr, "en: set mousey focus\n")); if (ewp->window == FW_W(fw)) { /* Event is for the client window...*/ -#ifndef EXPERIMENTAL_ROU_HANDLING_V2 - /* RBW -- This may still be needed at times, I'm not - *sure yet. */ - SetFocusWindowClientEntered( - fw, True, FOCUS_SET_BY_ENTER); -#else SetFocusWindow(fw, True, FOCUS_SET_BY_ENTER); -#endif } else { From 3371987ea26a2828c592cf436e7798d04f894a50 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 12:45:00 +0100 Subject: [PATCH 7/7] Ifdef go away. --- fvwm/events.c | 167 +++++++++++++++++++++++-------------- fvwm/ewmh.c | 145 +++++++++++++++++--------------- fvwm/ewmh_intern.h | 14 ---- fvwm/execcontext.c | 76 +++++++++-------- fvwm/fvwm.h | 1 + fvwm/fvwm3.c | 2 - fvwm/modconf.c | 14 ++-- fvwm/module_list.c | 33 +++++--- fvwm/move_resize.c | 32 +++++--- fvwm/session.c | 201 ++++++++++++++++++++++++++------------------- fvwm/stack.c | 108 ++++++++++++++---------- fvwm/stack.h | 4 - fvwm/virtual.c | 18 ++-- libs/Fsvg.h | 4 + libs/fvwmlib3.c | 2 - 15 files changed, 470 insertions(+), 351 deletions(-) diff --git a/fvwm/events.c b/fvwm/events.c index d22b41bd7..011029681 100644 --- a/fvwm/events.c +++ b/fvwm/events.c @@ -105,6 +105,11 @@ /* ---------------------------- local definitions -------------------------- */ +#ifndef C_ALLOCA +#undef alloca +#define alloca(x) do { } while (0) +#endif + #ifndef XUrgencyHint #define XUrgencyHint (1L << 8) #endif @@ -115,6 +120,10 @@ #define MAX_NUM_WEED_EVENT_TYPES 40 +#define DEBUG_CRE 0 +#define DEBUG_SEND_CN 0 +#define DEBUG_ENTERNOTIFY 0 + /* ---------------------------- local macros ------------------------------- */ /* ---------------------------- imports ------------------------------------ */ @@ -953,13 +962,12 @@ static inline int _merge_cr_moveresize( args.last_cr_event = ev; FWeedIfEvents(dpy, _pred_merge_cr, (XPointer)&args); -#if 1 /*!!!*/ if (args.count > 0) { - fvwm_debug(__func__, "%s: merged %d cr events\n", __func__, - args.count); + fvwm_debug( + __func__, "%s: merged %d cr events\n", __func__, + args.count); } -#endif /* use the count from the structure, not the return value of * FWeedIfEvents() because the predicate has a different way of weeding * and the return value is always zero. */ @@ -1010,17 +1018,18 @@ static inline int _handle_cr_on_client( return 0; } } -#if 0 - fprintf(stderr, - "cre: %d(%d) %d(%d) %d(%d)x%d(%d) fw 0x%08x w 0x%08x " - "ew 0x%08x '%s'\n", - cre->x, (int)(cre->value_mask & CWX), - cre->y, (int)(cre->value_mask & CWY), - cre->width, (int)(cre->value_mask & CWWidth), - cre->height, (int)(cre->value_mask & CWHeight), - (int)FW_W_FRAME(fw), (int)FW_W(fw), (int)cre->window, - (fw->name.name) ? fw->name.name : ""); -#endif + if (DEBUG_CRE) + { + fvwm_debug(__func__, + "cre: %d(%d) %d(%d) %d(%d)x%d(%d) fw 0x%08x w 0x%08x " + "ew 0x%08x '%s'\n", + cre->x, (int)(cre->value_mask & CWX), + cre->y, (int)(cre->value_mask & CWY), + cre->width, (int)(cre->value_mask & CWWidth), + cre->height, (int)(cre->value_mask & CWHeight), + (int)FW_W_FRAME(fw), (int)FW_W(fw), (int)cre->window, + (fw->name.name) ? fw->name.name : ""); + } /* Don't modify frame_g fields before calling SetupWindow! */ memset(&d_g, 0, sizeof(d_g)); @@ -1963,12 +1972,11 @@ void HandleDestroyNotify(const evh_args_t *ea) return; } -#define DEBUG_ENTERNOTIFY 0 #if DEBUG_ENTERNOTIFY static int ecount=0; #define ENTER_DBG(x) fprintf x; #else -#define ENTER_DBG(x) +#define ENTER_DBG(x) do { } while (0) #endif void HandleEnterNotify(const evh_args_t *ea) { @@ -1981,8 +1989,13 @@ void HandleEnterNotify(const evh_args_t *ea) FvwmWindow * const fw = ea->exc->w.fw; ewp = &te->xcrossing; -ENTER_DBG((stderr, "++++++++ en (%d): fw %p w 0x%08x sw 0x%08x mode 0x%x detail 0x%x '%s'\n", ++ecount, fw, (int)ewp->window, (int)ewp->subwindow, ewp->mode, ewp->detail, fw?fw->visible_name:"(none)")); - + ENTER_DBG( + ( + stderr, + "++++++++ en (%d): fw %p w 0x%08x sw 0x%08x mode 0x%x" + " detail 0x%x '%s'\n", ++ecount, fw, (int)ewp->window, + (int)ewp->subwindow, ewp->mode, ewp->detail, + fw?fw->visible_name:"(none)")); if ( ewp->window == Scr.Root && ewp->detail == NotifyInferior && ewp->mode == NotifyNormal) @@ -2020,7 +2033,7 @@ ENTER_DBG((stderr, "++++++++ en (%d): fw %p w 0x%08x sw 0x%08x mode 0x%x detail } if (Scr.flags.is_wire_frame_displayed) { -ENTER_DBG((stderr, "en: exit: iwfd\n")); + ENTER_DBG((stderr, "en: exit: iwfd\n")); /* Ignore EnterNotify events while a window is resized or moved * as a wire frame; otherwise the window list may be screwed * up. */ @@ -2038,13 +2051,13 @@ ENTER_DBG((stderr, "en: exit: iwfd\n")); * windows that don't handle this event. unclutter * triggers these events sometimes, re focusing an * unfocused window under the pointer */ -ENTER_DBG((stderr, "en: exit: funny window\n")); + ENTER_DBG((stderr, "en: exit: funny window\n")); return; } } if (Scr.focus_in_pending_window != NULL) { -ENTER_DBG((stderr, "en: exit: fipw\n")); + ENTER_DBG((stderr, "en: exit: fipw\n")); /* Ignore EnterNotify event while we are waiting for a window to * receive focus via Focus or FlipFocus commands. */ focus_grab_buttons(fw); @@ -2052,12 +2065,12 @@ ENTER_DBG((stderr, "en: exit: fipw\n")); } if (ewp->mode == NotifyGrab) { -ENTER_DBG((stderr, "en: exit: NotifyGrab\n")); + ENTER_DBG((stderr, "en: exit: NotifyGrab\n")); return; } else if (ewp->mode == NotifyNormal) { -ENTER_DBG((stderr, "en: NotifyNormal\n")); + ENTER_DBG((stderr, "en: NotifyNormal\n")); if (ewp->detail == NotifyNonlinearVirtual && ewp->focus == False && ewp->subwindow != None) { @@ -2066,13 +2079,13 @@ ENTER_DBG((stderr, "en: NotifyNormal\n")); * popping up a selection list several times (ddd, * netscape). I'm not convinced that this does not * break something else. */ -ENTER_DBG((stderr, "en: NN: refreshing focus\n")); + ENTER_DBG((stderr, "en: NN: refreshing focus\n")); refresh_focus(fw); } } else if (ewp->mode == NotifyUngrab) { -ENTER_DBG((stderr, "en: NotifyUngrab\n")); + ENTER_DBG((stderr, "en: NotifyUngrab\n")); /* Ignore events generated by grabbing or ungrabbing the * pointer. However, there is no way to prevent the client * application from handling this event and, for example, @@ -2080,7 +2093,10 @@ ENTER_DBG((stderr, "en: NotifyUngrab\n")); * transferred the focus to a different window. */ if (is_initial_ungrab_pending) { -ENTER_DBG((stderr, "en: NU: initial ungrab pending (lgw = NULL)\n")); + ENTER_DBG( + ( + stderr, "en: NU: initial ungrab" + " pending (lgw = NULL)\n")); is_initial_ungrab_pending = False; xcrossing_last_grab_window = NULL; } @@ -2090,17 +2106,27 @@ ENTER_DBG((stderr, "en: NU: initial ungrab pending (lgw = NULL)\n")); ewp->focus == False && ewp->subwindow != None) { /* see comment above */ -ENTER_DBG((stderr, "en: NU: refreshing focus\n")); + ENTER_DBG( + ( + stderr, + "en: NU: refreshing focus\n")); refresh_focus(fw); } if (fw && fw == xcrossing_last_grab_window) { -ENTER_DBG((stderr, "en: exit: NU: is last grab window\n")); + ENTER_DBG( + ( + stderr, "en: exit: NU: is last" + " grab window\n")); if (ewp->window == FW_W_FRAME(fw) || ewp->window == FW_W_ICON_TITLE(fw) || ewp->window == FW_W_ICON_PIXMAP(fw)) { -ENTER_DBG((stderr, "en: exit: NU: last grab window = NULL\n")); + ENTER_DBG( + ( + stderr, "en: exit: NU:" + " last grab window =" + " NULL\n")); xcrossing_last_grab_window = NULL; } focus_grab_buttons(fw); @@ -2113,7 +2139,10 @@ ENTER_DBG((stderr, "en: exit: NU: last grab window = NULL\n")); ewp->window != FW_W_ICON_TITLE(fw) && ewp->window != FW_W_ICON_PIXMAP(fw)) { -ENTER_DBG((stderr, "en: exit: NU: not frame window\n")); + ENTER_DBG( + ( + stderr, "en: exit: NU:" + " not frame window\n")); focus_grab_buttons(fw); return; } @@ -2141,7 +2170,7 @@ ENTER_DBG((stderr, "en: exit: NU: not frame window\n")); if (d.xcrossing.mode == NotifyNormal && d.xcrossing.detail != NotifyInferior) { -ENTER_DBG((stderr, "en: exit: found LeaveNotify\n")); + ENTER_DBG((stderr, "en: exit: found LeaveNotify\n")); return; } } @@ -2279,13 +2308,13 @@ ENTER_DBG((stderr, "en: exit: found LeaveNotify\n")); sf = get_focus_window(); if (sf && fw != sf && FP_DO_UNFOCUS_LEAVE(FW_FOCUS_POLICY(sf))) { -ENTER_DBG((stderr, "en: delete focus\n")); + ENTER_DBG((stderr, "en: delete focus\n")); DeleteFocus(True); } focus_grab_buttons(fw); if (FP_DO_FOCUS_ENTER(FW_FOCUS_POLICY(fw))) { -ENTER_DBG((stderr, "en: set mousey focus\n")); + ENTER_DBG((stderr, "en: set mousey focus\n")); if (ewp->window == FW_W(fw)) { /* Event is for the client window...*/ @@ -2701,7 +2730,13 @@ void HandleLeaveNotify(const evh_args_t *ea) const XEvent *te = ea->exc->x.etrigger; FvwmWindow * const fw = ea->exc->w.fw; -ENTER_DBG((stderr, "-------- ln (%d): fw %p w 0x%08x sw 0x%08x mode 0x%x detail 0x%x '%s'\n", ++ecount, fw, (int)te->xcrossing.window, (int)te->xcrossing.subwindow, te->xcrossing.mode, te->xcrossing.detail, fw?fw->visible_name:"(none)")); + ENTER_DBG( + ( + stderr, "-------- ln (%d): fw %p w 0x%08x sw 0x%08x" + " mode 0x%x detail 0x%x '%s'\n", ++ecount, fw, + (int)te->xcrossing.window, (int)te->xcrossing.subwindow, + te->xcrossing.mode, te->xcrossing.detail, + fw?fw->visible_name:"(none)")); lwp = &te->xcrossing; if ( lwp->window == Scr.Root && @@ -2742,7 +2777,7 @@ ENTER_DBG((stderr, "-------- ln (%d): fw %p w 0x%08x sw 0x%08x mode 0x%x detail lwp->window == FW_W_ICON_TITLE(fw) || lwp->window == FW_W_ICON_PIXMAP(fw))) { -ENTER_DBG((stderr, "ln: *** lgw = %p\n", fw)); + ENTER_DBG((stderr, "ln: *** lgw = %p\n", fw)); xcrossing_last_grab_window = fw; } return; @@ -3117,22 +3152,26 @@ void HandleMapRequestKeepRaised( } else { -#ifndef ICCCM2_UNMAP_WINDOW_PATCH - /* nope, this is forbidden by the ICCCM2 */ - XMapWindow(dpy, FW_W(fw)); - SetMapStateProp(fw, NormalState); -#else - /* Since we will not get a MapNotify, set the - * IS_MAPPED flag manually. */ - SET_MAPPED(fw, 1); - SetMapStateProp(fw, IconicState); - /* fake that the window was mapped to allow - * modules to swallow it */ - BroadcastPacket( - M_MAP, 3, (long)FW_W(fw), - (long)FW_W_FRAME(fw), - (unsigned long)fw); -#endif + if (!ICCCM2_UNMAP_WINDOW_PATCH) + { + /* nope, this is forbidden by the + * ICCCM2 */ + XMapWindow(dpy, FW_W(fw)); + SetMapStateProp(fw, NormalState); + } + else + { + /* Since we will not get a MapNotify, + * set the IS_MAPPED flag manually. */ + SET_MAPPED(fw, 1); + SetMapStateProp(fw, IconicState); + /* fake that the window was mapped to + * allow modules to swallow it */ + BroadcastPacket( + M_MAP, 3, (long)FW_W(fw), + (long)FW_W_FRAME(fw), + (unsigned long)fw); + } } /* TA: 20090125: We *have* to handle * InitialMapCommand here and not in AddWindow() to @@ -3924,15 +3963,19 @@ void SendConfigureNotify( client_event.xconfigure.border_width = bw; client_event.xconfigure.above = FW_W_FRAME(fw); client_event.xconfigure.override_redirect = False; -#if 0 - fprintf(stderr, - "send cn: %d %d %dx%d fw 0x%08x w 0x%08x ew 0x%08x '%s'\n", - client_event.xconfigure.x, client_event.xconfigure.y, - client_event.xconfigure.width, client_event.xconfigure.height, - (int)FW_W_FRAME(fw), (int)FW_W(fw), - (int)client_event.xconfigure.window, - (fw->name.name) ? fw->name.name : ""); -#endif + if (DEBUG_SEND_CN) + { + fprintf( + stderr, + "send cn: %d %d %dx%d fw 0x%08x w 0x%08x ew 0x%08x" + " '%s'\n", + client_event.xconfigure.x, client_event.xconfigure.y, + client_event.xconfigure.width, + client_event.xconfigure.height, + (int)FW_W_FRAME(fw), (int)FW_W(fw), + (int)client_event.xconfigure.window, + (fw->name.name) ? fw->name.name : ""); + } fev_sanitise_configure_notify(&client_event.xconfigure); FSendEvent( dpy, FW_W(fw), False, StructureNotifyMask, &client_event); @@ -4136,12 +4179,10 @@ void dispatch_event(XEvent *e) exc_destroy_context(ea.exc); } -#ifdef C_ALLOCA /* If we're using the C version of alloca, see if anything needs to be * freed up. */ alloca(0); -#endif return; } diff --git a/fvwm/ewmh.c b/fvwm/ewmh.c index 1f00ddb23..e4e848003 100644 --- a/fvwm/ewmh.c +++ b/fvwm/ewmh.c @@ -53,6 +53,8 @@ #include "config.h" #include +#include +#include #include "libs/fvwm_x11.h" #include "libs/fvwmlib.h" #include "fvwm.h" @@ -71,6 +73,8 @@ #include "geometry.h" #include "window_flags.h" +#define EWMH_DEBUG 0 + typedef struct kst_item { Window w; @@ -253,6 +257,47 @@ ewmh_atom_list atom_list[] = L_ENTRY(EWMH_ATOM_LIST_END, NULL) }; +static void EWMH_DLOG(char *msg, ...) +{ + if (EWMH_DEBUG) + { + va_list args; + clock_t time_val, time_taken; + static clock_t start_time = 0; + static clock_t prev_time = 0; + struct tms not_used_tms; + char buffer[200]; /* oversized */ + time_t mytime; + struct tm *t_ptr; + + time(&mytime); + t_ptr = localtime(&mytime); + if (start_time == 0) + { + /* get clock ticks */ + prev_time = start_time = + (unsigned int)times(¬_used_tms); + } + /* get clock ticks */ + time_val = (unsigned int)times(¬_used_tms); + time_taken = time_val - prev_time; + prev_time = time_val; + sprintf( + buffer, "%.2d:%.2d:%.2d %6ld", + t_ptr->tm_hour, t_ptr->tm_min, t_ptr->tm_sec, + time_taken); + + fvwm_debug(__func__, "EWMH DEBUG: "); + va_start(args,msg); + vfprintf(stderr, msg, args); + va_end(args); + fvwm_debug(__func__, "\n"); + fvwm_debug(__func__, " [time]: %s\n",buffer); + } + + return; +} + /* * Atoms utilities */ @@ -647,7 +692,7 @@ void EWMH_SetWMState(FvwmWindow *fw, Bool do_restore) */ /*** kde system tray ***/ -/* #define DEBUG_KST */ +#define DEBUG_KST 0 static void add_kst_item(Window w) { @@ -713,20 +758,23 @@ void set_kde_sys_tray(void) } t = ewmh_KstWinList; -#ifdef DEBUG_KST - fvwm_debug(__func__, "ADD_TO_KST: "); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "ADD_TO_KST: "); + } while (t != NULL) { -#ifdef DEBUG_KST - fvwm_debug(__func__, "0x%lx ",t->w); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "0x%lx ",t->w); + } wins[i++] = t->w; t = t->next; } -#ifdef DEBUG_KST - fvwm_debug(__func__, "\n"); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "\n"); + } ewmh_ChangeProperty(Scr.Root,"_KDE_NET_SYSTEM_TRAY_WINDOWS", EWMH_ATOM_LIST_FVWM_ROOT, @@ -802,9 +850,10 @@ int EWMH_IsKdeSysTrayWindow(Window w) { return 0; } -#ifdef DEBUG_KST - fvwm_debug(__func__, "IsKdeSysTrayWindow: 0x%lx\n", w); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "IsKdeSysTrayWindow: 0x%lx\n", w); + } return 1; } @@ -825,32 +874,36 @@ void EWMH_ManageKdeSysTray(Window w, int type) switch(type) { case UnmapNotify: -#ifdef DEBUG_KST - fvwm_debug(__func__, "KST_UNMAP: 0x%lx\n", w); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "KST_UNMAP: 0x%lx\n", w); + } XSelectInput(dpy, w, StructureNotifyMask); XFlush(dpy); break; case DestroyNotify: -#ifdef DEBUG_KST - fvwm_debug(__func__, "KST_DESTROY: 0x%lx\n", w); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "KST_DESTROY: 0x%lx\n", w); + } XSelectInput(dpy, t->w, NoEventMask); XFlush(dpy); delete_kst_item(w); set_kde_sys_tray(); break; case ReparentNotify: -#ifdef DEBUG_KST - fvwm_debug(__func__, "KST_Reparent: 0x%lx\n", w); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "KST_Reparent: 0x%lx\n", w); + } XSelectInput(dpy, w, StructureNotifyMask); XFlush(dpy); break; default: -#ifdef DEBUG_KST - fvwm_debug(__func__, "KST_NO: 0x%lx\n", w); -#endif + if (DEBUG_KST) + { + fvwm_debug(__func__, "KST_NO: 0x%lx\n", w); + } break; } @@ -1728,7 +1781,7 @@ static void ewmh_check_wm_pid(FvwmWindow *fw) /* see also EWMH_WMName and EWMH_WMIconName in add_window */ void EWMH_WindowInit(FvwmWindow *fw) { - /*EWMH_DLOG("Init window 0x%lx",FW_W(fw));*/ + EWMH_DLOG("Init window 0x%lx", FW_W(fw)); EWMH_SetWMState(fw, False); EWMH_SetWMDesktop(fw); EWMH_SetAllowedActions(fw); @@ -1746,7 +1799,7 @@ void EWMH_WindowInit(FvwmWindow *fw) } ewmh_WMIcon(fw, NULL, NULL, 0); ewmh_check_wm_pid(fw); - /*EWMH_DLOG("window 0x%lx initialised",FW_W(fw));*/ + EWMH_DLOG("window 0x%lx initialised", FW_W(fw)); return; } @@ -1949,44 +2002,6 @@ void EWMH_ExitStuff(void) return; } -#ifdef EWMH_DEBUG -void EWMH_DLOG(char *msg, ...) -{ - va_list args; - clock_t time_val, time_taken; - static clock_t start_time = 0; - static clock_t prev_time = 0; - struct tms not_used_tms; - char buffer[200]; /* oversized */ - time_t mytime; - struct tm *t_ptr; - - time(&mytime); - t_ptr = localtime(&mytime); - if (start_time == 0) - { - /* get clock ticks */ - prev_time = start_time = (unsigned int)times(¬_used_tms); - } - /* get clock ticks */ - time_val = (unsigned int)times(¬_used_tms); - time_taken = time_val - prev_time; - prev_time = time_val; - sprintf( - buffer, "%.2d:%.2d:%.2d %6ld", - t_ptr->tm_hour, t_ptr->tm_min, t_ptr->tm_sec, time_taken); - - fvwm_debug(__func__, "EWMH DEBUG: "); - va_start(args,msg); - vfprintf(stderr, msg, args); - va_end(args); - fvwm_debug(__func__, "\n"); - fvwm_debug(__func__, " [time]: %s\n",buffer); - - return; -} -#endif - void EWMH_fullscreen(FvwmWindow *fw) { fscreen_scr_arg fscr; diff --git a/fvwm/ewmh_intern.h b/fvwm/ewmh_intern.h index e4ff218c2..5b7d665e5 100644 --- a/fvwm/ewmh_intern.h +++ b/fvwm/ewmh_intern.h @@ -7,13 +7,6 @@ /* Extended window manager hints support */ -/* #define EWMH_DEBUG */ -#ifdef EWMH_DEBUG -#include -#include -#include "ftime.h" -#endif - typedef struct ewmh_atom { char *name; @@ -189,11 +182,4 @@ CARD32 *ewmh_SetWmIconFromPixmap( FvwmWindow *fw, CARD32 *orig_icon, int *orig_size, Bool is_mini_icon); -/* debugging */ -#ifdef EWMH_DEBUG -void EWMH_DLOG(char *msg, ...); -#else - -#endif - #endif /* FVWM_EWMH_INTERN_H */ diff --git a/fvwm/execcontext.c b/fvwm/execcontext.c index d67188fab..dd6bdd561 100644 --- a/fvwm/execcontext.c +++ b/fvwm/execcontext.c @@ -40,11 +40,9 @@ /* ---------------------------- local variables ---------------------------- */ -#undef DEBUG_EXECCONTEXT -#ifdef DEBUG_EXECCONTEXT +#define DEBUG_EXECCONTEXT 0 static exec_context_t *x[256]; static int nx = 0; -#endif /* ---------------------------- exported variables (globals) --------------- */ @@ -95,17 +93,21 @@ static void __exc_change_context( const exec_context_t *exc_create_null_context(void) { exec_context_t *exc; -#ifdef DEBUG_EXECCONTEXT - int i; -#endif exc = fxcalloc(1, sizeof(exec_context_t)); -#ifdef DEBUG_EXECCONTEXT -fvwm_debug(__func__, "xxx+0 "); -for(i=0;itype = EXCT_NULL; fev_make_null_event(&exc->private_data.te, dpy); exc->x.etrigger = &exc->private_data.te; @@ -120,9 +122,13 @@ const exec_context_t *exc_create_context( { exec_context_t *exc; -#ifdef DEBUG_EXECCONTEXT -if (!(mask & ECC_TYPE)) abort(); -#endif + if (DEBUG_EXECCONTEXT) + { + if (!(mask & ECC_TYPE)) + { + abort(); + } + } exc = (exec_context_t *)exc_create_null_context(); __exc_change_context(exc, ecc, mask); @@ -134,17 +140,21 @@ const exec_context_t *exc_clone_context( exec_context_change_mask_t mask) { exec_context_t *exc; -#ifdef DEBUG_EXECCONTEXT -int i; -#endif exc = fxmalloc(sizeof(exec_context_t)); -#ifdef DEBUG_EXECCONTEXT -fvwm_debug(__func__, "xxx+= "); -for(i=0;ixNoGrabMask) #define MOD_SYNCMASK(m) ((m)->xSyncMask) @@ -272,17 +279,17 @@ static fmodule *do_execute_module( } goto err_exit; } -#ifdef REMOVE_EXECUTABLE_EXTENSION + if (REMOVE_EXECUTABLE_EXTENSION && EXECUTABLE_EXTENSION != NULL) { char *p; + char *ext = EXECUTABLE_EXTENSION; - p = arg1 + strlen(arg1) - strlen(EXECUTABLE_EXTENSION); - if (strcmp(p, EXECUTABLE_EXTENSION) == 0) + p = arg1 + strlen(arg1) - strlen(ext); + if (strcmp(p, ext) == 0) { *p = 0; } } -#endif /* I want one-ended pipes, so I open two two-ended pipes, * and close one end of each. I need one ended pipes so that @@ -408,11 +415,12 @@ static fmodule *do_execute_module( { /* this is the child */ /* this fork execs the module */ -#ifdef FORK_CREATES_CHILD - /* dont't care that this may be -1 */ - close(fvwm_to_app[1]); - close(app_to_fvwm[0]); -#endif + if (FORK_CREATES_CHILD) + { + /* dont't care that this may be -1 */ + close(fvwm_to_app[1]); + close(app_to_fvwm[0]); + } fvmm_deinstall_signals(); if (!Pdefault) { @@ -441,9 +449,10 @@ static fmodule *do_execute_module( close(app_to_fvwm[1]); /* dont't care that this may be -1 */ close(fvwm_to_app[0]); -#ifdef FORK_CREATES_CHILD - exit(1); -#endif + if (FORK_CREATES_CHILD) + { + exit(1); + } } else { diff --git a/fvwm/move_resize.c b/fvwm/move_resize.c index 7ca1596c3..4d49b63e5 100644 --- a/fvwm/move_resize.c +++ b/fvwm/move_resize.c @@ -60,6 +60,8 @@ #include "style.h" #include "externs.h" +#define DEBUG_CONFIGURENOTIFY 0 + /* ----- move globals ----- */ #define MOVE_NORMAL 0x00 @@ -1741,12 +1743,15 @@ static void AnimatedMoveAnyWindow( fw, currentX, currentY, fw->g.frame.width, fw->g.frame.height, 0, False); -#ifdef FVWM_DEBUG_MSGS - fvwm_debug(__func__, - "Sent ConfigureNotify (w == %d, h == %d)", - fw->g.frame.width, - fw->g.frame.height); -#endif + if (DEBUG_CONFIGURENOTIFY) + { + fvwm_debug( + __func__, + "Sent ConfigureNotify" + " (w == %d, h == %d)", + fw->g.frame.width, + fw->g.frame.height); + } } XFlush(dpy); if (fw) @@ -3140,17 +3145,20 @@ Bool __move_loop( SendConfigureNotify( fw, xl, yt, Width, Height, 0, False); -#ifdef FVWM_DEBUG_MSGS - fvwm_debug(__func__, - "Sent ConfigureNotify (w %d, h %d)", - Width, Height); -#endif + if (DEBUG_CONFIGURENOTIFY) + { + fvwm_debug( + __func__, + "Sent ConfigureNotify" + " (w %d, h %d)", + Width, Height); + } } } if (do_move_opaque) { if (!IS_ICONIFIED(fw)) - { + { fw_copy.g.frame.x = xl; fw_copy.g.frame.y = yt; } diff --git a/fvwm/session.c b/fvwm/session.c index 2b1e7d6d6..b9c16e74f 100644 --- a/fvwm/session.c +++ b/fvwm/session.c @@ -51,8 +51,8 @@ /* ---------------------------- local definitions -------------------------- */ -/*#define FVWM_SM_DEBUG_PROTO*/ -/*#define FVWM_SM_DEBUG_WINMATCH*/ +#define FVWM_SM_DEBUG_PROTO 0 +#define FVWM_SM_DEBUG_WINMATCH 0 /* ---------------------------- local macros ------------------------------- */ @@ -663,45 +663,46 @@ static Bool matchWin(FvwmWindow *w, Match *m) } /* else no window roles */ } /* if client_id's agree */ -#ifdef FVWM_SM_DEBUG_WINMATCH - fvwm_debug(__func__, - "\twin(%s, %s, %s, %s, %s,", - w->class.res_name, w->class.res_class, w->name.name, - (client_id)? client_id:"(null)", - (window_role)? window_role:"(null)"); - if (wm_command) + if (FVWM_SM_DEBUG_WINMATCH) { - for (i = 0; i < wm_command_count; i++) + fvwm_debug(__func__, + "\twin(%s, %s, %s, %s, %s,", + w->class.res_name, w->class.res_class, w->name.name, + (client_id)? client_id:"(null)", + (window_role)? window_role:"(null)"); + if (wm_command) { - fvwm_debug(__func__, " %s", wm_command[i]); + for (i = 0; i < wm_command_count; i++) + { + fvwm_debug(__func__, " %s", wm_command[i]); + } + fvwm_debug(__func__, ","); } - fvwm_debug(__func__, ","); - } - else - { - fvwm_debug(__func__, " no_wmc,"); - } - fvwm_debug(__func__, " %d)", IS_NAME_CHANGED(w)); - fvwm_debug(__func__, "\n[%d]", found); - fvwm_debug(__func__, - "\tmat(%s, %s, %s, %s, %s,", - m->res_name, m->res_class, m->wm_name, - (m->client_id)?m->client_id:"(null)", - (m->window_role)?m->window_role:"(null)"); - if (m->wm_command) - { - for (i = 0; i < m->wm_command_count; i++) + else { - fvwm_debug(__func__, " %s", m->wm_command[i]); + fvwm_debug(__func__, " no_wmc,"); } - fvwm_debug(__func__, ","); - } - else - { - fvwm_debug(__func__, " no_wmc,"); + fvwm_debug(__func__, " %d)", IS_NAME_CHANGED(w)); + fvwm_debug(__func__, "\n[%d]", found); + fvwm_debug(__func__, + "\tmat(%s, %s, %s, %s, %s,", + m->res_name, m->res_class, m->wm_name, + (m->client_id)?m->client_id:"(null)", + (m->window_role)?m->window_role:"(null)"); + if (m->wm_command) + { + for (i = 0; i < m->wm_command_count; i++) + { + fvwm_debug(__func__, " %s", m->wm_command[i]); + } + fvwm_debug(__func__, ","); + } + else + { + fvwm_debug(__func__, " no_wmc,"); + } + fvwm_debug(__func__, " %d)\n\n", IS_NAME_CHANGED(m)); } - fvwm_debug(__func__, " %d)\n\n", IS_NAME_CHANGED(m)); -#endif if (client_id) { @@ -770,12 +771,14 @@ set_sm_properties(FSmcConn sm_conn, char *filename, char hint) return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, - "[FVWM_SMDEBUG][set_sm_properties] state filename: %s%s\n", - filename ? filename : "(null)", - sm_conn ? "" : " - not connected"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, + "[FVWM_SMDEBUG][set_sm_properties] state filename:" + " %s%s\n", filename ? filename : "(null)", + sm_conn ? "" : " - not connected"); + } if (!sm_conn) { @@ -967,9 +970,11 @@ callback_save_yourself2(FSmcConn sm_conn, FSmPointer client_data) } filename = get_unique_state_filename(); -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_save_yourself2]\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG][callback_save_yourself2]\n"); + } success = save_state_file(filename); if (success) @@ -994,42 +999,51 @@ callback_save_yourself(FSmcConn sm_conn, FSmPointer client_data, return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_save_yourself] " - "(save=%d, shut=%d, intr=%d, fast=%d)\n", - save_style, shutdown, interact_style, fast); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG][callback_save_yourself] " + "(save=%d, shut=%d, intr=%d, fast=%d)\n", + save_style, shutdown, interact_style, fast); + } if (save_style == FSmSaveGlobal) { /* nothing to do */ -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_save_yourself] " - "Global Save type ... do nothing\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, + "[FVWM_SMDEBUG][callback_save_yourself] " + "Global Save type ... do nothing\n"); + } FSmcSaveYourselfDone (sm_conn, True); sent_save_done = 1; return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_save_yourself] " - "Both or Local save type, going to phase 2 ..."); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG][callback_save_yourself] " + "Both or Local save type, going to phase 2 ..."); + } if (!FSmcRequestSaveYourselfPhase2( sm_conn, callback_save_yourself2, NULL)) { FSmcSaveYourselfDone (sm_conn, False); sent_save_done = 1; -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, " failed!\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug(__func__, " failed!\n"); + } } else { -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, " OK\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug(__func__, " OK\n"); + } sent_save_done = 0; } @@ -1045,9 +1059,10 @@ callback_die(FSmcConn sm_conn, FSmPointer client_data) return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_die]\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_die]\n"); + } if (FSmcCloseConnection(sm_conn, 0, NULL) != FSmcClosedNow) { @@ -1069,9 +1084,11 @@ callback_save_complete(FSmcConn sm_conn, FSmPointer client_data) { return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_save_complete]\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG][callback_save_complete]\n"); + } return; } @@ -1084,9 +1101,12 @@ callback_shutdown_cancelled(FSmcConn sm_conn, FSmPointer client_data) return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][callback_shutdown_cancelled]\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, + "[FVWM_SMDEBUG][callback_shutdown_cancelled]\n"); + } if (!sent_save_done) { @@ -1681,10 +1701,12 @@ RestartInSession (char *filename, Bool is_native, Bool _do_preserve_state) /* go a head any way ? */ } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG]: Exiting, now SM must " - "restart us.\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG]: Exiting, now SM" + " must restart us.\n"); + } /* Close all my pipes */ module_kill_all(); @@ -1752,16 +1774,21 @@ SessionInit(void) error_string_ret); } sm_fd = -1; -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG] No SM connection\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG] No SM connection\n"); + } } else { sm_fd = FIceConnectionNumber(FSmcGetIceConnection(sm_conn)); -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG] Connectecd to a SM\n"); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, + "[FVWM_SMDEBUG] Connectecd to a SM\n"); + } set_init_function_name(0, "SessionInitFunction"); set_init_function_name(1, "SessionRestartFunction"); set_init_function_name(2, "SessionExitFunction"); @@ -1783,10 +1810,12 @@ ProcessICEMsgs(void) return; } -#ifdef FVWM_SM_DEBUG_PROTO - fvwm_debug(__func__, "[FVWM_SMDEBUG][ProcessICEMsgs] %i\n", - (int)sm_fd); -#endif + if (FVWM_SM_DEBUG_PROTO) + { + fvwm_debug( + __func__, "[FVWM_SMDEBUG][ProcessICEMsgs] %i\n", + (int)sm_fd); + } if (sm_fd < 0) { return; diff --git a/fvwm/stack.c b/fvwm/stack.c index 36aefc98d..98c5cd9bc 100644 --- a/fvwm/stack.c +++ b/fvwm/stack.c @@ -97,7 +97,7 @@ static int collect_transients_recursive( /* ---------------------------- local functions ---------------------------- */ #define DEBUG_STACK_RING 1 -#ifdef DEBUG_STACK_RING +#if DEBUG_STACK_RING /* debugging function */ static void dump_stack_ring(void) { @@ -150,8 +150,8 @@ void verify_stack_ring_consistency(void) if (t1->layer > last_layer) { fvwm_debug(__func__, - "vsrc: stack ring is corrupt! '%s' (layer %d)" - " is above '%s' (layer %d/%d)\n", + "vsrc: stack ring is corrupt! '%s'" + " (layer %d) is above '%s' (layer %d/%d)\n", t1->name.name, t1->layer, t2->name.name, t2->layer, last_layer); dump_stack_ring(); @@ -240,6 +240,8 @@ void verify_stack_ring_consistency(void) return; } +#else +#define verify_stack_ring_consistency() do { } while (0) #endif /* Add a whole ring of windows. The list_head itself will not be added. */ @@ -1382,9 +1384,10 @@ static void BroadcastRestack(FvwmWindow *s1, FvwmWindow *s2) } free(body); } -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } return; } @@ -1551,15 +1554,18 @@ static Bool is_on_top_of_layer_ignore_rom(FvwmWindow *fw) return ontop; } +#define EXPERIMENTAL_ROU_HANDLING 0 +#define ROUDEBUG 0 static Bool __is_on_top_of_layer(FvwmWindow *fw, Bool client_entered) { Window junk; Bool ontop = False; - if (Scr.bo.do_raise_over_unmanaged) + if (!Scr.bo.do_raise_over_unmanaged) + { + return is_on_top_of_layer_ignore_rom(fw); + } + if (EXPERIMENTAL_ROU_HANDLING) { - -#define EXPERIMENTAL_ROU_HANDLING -#ifdef EXPERIMENTAL_ROU_HANDLING /* RBW - 2002/08/15 - RaiseOverUnmanaged adds some overhead. The only way to let our @@ -1580,23 +1586,28 @@ static Bool __is_on_top_of_layer(FvwmWindow *fw, Bool client_entered) if (client_entered) /* FIXME! - perhaps we should only do if MFCR */ { -#ifdef ROUDEBUG - printf("RBW-iotol - %8.8lx is on top," - " checking server tree. ***\n", - FW_W_CLIENT(fw)); -#endif + if (ROUDEBUG) + { + printf("RBW-iotol - %8.8lx is on top," + " checking server tree. ***\n", + FW_W_CLIENT(fw)); + } ontop = is_above_unmanaged(fw, &junk); -#ifdef ROUDEBUG - printf(" returning %d\n", (int) ontop); -#endif + if (ROUDEBUG) + { + printf( + " returning %d\n", + (int) ontop); + } } else { -#ifdef ROUDEBUG - printf("RBW-iotol - %8.8lx is on top," - " *** NOT checking server tree.\n", - FW_W_CLIENT(fw)); -#endif + if (ROUDEBUG) + { + printf("RBW-iotol - %8.8lx is on top," + " *** NOT checking server" + " tree.\n", FW_W_CLIENT(fw)); + } ontop = True; } return ontop; @@ -1605,13 +1616,10 @@ static Bool __is_on_top_of_layer(FvwmWindow *fw, Bool client_entered) { return False; } -#else - return False; /* Old pre-2002/08/22 handling. */ -#endif } else { - return is_on_top_of_layer_ignore_rom(fw); + return False; /* Old pre-2002/08/22 handling. */ } } @@ -1715,9 +1723,11 @@ void RaiseWindow(FvwmWindow *t, Bool is_client_request) (unsigned long)t); raise_or_lower_window(t, SM_RAISE, True, False, is_client_request); focus_grab_buttons_on_layer(t->layer); -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } + return; } @@ -1728,9 +1738,11 @@ void LowerWindow(FvwmWindow *t, Bool is_client_request) (unsigned long)t); raise_or_lower_window(t, SM_LOWER, True, False, is_client_request); focus_grab_buttons_on_layer(t->layer); -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } + return; } @@ -1738,9 +1750,11 @@ void RestackWindow(FvwmWindow *t, Bool is_client_request) { raise_or_lower_window(t, SM_RESTACK, True, False, is_client_request); focus_grab_buttons_on_layer(t->layer); -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } + return; } @@ -1797,9 +1811,11 @@ Bool HandleUnusualStackmodes( break; } /* DBUG("HandleUnusualStackmodes", "\t---> %d\n", do_restack);*/ -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } + return do_restack; } @@ -2122,9 +2138,10 @@ void CMD_Layer(F_CMD_ARGS) layer = 0; } new_layer(fw, layer); -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } return; } @@ -2178,9 +2195,10 @@ void CMD_DefaultLayers(F_CMD_ARGS) Scr.TopLayer = i; } } -#ifdef DEBUG_STACK_RING - verify_stack_ring_consistency(); -#endif + if (DEBUG_STACK_RING) + { + verify_stack_ring_consistency(); + } return; } diff --git a/fvwm/stack.h b/fvwm/stack.h index 1380a44a3..b9fa10828 100644 --- a/fvwm/stack.h +++ b/fvwm/stack.h @@ -5,10 +5,6 @@ #include "fvwm.h" -#define DEBUG_STACK_RING 1 -#ifdef DEBUG_STACK_RING -void verify_stack_ring_consistency(void); -#endif void remove_window_from_stack_ring(FvwmWindow *t); void add_window_to_stack_ring_after(FvwmWindow *t, FvwmWindow *add_after_win); FvwmWindow *get_next_window_in_stack_ring(const FvwmWindow *t); diff --git a/fvwm/virtual.c b/fvwm/virtual.c index e412bb394..cfe1ec17b 100644 --- a/fvwm/virtual.c +++ b/fvwm/virtual.c @@ -438,10 +438,11 @@ static void unmap_window(FvwmWindow *t) { XUnmapWindow(dpy,FW_W_FRAME(t)); border_undraw_decorations(t); -#ifdef ICCCM2_UNMAP_WINDOW_PATCH - /* this is required by the ICCCM2 */ - XUnmapWindow(dpy, FW_W(t)); -#endif + if (ICCCM2_UNMAP_WINDOW_PATCH) + { + /* this is required by the ICCCM2 */ + XUnmapWindow(dpy, FW_W(t)); + } if (!Scr.bo.do_enable_ewmh_iconic_state_workaround) { SetMapStateProp(t, IconicState); @@ -501,10 +502,11 @@ static void map_window(FvwmWindow *t) XMapWindow(dpy, FW_W_FRAME(t)); XMapWindow(dpy, FW_W_PARENT(t)); XMapSubwindows(dpy, FW_W_FRAME(t)); -#ifdef ICCCM2_UNMAP_WINDOW_PATCH - /* this is required by the ICCCM2 */ - XMapWindow(dpy, FW_W(t)); -#endif + if (ICCCM2_UNMAP_WINDOW_PATCH) + { + /* this is required by the ICCCM2 */ + XMapWindow(dpy, FW_W(t)); + } if (!Scr.bo.do_enable_ewmh_iconic_state_workaround) { SetMapStateProp(t, NormalState); diff --git a/libs/Fsvg.h b/libs/Fsvg.h index 120d7e3e0..eba704148 100644 --- a/libs/Fsvg.h +++ b/libs/Fsvg.h @@ -87,3 +87,7 @@ #endif #endif /* FVWMLIB_FSVG_H */ + +#ifndef Frsvg_init +#define Frsvg_init() do { } while (0) +#endif diff --git a/libs/fvwmlib3.c b/libs/fvwmlib3.c index 229203961..7cd82d63b 100644 --- a/libs/fvwmlib3.c +++ b/libs/fvwmlib3.c @@ -54,9 +54,7 @@ void flib_init_graphics(Display *dpy) AllocColorset(0); FShapeInit(dpy); FRenderInit(dpy); -#ifdef Frsvg_init Frsvg_init(); -#endif return; }