From 620a280d64c50838985b9ca0a99afc8a304b41a2 Mon Sep 17 00:00:00 2001 From: kojima Date: Fri, 22 Oct 2004 23:39:11 +0000 Subject: [PATCH] code review --- WINGs/winputmethod.c | 4 ++-- src/actions.c | 2 ++ src/defaults.c | 2 -- src/event.c | 48 ------------------------------------------------ src/placement.c | 33 ++++++++++++++++----------------- src/screen.h | 4 ---- src/wmspec.c | 1 - src/xdnd.c | 1 - 8 files changed, 20 insertions(+), 75 deletions(-) diff --git a/WINGs/winputmethod.c b/WINGs/winputmethod.c index b8149094..303d5601 100644 --- a/WINGs/winputmethod.c +++ b/WINGs/winputmethod.c @@ -35,7 +35,6 @@ W_InitIMStuff(WMScreen *scr) return False; } - //XGetIMValues(scr->display, } @@ -63,7 +62,8 @@ W_CreateIC(WMView *view) ctx->next = scr->imctx->icList; if (scr->imctx->icList) scr->imctx->icList->prev = ctx; - //scr->imctx = ctx; + + } diff --git a/src/actions.c b/src/actions.c index e3d573b6..eb453ab3 100644 --- a/src/actions.c +++ b/src/actions.c @@ -548,8 +548,10 @@ wUnfullscreenWindow(WWindow *wwin) wwin->bfs_geometry.width, wwin->bfs_geometry.height); wWindowConfigureBorders(wwin); + /* // seems unnecessary, but also harmless (doesn't generate flicker) -Dan wFrameWindowPaint(wwin->frame); + */ WMPostNotificationName(WMNChangedState, wwin, "fullscreen"); } diff --git a/src/defaults.c b/src/defaults.c index 65868128..f3334911 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -3210,8 +3210,6 @@ setIconTitleBack(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo) if (scr->icon_title_texture) { wTextureDestroy(scr, (WTexture*)scr->icon_title_texture); } - /* // ?? why is this necessary? color was already parsed and alloc'ed */ - XQueryColor (dpy, scr->w_colormap, color); scr->icon_title_texture = wTextureMakeSolid(scr, color); return REFRESH_ICON_TITLE_BACK; diff --git a/src/event.c b/src/event.c index 5baa5f9b..b90038c5 100644 --- a/src/event.c +++ b/src/event.c @@ -1759,54 +1759,6 @@ handleMotionNotify(XEvent *event) wMenuScroll(menu, event); } } - -#if 0 // what is with this? -Dan - if (event->xmotion.subwindow == None) - return; - - if (scr->scrolledFMaximize != None) { - WWindow *twin; - - twin = wWindowFor(scr->scrolledFMaximize); - if (twin && twin->frame_y ==) { - - - } - scr->scrolledFMaximize = NULL; - - } else { - - /* scroll full maximized window */ - if (event->xmotion.y_root < 1 - || event->xmotion.y_root > scr->scr_height - 1) { - - wwin = wWindowFor(event->xmotion.subwindow); - - if (wwin && (wwin->flags.maximized & MAX_VERTICAL) - && WFLAGP(wwin, full_maximize) - && event->xmotion.x_root >= wwin->frame_x - && event->xmotion.x_root <= wwin->frame_x + wwin->frame->core->width) { - - if (HAS_BORDER(wwin) - && wwin->frame_y <= - wwin->frame->top_width) { - - wWindowMove(wwin, wwin->frame_x, 0); - wwin->flags.dragged_while_fmaximized = 0; - - } else if (HAS_RESIZEBAR(wwin) - && wwin->frame_y + wwin->frame->core->height >= - scr->scr_height + wwin->frame->bottom_width) { - - int y = scr->scr_height + wwin->frame->bottom_width; - - y = scr->scr_height - wwin->frame_y - wwin->frame->core->height; - - wWindowMove(wwin, wwin->frame_x, y); - wwin->flags.dragged_while_fmaximized = 0; - } - } - } -#endif } diff --git a/src/placement.c b/src/placement.c index 83da4e21..b6973676 100644 --- a/src/placement.c +++ b/src/placement.c @@ -45,10 +45,10 @@ extern WPreferences wPreferences; -#define X_ORIGIN(scr) WMAX(usableArea.x1,\ +#define X_ORIGIN WMAX(usableArea.x1,\ wPreferences.window_place_origin.x) -#define Y_ORIGIN(scr) WMAX(usableArea.y1,\ +#define Y_ORIGIN WMAX(usableArea.y1,\ wPreferences.window_place_origin.y) @@ -348,8 +348,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, unsigned int width, unsigned int height, WArea usableArea) { - //WScreen *scr = wwin->screen_ptr; - int test_x = 0, test_y = Y_ORIGIN(scr); + int test_x = 0, test_y = Y_ORIGIN; int from_x, to_x, from_y, to_y; int sx; int min_isect, min_isect_x, min_isect_y; @@ -365,7 +364,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, height += 2; width += 2; } - sx = X_ORIGIN(scr); + sx = X_ORIGIN; min_isect = INT_MAX; min_isect_x = sx; @@ -389,13 +388,13 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, } from_x = min_isect_x - PLACETEST_HSTEP + 1; - from_x = WMAX(from_x, X_ORIGIN(scr)); + from_x = WMAX(from_x, X_ORIGIN); to_x = min_isect_x + PLACETEST_HSTEP; if (to_x + width > usableArea.x2) to_x = usableArea.x2 - width; from_y = min_isect_y - PLACETEST_VSTEP + 1; - from_y = WMAX(from_y, Y_ORIGIN(scr)); + from_y = WMAX(from_y, Y_ORIGIN); to_y = min_isect_y + PLACETEST_VSTEP; if (to_y + height > usableArea.y2) to_y = usableArea.y2 - height; @@ -424,7 +423,7 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, WArea usableArea) { WScreen *scr = wwin->screen_ptr; - int test_x = 0, test_y = Y_ORIGIN(scr); + int test_x = 0, test_y = Y_ORIGIN; int loc_ok = False, tw,tx,ty,th; int swidth, sx; WWindow *test_window; @@ -441,7 +440,7 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, } swidth = usableArea.x2-usableArea.x1; - sx = X_ORIGIN(scr); + sx = X_ORIGIN; /* this was based on fvwm2's smart placement */ @@ -550,13 +549,13 @@ cascadeWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret, width += 2; } - *x_ret = h * scr->cascade_index + X_ORIGIN(scr); - *y_ret = h * scr->cascade_index + Y_ORIGIN(scr); + *x_ret = h * scr->cascade_index + X_ORIGIN; + *y_ret = h * scr->cascade_index + Y_ORIGIN; if (width + *x_ret > usableArea.x2 || height + *y_ret > usableArea.y2) { scr->cascade_index = 0; - *x_ret = X_ORIGIN(scr); - *y_ret = Y_ORIGIN(scr); + *x_ret = X_ORIGIN; + *y_ret = Y_ORIGIN; } } @@ -579,12 +578,12 @@ randomPlaceWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret, width += 2; } - w = ((usableArea.x2-X_ORIGIN(scr)) - width); - h = ((usableArea.y2-Y_ORIGIN(scr)) - height); + w = ((usableArea.x2-X_ORIGIN) - width); + h = ((usableArea.y2-Y_ORIGIN) - height); if (w<1) w = 1; if (h<1) h = 1; - *x_ret = X_ORIGIN(scr) + rand()%w; - *y_ret = Y_ORIGIN(scr) + rand()%h; + *x_ret = X_ORIGIN + rand()%w; + *y_ret = Y_ORIGIN + rand()%h; } diff --git a/src/screen.h b/src/screen.h index 5c4b8b05..03f74f4a 100644 --- a/src/screen.h +++ b/src/screen.h @@ -288,10 +288,6 @@ typedef struct _WScreen { Window autoRaiseWindow; /* window that is scheduled to be * raised */ - - Window scrolledFMaximize; /* full maximized window which was - scrolled down for titlebar access */ - /* for window shortcuts */ WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS]; diff --git a/src/wmspec.c b/src/wmspec.c index fa8236e5..503bfc0d 100644 --- a/src/wmspec.c +++ b/src/wmspec.c @@ -1645,7 +1645,6 @@ wsobserver(void *self, WMNotification *notif) { WScreen *scr = (WScreen*)WMGetNotificationObject(notif); const char *name = WMGetNotificationName(notif); - //void *data = WMGetNotificationClientData(notif); if (strcmp(name, WMNWorkspaceCreated) == 0) { updateWorkspaceCount(scr); diff --git a/src/xdnd.c b/src/xdnd.c index 7de2a408..391bccdd 100644 --- a/src/xdnd.c +++ b/src/xdnd.c @@ -91,7 +91,6 @@ wXDNDMakeAwareness(Window window) void wXDNDClearAwareness(Window window) { - //long int xdnd_version = 3; XDeleteProperty (dpy, window, _XA_XdndAware); } -- 2.11.4.GIT