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

Coding style cleanups

This commit is contained in:
Rodolfo García Peñas (kix)
2012-03-03 22:49:53 +01:00
committed by Carlos R. Mafra
parent e819818eeb
commit 4f4ea569a0
3 changed files with 92 additions and 184 deletions

View File

@@ -75,23 +75,23 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char *command, char *wm_instance,
dicon->prev = NULL;
dicon->next = scr->app_icon_list;
if (scr->app_icon_list) {
if (scr->app_icon_list)
scr->app_icon_list->prev = dicon;
}
scr->app_icon_list = dicon;
if (command) {
if (command)
dicon->command = wstrdup(command);
}
if (wm_class)
dicon->wm_class = wstrdup(wm_class);
if (wm_instance)
dicon->wm_instance = wstrdup(wm_instance);
path = wDefaultGetIconFile(scr, wm_instance, wm_class, True);
if (!path && command) {
wApplicationExtractDirPackIcon(scr, command, wm_instance, wm_class);
path = wDefaultGetIconFile(scr, wm_instance, wm_class, False);
}
@@ -129,13 +129,14 @@ WAppIcon *wAppIconCreate(WWindow * leader_win)
aicon->prev = NULL;
aicon->next = scr->app_icon_list;
if (scr->app_icon_list) {
if (scr->app_icon_list)
scr->app_icon_list->prev = aicon;
}
scr->app_icon_list = aicon;
if (leader_win->wm_class)
aicon->wm_class = wstrdup(leader_win->wm_class);
if (leader_win->wm_instance)
aicon->wm_instance = wstrdup(leader_win->wm_instance);
@@ -170,6 +171,7 @@ void wAppIconDestroy(WAppIcon * aicon)
#endif
if (aicon->wm_instance)
wfree(aicon->wm_instance);
if (aicon->wm_class)
wfree(aicon->wm_class);
@@ -203,11 +205,6 @@ static void drawCorner(WIcon * icon)
points, 3, Convex, CoordModeOrigin);
XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 0, 0, 0, 12);
XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 0, 0, 12, 0);
/* drawing the second line gives a weird concave look. -Dan */
#if 0
XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 1, 1, 1, 11);
XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 1, 1, 11, 1);
#endif
}
void wAppIconMove(WAppIcon * aicon, int x, int y)
@@ -275,11 +272,10 @@ void wAppIconPaint(WAppIcon * aicon)
drawCorner(aicon->icon);
XSetClipMask(dpy, scr->copy_gc, None);
if (aicon->launching) {
if (aicon->launching)
XFillRectangle(dpy, aicon->icon->core->window, scr->stipple_gc,
0, 0, wPreferences.icon_size, wPreferences.icon_size);
}
}
Bool wAppIconSave(WAppIcon *aicon)
{
@@ -329,6 +325,7 @@ static void setIconCallback(WMenu * menu, WMenuEntry * entry)
if (icon->editing)
return;
icon->editing = 1;
scr = icon->icon->core->screen_ptr;
@@ -388,9 +385,8 @@ static void killCallback(WMenu * menu, WMenuEntry * entry)
wwin = wapp->main_window_desc->screen_ptr->focused_window;
while (wwin) {
twin = wwin->prev;
if (wwin->fake_group == fPtr) {
if (wwin->fake_group == fPtr)
wClientKill(wwin);
}
wwin = twin;
}
} else if (!wapp->main_window_desc->flags.destroyed) {
@@ -398,9 +394,7 @@ static void killCallback(WMenu * menu, WMenuEntry * entry)
}
}
wrelease(wapp->main_window_desc);
wfree(buffer);
WCHANGE_STATE(WSTATE_NORMAL);
}
@@ -430,11 +424,10 @@ static void openApplicationMenu(WApplication * wapp, int x, int y)
menu = scr->icon_menu;
if (wapp->flags.hidden) {
if (wapp->flags.hidden)
menu->entries[1]->text = _("Unhide");
} else {
else
menu->entries[1]->text = _("Hide");
}
menu->flags.realized = 0;
wMenuRealize(menu);
@@ -442,13 +435,14 @@ static void openApplicationMenu(WApplication * wapp, int x, int y)
x -= menu->frame->core->width / 2;
if (x + menu->frame->core->width > scr->scr_width)
x = scr->scr_width - menu->frame->core->width;
if (x < 0)
x = 0;
/* set client data */
for (i = 0; i < menu->entry_no; i++) {
for (i = 0; i < menu->entry_no; i++)
menu->entries[i]->clientdata = wapp;
}
wMenuMapAt(menu, x, y, False);
}
@@ -477,10 +471,9 @@ static void iconDblClick(WObjDescriptor * desc, XEvent * event)
wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);
if (event->xbutton.state & MOD_MASK) {
if (event->xbutton.state & MOD_MASK)
wHideOtherApplications(aicon->icon->owner);
}
}
void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
{
@@ -543,9 +536,8 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, None, CurrentTime) != GrabSuccess) {
GrabModeAsync, None, None, CurrentTime) != GrabSuccess)
wwarning("pointer grab failed for appicon move");
}
if (wPreferences.flags.nodock && wPreferences.flags.noclip)
dockable = 0;
@@ -595,11 +587,10 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
x = ev.xmotion.x_root - dx;
y = ev.xmotion.y_root - dy;
if (movingSingle) {
if (movingSingle)
XMoveWindow(dpy, icon->core->window, x, y);
} else {
else
wAppIconMove(aicon, x, y);
}
if (dockable) {
if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y, &ix, &iy, False)) {
@@ -622,9 +613,9 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
scr->last_dock = scr->dock;
XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
if (!docking) {
if (!docking)
XMapWindow(dpy, scr->dock_shadow);
}
docking = 1;
} else if (workspace->clip &&
wDockSnapIcon(workspace->clip, aicon, x, y, &ix, &iy, False)) {
@@ -647,16 +638,15 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
scr->last_dock = workspace->clip;
XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
if (!docking) {
if (!docking)
XMapWindow(dpy, scr->dock_shadow);
}
docking = 1;
} else if (docking) {
XUnmapWindow(dpy, scr->dock_shadow);
docking = 0;
}
}
break;
case ButtonPress:
@@ -674,9 +664,9 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
SlideWindow(icon->core->window, x, y, shad_x, shad_y);
XUnmapWindow(dpy, scr->dock_shadow);
docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy);
if (scr->last_dock->auto_collapse) {
if (scr->last_dock->auto_collapse)
collapsed = 0;
}
if (workspace->clip &&
workspace->clip != scr->last_dock && workspace->clip->auto_raise_lower)
wDockLower(workspace->clip);

View File

@@ -28,17 +28,11 @@ typedef struct WApplication {
struct WApplication *prev;
Window main_window; /* ID of the group leader */
struct WWindow *main_window_desc; /* main (leader) window descriptor */
WMenu *menu; /* application menu */
struct WAppIcon *app_icon;
int refcount;
struct WWindow *last_focused; /* focused window before hide */
int last_workspace; /* last workspace used to work on the
* app */
WMHandlerID *urgent_bounce_timer;
@@ -52,10 +46,8 @@ typedef struct WApplication {
WApplication *wApplicationCreate(struct WWindow *wwin);
void wApplicationDestroy(WApplication *wapp);
WApplication *wApplicationOf(Window window);
void wApplicationDestroy(WApplication *wapp);
void wApplicationExtractDirPackIcon(WScreen *scr,char *path, char *wm_instance,
char *wm_class);
void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance,

View File

@@ -123,14 +123,13 @@ static void appearanceObserver(void *self, WMNotification * notif)
wWindowConfigureBorders(wwin);
if (wwin->flags.shaded) {
wFrameWindowResize(wwin->frame, wwin->frame->core->width, wwin->frame->top_width - 1);
wwin->client.y = wwin->frame_y - wwin->client.height + wwin->frame->top_width;
wWindowSynthConfigureNotify(wwin);
}
}
if (flags & WTextureSettings) {
if (flags & WTextureSettings)
wwin->frame->flags.need_texture_remake = 1;
}
if (flags & (WTextureSettings | WColorSettings)) {
if (wwin->frame->titlebar)
XClearWindow(dpy, wwin->frame->titlebar->window);
@@ -480,13 +479,11 @@ static void fixLeaderProperties(WWindow *wwin)
if (haveCommand) {
command = GetCommandForWindow(wwin->client_win);
if (command) {
/* command already set. nothing to do. */
wfree(command);
} else {
if (command)
wfree(command); /* command already set. nothing to do. */
else
XSetCommand(dpy, wwin->client_win, argv, argc);
}
}
for (i = 0; i < 2; i++) {
window = leaders[i];
@@ -508,13 +505,11 @@ static void fixLeaderProperties(WWindow *wwin)
if (haveCommand) {
command = GetCommandForWindow(window);
if (command) {
/* command already set. nothing to do. */
wfree(command);
} else {
if (command)
wfree(command); /* command already set. nothing to do. */
else
XSetCommand(dpy, window, argv, argc);
}
}
/* Make sure we get notification when this window is destroyed */
if (XGetWindowAttributes(dpy, window, &attr))
@@ -676,12 +671,11 @@ WWindow *wManageWindow(WScreen *scr, Window window)
XSetWindowBorderWidth(dpy, window, 0);
/* get hints from GNUstep app */
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "GNUstep") == 0) {
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "GNUstep") == 0)
wwin->flags.is_gnustep = 1;
}
if (!PropGetGNUstepWMAttr(window, &wwin->wm_gnustep_attr)) {
if (!PropGetGNUstepWMAttr(window, &wwin->wm_gnustep_attr))
wwin->wm_gnustep_attr = NULL;
}
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "DockApp") == 0) {
wwin->flags.is_dockapp = 1;
@@ -698,11 +692,8 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (wwin->wm_hints->flags & StateHint) {
if (wwin->wm_hints->initial_state == IconicState) {
wwin->flags.miniaturized = 1;
} else if (wwin->wm_hints->initial_state == WithdrawnState) {
wwin->flags.is_dockapp = 1;
withdraw = True;
}
@@ -768,10 +759,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
extern Atom _XA_WINDOWMAKER_MENU;
XTextProperty text_prop;
if (XGetTextProperty(dpy, wwin->main_window, &text_prop, _XA_WINDOWMAKER_MENU)) {
if (XGetTextProperty(dpy, wwin->main_window, &text_prop, _XA_WINDOWMAKER_MENU))
WSETUFLAG(wwin, shared_appicon, 0);
}
}
if (wwin->flags.is_dockapp)
WSETUFLAG(wwin, shared_appicon, 0);
@@ -849,13 +839,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* apply previous state if it exists and we're in startup */
if (scr->flags.startup && wm_state >= 0) {
if (wm_state == IconicState) {
wwin->flags.miniaturized = 1;
} else if (wm_state == WithdrawnState) {
withdraw = True;
}
}
@@ -874,9 +860,8 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (win_state->state->shaded > 0 && !WFLAGP(wwin, no_shadeable))
wwin->flags.shaded = win_state->state->shaded;
if (win_state->state->miniaturized > 0 && !WFLAGP(wwin, no_miniaturizable)) {
if (win_state->state->miniaturized > 0 && !WFLAGP(wwin, no_miniaturizable))
wwin->flags.miniaturized = win_state->state->miniaturized;
}
if (!IS_OMNIPRESENT(wwin)) {
int w = wDefaultGetStartWorkspace(scr, wwin->wm_instance,
@@ -951,29 +936,22 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* set workspace on which the window starts */
if (workspace >= 0) {
if (workspace > scr->workspace_count - 1) {
if (workspace > scr->workspace_count - 1)
workspace = workspace % scr->workspace_count;
}
} else {
int w;
w = wDefaultGetStartWorkspace(scr, wwin->wm_instance, wwin->wm_class);
if (w >= 0 && w < scr->workspace_count && !(IS_OMNIPRESENT(wwin))) {
workspace = w;
} else {
if (wPreferences.open_transients_with_parent && transientOwner) {
if (wPreferences.open_transients_with_parent && transientOwner)
workspace = transientOwner->frame->workspace;
} else {
else
workspace = scr->current_workspace;
}
}
}
/* setup window geometry */
if (win_state && win_state->state->w > 0) {
@@ -1202,9 +1180,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
* If this is the case, point the leader of this window to
* itself */
leader = wWindowFor(wwin->main_window);
if (leader && leader->main_window == None) {
if (leader && leader->main_window == None)
leader->main_window = leader->client_win;
}
app = wApplicationCreate(wwin);
if (app) {
app->last_workspace = workspace;
@@ -1248,35 +1226,13 @@ WWindow *wManageWindow(WScreen *scr, Window window)
* WM_STATE set before they get mapped. Else WM_STATE is set later,
* after the return from this function.
*/
if (wwin->wm_hints && (wwin->wm_hints->flags & StateHint)) {
if (wwin->wm_hints && (wwin->wm_hints->flags & StateHint))
wClientSetState(wwin, wwin->wm_hints->initial_state, None);
} else {
else
wClientSetState(wwin, NormalState, None);
}
#if 0
/* if not auto focus, then map the window under the currently
* focused window */
#define _WIDTH(w) (w)->frame->core->width
#define _HEIGHT(w) (w)->frame->core->height
if (!wPreferences.auto_focus && scr->focused_window
&& !scr->flags.startup && !transientOwner && ((wWindowObscuresWindow(wwin, scr->focused_window)
&& (_WIDTH(wwin) >
(_WIDTH(scr->focused_window) * 5) / 3
|| _HEIGHT(wwin) >
(_HEIGHT(scr->focused_window) * 5) / 3)
&& WINDOW_LEVEL(scr->focused_window) ==
WINDOW_LEVEL(wwin))
|| wwin->flags.maximized)) {
MoveInStackListUnder(scr->focused_window->frame->core, wwin->frame->core);
}
#undef _WIDTH
#undef _HEIGHT
#endif
if (wPreferences.superfluous && !wPreferences.no_animations
&& !scr->flags.startup && (wwin->transient_for == None || wwin->transient_for == scr->root_win)
if (wPreferences.superfluous && !wPreferences.no_animations && !scr->flags.startup &&
(wwin->transient_for == None || wwin->transient_for == scr->root_win) &&
/*
* The brain damaged idiotic non-click to focus modes will
* have trouble with this because:
@@ -1293,19 +1249,17 @@ WWindow *wManageWindow(WScreen *scr, Window window)
* and when it is processed, the client that owns that window
* will reject the XSetInputFocus() for it.
*/
&& (wPreferences.focus_mode == WKF_CLICK || wPreferences.auto_focus)) {
(wPreferences.focus_mode == WKF_CLICK || wPreferences.auto_focus))
DoWindowBirth(wwin);
}
wWindowMap(wwin);
}
/* setup stacking descriptor */
if (transientOwner) {
if (transientOwner)
wwin->frame->core->stacking->child_of = transientOwner->frame->core;
} else {
else
wwin->frame->core->stacking->child_of = NULL;
}
if (!scr->focused_window) {
/* first window on the list */
@@ -1326,9 +1280,8 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* raise is set to true if we un-hid the app when this window was born.
* we raise, else old windows of this app will be above this new one. */
if (raise) {
if (raise)
wRaiseFrame(wwin->frame->core);
}
/* Update name must come after WApplication stuff is done */
wWindowUpdateName(wwin, title);
@@ -1358,15 +1311,13 @@ WWindow *wManageWindow(WScreen *scr, Window window)
Window dummy;
if (XQueryPointer(dpy, scr->root_win, &dummy, &dummy,
&foo, &foo, &foo, &foo, &bar) != False) {
&foo, &foo, &foo, &foo, &bar) != False)
same_screen = 1;
}
if (same_screen == 1 && same_head == 1) {
if (same_screen == 1 && same_head == 1)
wSetFocusTo(scr, wwin);
}
}
}
wWindowResetMouseGrabs(wwin);
if (!WFLAGP(wwin, no_bind_keys))
@@ -1536,14 +1487,12 @@ void wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
WScreen *scr = wwin->screen_ptr;
/* First close attribute editor window if open */
if (wwin->flags.inspector_open) {
if (wwin->flags.inspector_open)
wCloseInspectorForWindow(wwin);
}
/* Close window menu if it's open for this window */
if (wwin->flags.menu_open_for_me) {
if (wwin->flags.menu_open_for_me)
CloseWindowMenu(scr);
}
if (!destroyed) {
if (!wwin->flags.internal_window)
@@ -1551,11 +1500,10 @@ void wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
/* If this is a leader window, we still need to listen for
* DestroyNotify and PropertyNotify. */
if (wApplicationOf(wwin->client_win)) {
if (wApplicationOf(wwin->client_win))
XSelectInput(dpy, wwin->client_win, StructureNotifyMask | PropertyChangeMask);
} else {
else
XSelectInput(dpy, wwin->client_win, NoEventMask);
}
XUngrabButton(dpy, AnyButton, AnyModifier, wwin->client_win);
XUngrabKey(dpy, AnyKey, AnyModifier, wwin->client_win);
@@ -1582,13 +1530,12 @@ void wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
if (wwin->transient_for != scr->root_win) {
owner = wWindowFor(wwin->transient_for);
if (owner) {
if (!owner->flags.semi_focused) {
if (!owner->flags.semi_focused)
owner = NULL;
} else {
else
owner->flags.semi_focused = 0;
}
}
}
wasFocused = wwin->flags.focused;
@@ -1602,6 +1549,7 @@ void wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
if (wwin->prev)
wwin->prev->next = wwin->next;
if (wwin->next)
wwin->next->prev = wwin->prev;
else {
@@ -1716,9 +1664,8 @@ void wWindowFocus(WWindow *wwin, WWindow *owin)
WWindow *oowner;
#ifdef KEEP_XKB_LOCK_STATUS
if (wPreferences.modelock) {
if (wPreferences.modelock)
XkbLockGroup(dpy, XkbUseCoreKbd, wwin->frame->languagemode);
}
#endif /* KEEP_XKB_LOCK_STATUS */
wwin->flags.semi_focused = 0;
@@ -1805,17 +1752,14 @@ void wWindowUpdateName(WWindow *wwin, char *newTitle)
wwin->flags.wm_name_changed = 1;
if (!newTitle) {
/* the hint was removed */
title = DEF_WINDOW_TITLE;
} else {
if (!newTitle)
title = DEF_WINDOW_TITLE; /* the hint was removed */
else
title = newTitle;
}
if (wFrameWindowChangeTitle(wwin->frame, title)) {
if (wFrameWindowChangeTitle(wwin->frame, title))
WMPostNotificationName(WMNChangedName, wwin, NULL);
}
}
/*
*----------------------------------------------------------------------
@@ -1963,9 +1907,9 @@ void wWindowChangeWorkspace(WWindow *wwin, int workspace)
&& !IS_OMNIPRESENT(wwin) && !wwin->flags.changing_workspace) {
wapp = wApplicationOf(wwin->main_window);
if (wapp) {
if (wapp)
wapp->last_workspace = workspace;
}
if (wwin->flags.miniaturized) {
if (wwin->icon) {
XUnmapWindow(dpy, wwin->icon->core->window);
@@ -1989,9 +1933,7 @@ void wWindowChangeWorkspace(WWindow *wwin, int workspace)
}
if (!IS_OMNIPRESENT(wwin)) {
int oldWorkspace = wwin->frame->workspace;
wwin->frame->workspace = workspace;
WMPostNotificationName(WMNChangedWorkspace, wwin, (void *)(uintptr_t) oldWorkspace);
}
@@ -2057,12 +1999,12 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
* if the window is being moved but not resized then
* send a synthetic ConfigureNotify
*/
if ((req_x != wwin->frame_x || req_y != wwin->frame_y) && !resize) {
if ((req_x != wwin->frame_x || req_y != wwin->frame_y) && !resize)
synth_notify = True;
}
if (WFLAGP(wwin, dont_move_off))
wScreenBringInside(wwin->screen_ptr, &req_x, &req_y, req_width, req_height);
if (resize) {
if (req_width < MIN_WINDOW_SIZE)
req_width = MIN_WINDOW_SIZE;
@@ -2107,9 +2049,8 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
wwin->client.y += FRAME_BORDER_WIDTH;
}
#ifdef SHAPE
if (wShapeSupported && wwin->flags.shaped && resize) {
if (wShapeSupported && wwin->flags.shaped && resize)
wWindowSetShape(wwin);
}
#endif
if (synth_notify)
@@ -2124,9 +2065,8 @@ void wWindowMove(WWindow *wwin, int req_x, int req_y)
int synth_notify = False;
/* Send a synthetic ConfigureNotify event for every window movement. */
if ((req_x != wwin->frame_x || req_y != wwin->frame_y)) {
if ((req_x != wwin->frame_x || req_y != wwin->frame_y))
synth_notify = True;
}
#else
/* A single synthetic ConfigureNotify event is sent at the end of
* a completed (opaque) movement in moveres.c */
@@ -2168,11 +2108,10 @@ void wWindowUpdateButtonImages(WWindow *wwin)
if (wwin->wm_gnustep_attr && wwin->wm_gnustep_attr->flags & GSMiniaturizePixmapAttr) {
pixmap = wwin->wm_gnustep_attr->miniaturize_pixmap;
if (wwin->wm_gnustep_attr->flags & GSMiniaturizeMaskAttr) {
if (wwin->wm_gnustep_attr->flags & GSMiniaturizeMaskAttr)
mask = wwin->wm_gnustep_attr->miniaturize_mask;
} else {
else
mask = None;
}
if (fwin->lbutton_image
&& (fwin->lbutton_image->image != pixmap || fwin->lbutton_image->mask != mask)) {
@@ -2186,17 +2125,17 @@ void wWindowUpdateButtonImages(WWindow *wwin)
fwin->lbutton_image->client_owned_mask = 1;
}
} else {
if (fwin->lbutton_image && !fwin->lbutton_image->shared) {
if (fwin->lbutton_image && !fwin->lbutton_image->shared)
wPixmapDestroy(fwin->lbutton_image);
}
fwin->lbutton_image = scr->b_pixmaps[WBUT_ICONIFY];
}
}
#ifdef XKB_BUTTON_HINT
if (!WFLAGP(wwin, no_language_button)) {
if (fwin->languagebutton_image && !fwin->languagebutton_image->shared) {
if (fwin->languagebutton_image && !fwin->languagebutton_image->shared)
wPixmapDestroy(fwin->languagebutton_image);
}
fwin->languagebutton_image = scr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
}
#endif
@@ -2228,21 +2167,18 @@ void wWindowUpdateButtonImages(WWindow *wwin)
}
} else if (WFLAGP(wwin, kill_close)) {
if (fwin->rbutton_image && !fwin->rbutton_image->shared)
wPixmapDestroy(fwin->rbutton_image);
fwin->rbutton_image = scr->b_pixmaps[WBUT_KILL];
} else if (MGFLAGP(wwin, broken_close)) {
if (fwin->rbutton_image && !fwin->rbutton_image->shared)
wPixmapDestroy(fwin->rbutton_image);
fwin->rbutton_image = scr->b_pixmaps[WBUT_BROKENCLOSE];
} else {
if (fwin->rbutton_image && !fwin->rbutton_image->shared)
wPixmapDestroy(fwin->rbutton_image);
@@ -2300,9 +2236,8 @@ void wWindowConfigureBorders(WWindow *wwin)
#ifdef XKB_BUTTON_HINT
if (!WFLAGP(wwin, no_language_button)
&& wwin->frame->flags.hide_language_button) {
&& wwin->frame->flags.hide_language_button)
flags |= WFF_LANGUAGE_BUTTON;
}
#endif
if (!WFLAGP(wwin, no_close_button)
@@ -2333,9 +2268,8 @@ void wWindowConfigureBorders(WWindow *wwin)
wFrameWindowHideButton(wwin->frame, flags);
#ifdef SHAPE
if (wShapeSupported && wwin->flags.shaped) {
if (wShapeSupported && wwin->flags.shaped)
wWindowSetShape(wwin);
}
#endif
}
}
@@ -2425,15 +2359,13 @@ void wWindowSetShape(WWindow * wwin)
int ordering;
/* only shape is the client's */
if (!HAS_TITLEBAR(wwin) && !HAS_RESIZEBAR(wwin)) {
if (!HAS_TITLEBAR(wwin) && !HAS_RESIZEBAR(wwin))
goto alt_code;
}
/* Get array of rectangles describing the shape mask */
rects = XShapeGetRectangles(dpy, wwin->client_win, ShapeBounding, &count, &ordering);
if (!rects) {
if (!rects)
goto alt_code;
}
urec = malloc(sizeof(XRectangle) * (count + 2));
if (!urec) {
@@ -2832,9 +2764,8 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
}
}
} else if (event->xbutton.button == Button3) {
if (event->xbutton.state & MOD_MASK) {
if (event->xbutton.state & MOD_MASK)
wHideOtherApplications(wwin);
}
} else if (event->xbutton.button == Button2) {
wSelectWindow(wwin, !wwin->flags.selected);
} else if (event->xbutton.button == WINGsConfiguration.mouseWheelUp) {
@@ -2915,30 +2846,26 @@ static void titlebarMouseDown(WCoreWindow *sender, void *data, XEvent *event)
WWindow *wwin = (WWindow *) data;
#ifndef NUMLOCK_HACK
if ((event->xbutton.state & ValidModMask)
!= (event->xbutton.state & ~LockMask)) {
if ((event->xbutton.state & ValidModMask) != (event->xbutton.state & ~LockMask))
wwarning(_("The NumLock, ScrollLock or similar key seems to be turned on. "
"Turn it off or some mouse actions and keyboard shortcuts will not work."));
}
#endif
event->xbutton.state &= ValidModMask;
CloseWindowMenu(wwin->screen_ptr);
if (wPreferences.focus_mode == WKF_CLICK && !(event->xbutton.state & ControlMask)
&& !WFLAGP(wwin, no_focusable)) {
&& !WFLAGP(wwin, no_focusable))
wSetFocusTo(wwin->screen_ptr, wwin);
}
if (event->xbutton.button == Button1 || event->xbutton.button == Button2) {
if (event->xbutton.button == Button1) {
if (event->xbutton.state & MOD_MASK) {
if (event->xbutton.state & MOD_MASK)
wLowerFrame(wwin->frame->core);
} else {
else
wRaiseFrame(wwin->frame->core);
}
}
if ((event->xbutton.state & ShiftMask)
&& !(event->xbutton.state & ControlMask)) {
wSelectWindow(wwin, !wwin->flags.selected);
@@ -3009,12 +2936,11 @@ static void windowCloseDblClick(WCoreWindow *sender, void *data, XEvent *event)
return;
/* send delete message */
if (wwin->protocols.DELETE_WINDOW) {
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
} else {
else
wClientKill(wwin);
}
}
#ifdef XKB_BUTTON_HINT
static void windowLanguageClick(WCoreWindow *sender, void *data, XEvent *event)