1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

code review

This commit is contained in:
kojima
2004-10-22 23:39:11 +00:00
parent 4bda625076
commit 620a280d64
8 changed files with 20 additions and 75 deletions

View File

@@ -35,7 +35,6 @@ W_InitIMStuff(WMScreen *scr)
return False; return False;
} }
//XGetIMValues(scr->display,
} }
@@ -63,7 +62,8 @@ W_CreateIC(WMView *view)
ctx->next = scr->imctx->icList; ctx->next = scr->imctx->icList;
if (scr->imctx->icList) if (scr->imctx->icList)
scr->imctx->icList->prev = ctx; scr->imctx->icList->prev = ctx;
//scr->imctx = ctx;
} }

View File

@@ -548,8 +548,10 @@ wUnfullscreenWindow(WWindow *wwin)
wwin->bfs_geometry.width, wwin->bfs_geometry.height); wwin->bfs_geometry.width, wwin->bfs_geometry.height);
wWindowConfigureBorders(wwin); wWindowConfigureBorders(wwin);
/*
// seems unnecessary, but also harmless (doesn't generate flicker) -Dan // seems unnecessary, but also harmless (doesn't generate flicker) -Dan
wFrameWindowPaint(wwin->frame); wFrameWindowPaint(wwin->frame);
*/
WMPostNotificationName(WMNChangedState, wwin, "fullscreen"); WMPostNotificationName(WMNChangedState, wwin, "fullscreen");
} }

View File

@@ -3210,8 +3210,6 @@ setIconTitleBack(WScreen *scr, WDefaultEntry *entry, XColor *color, void *foo)
if (scr->icon_title_texture) { if (scr->icon_title_texture) {
wTextureDestroy(scr, (WTexture*)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); scr->icon_title_texture = wTextureMakeSolid(scr, color);
return REFRESH_ICON_TITLE_BACK; return REFRESH_ICON_TITLE_BACK;

View File

@@ -1759,54 +1759,6 @@ handleMotionNotify(XEvent *event)
wMenuScroll(menu, 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
} }

View File

@@ -45,10 +45,10 @@
extern WPreferences wPreferences; extern WPreferences wPreferences;
#define X_ORIGIN(scr) WMAX(usableArea.x1,\ #define X_ORIGIN WMAX(usableArea.x1,\
wPreferences.window_place_origin.x) wPreferences.window_place_origin.x)
#define Y_ORIGIN(scr) WMAX(usableArea.y1,\ #define Y_ORIGIN WMAX(usableArea.y1,\
wPreferences.window_place_origin.y) wPreferences.window_place_origin.y)
@@ -348,8 +348,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
unsigned int width, unsigned int height, unsigned int width, unsigned int height,
WArea usableArea) WArea usableArea)
{ {
//WScreen *scr = wwin->screen_ptr; int test_x = 0, test_y = Y_ORIGIN;
int test_x = 0, test_y = Y_ORIGIN(scr);
int from_x, to_x, from_y, to_y; int from_x, to_x, from_y, to_y;
int sx; int sx;
int min_isect, min_isect_x, min_isect_y; int min_isect, min_isect_x, min_isect_y;
@@ -365,7 +364,7 @@ smartPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
height += 2; height += 2;
width += 2; width += 2;
} }
sx = X_ORIGIN(scr); sx = X_ORIGIN;
min_isect = INT_MAX; min_isect = INT_MAX;
min_isect_x = sx; 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 = 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; to_x = min_isect_x + PLACETEST_HSTEP;
if (to_x + width > usableArea.x2) if (to_x + width > usableArea.x2)
to_x = usableArea.x2 - width; to_x = usableArea.x2 - width;
from_y = min_isect_y - PLACETEST_VSTEP + 1; 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; to_y = min_isect_y + PLACETEST_VSTEP;
if (to_y + height > usableArea.y2) if (to_y + height > usableArea.y2)
to_y = usableArea.y2 - height; to_y = usableArea.y2 - height;
@@ -424,7 +423,7 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
WArea usableArea) WArea usableArea)
{ {
WScreen *scr = wwin->screen_ptr; 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 loc_ok = False, tw,tx,ty,th;
int swidth, sx; int swidth, sx;
WWindow *test_window; WWindow *test_window;
@@ -441,7 +440,7 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
} }
swidth = usableArea.x2-usableArea.x1; swidth = usableArea.x2-usableArea.x1;
sx = X_ORIGIN(scr); sx = X_ORIGIN;
/* this was based on fvwm2's smart placement */ /* 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; width += 2;
} }
*x_ret = h * scr->cascade_index + X_ORIGIN(scr); *x_ret = h * scr->cascade_index + X_ORIGIN;
*y_ret = h * scr->cascade_index + Y_ORIGIN(scr); *y_ret = h * scr->cascade_index + Y_ORIGIN;
if (width + *x_ret > usableArea.x2 || height + *y_ret > usableArea.y2) { if (width + *x_ret > usableArea.x2 || height + *y_ret > usableArea.y2) {
scr->cascade_index = 0; scr->cascade_index = 0;
*x_ret = X_ORIGIN(scr); *x_ret = X_ORIGIN;
*y_ret = Y_ORIGIN(scr); *y_ret = Y_ORIGIN;
} }
} }
@@ -579,12 +578,12 @@ randomPlaceWindow(WScreen *scr, WWindow *wwin, int *x_ret, int *y_ret,
width += 2; width += 2;
} }
w = ((usableArea.x2-X_ORIGIN(scr)) - width); w = ((usableArea.x2-X_ORIGIN) - width);
h = ((usableArea.y2-Y_ORIGIN(scr)) - height); h = ((usableArea.y2-Y_ORIGIN) - height);
if (w<1) w = 1; if (w<1) w = 1;
if (h<1) h = 1; if (h<1) h = 1;
*x_ret = X_ORIGIN(scr) + rand()%w; *x_ret = X_ORIGIN + rand()%w;
*y_ret = Y_ORIGIN(scr) + rand()%h; *y_ret = Y_ORIGIN + rand()%h;
} }

View File

@@ -288,10 +288,6 @@ typedef struct _WScreen {
Window autoRaiseWindow; /* window that is scheduled to be Window autoRaiseWindow; /* window that is scheduled to be
* raised */ * raised */
Window scrolledFMaximize; /* full maximized window which was
scrolled down for titlebar access */
/* for window shortcuts */ /* for window shortcuts */
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS]; WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];

View File

@@ -1645,7 +1645,6 @@ wsobserver(void *self, WMNotification *notif)
{ {
WScreen *scr = (WScreen*)WMGetNotificationObject(notif); WScreen *scr = (WScreen*)WMGetNotificationObject(notif);
const char *name = WMGetNotificationName(notif); const char *name = WMGetNotificationName(notif);
//void *data = WMGetNotificationClientData(notif);
if (strcmp(name, WMNWorkspaceCreated) == 0) { if (strcmp(name, WMNWorkspaceCreated) == 0) {
updateWorkspaceCount(scr); updateWorkspaceCount(scr);

View File

@@ -91,7 +91,6 @@ wXDNDMakeAwareness(Window window)
void void
wXDNDClearAwareness(Window window) wXDNDClearAwareness(Window window)
{ {
//long int xdnd_version = 3;
XDeleteProperty (dpy, window, _XA_XdndAware); XDeleteProperty (dpy, window, _XA_XdndAware);
} }