From 335e8acbfc5d2824f1fd2cb67a5add8e1ed40b06 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 21 Mar 2004 01:03:00 +0000 Subject: [PATCH] yay no tabs in the source --- openbox/client.c | 6 +- openbox/client.h | 8 +- openbox/dock.c | 6 +- openbox/event.c | 14 +- openbox/extensions.c | 2 +- openbox/frame.c | 302 +++++++++++++++--------------- openbox/geom.h | 2 +- openbox/keyboard.c | 2 +- openbox/keytree.c | 130 ++++++------- openbox/menuframe.c | 6 +- openbox/mouse.c | 8 +- openbox/prop.c | 120 ++++++------ openbox/prop.h | 2 +- openbox/screen.c | 12 +- openbox/stacking.c | 2 +- openbox/translate.c | 28 +-- openbox/xerror.c | 2 +- render/color.c | 2 +- render/test.c | 102 +++++----- render/theme.c | 8 +- tools/kdetrayproxy/kdetrayproxy.c | 6 +- 21 files changed, 385 insertions(+), 385 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index 8e3dd1ee..3fe108f5 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -45,10 +45,10 @@ See the COPYING file for a copy of the GNU General Public License. /*! The event mask to grab on client windows */ #define CLIENT_EVENTMASK (PropertyChangeMask | FocusChangeMask | \ - StructureNotifyMask) + StructureNotifyMask) #define CLIENT_NOPROPAGATEMASK (ButtonPressMask | ButtonReleaseMask | \ - ButtonMotionMask) + ButtonMotionMask) typedef struct { @@ -1232,7 +1232,7 @@ void client_setup_decor_and_functions(ObClient *self) /* dont let mwm hints kill the close button if (! (self->mwmhints.functions & MwmFunc_Close)) self->functions &= ~OB_CLIENT_FUNC_CLOSE; */ - } + } } if (!(self->functions & OB_CLIENT_FUNC_SHADE)) diff --git a/openbox/client.h b/openbox/client.h index 5942eb14..10402914 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -324,11 +324,11 @@ gboolean client_focused(ObClient *self); @param h The height component of the new size for the client. @param user Specifies whether this is a user-requested change or a program requested change. For program requested changes, the - constraints are not checked. + constraints are not checked. @param final If user is true, then this should specify if this is a final configuration. e.g. Final should be FALSE if doing an - interactive move/resize, and then be TRUE for the last call - only. + interactive move/resize, and then be TRUE for the last call + only. @param force_reply Send a ConfigureNotify to the client regardless of if the position changed. */ @@ -484,7 +484,7 @@ void client_update_normal_hints(ObClient *self); /*! Updates the WMHints and adjusts things if they change @param initstate Whether to read the initial_state property from the WMHints. This should only be used during the mapping - process. + process. */ void client_update_wmhints(ObClient *self); /*! Updates the window's title and icon title */ diff --git a/openbox/dock.c b/openbox/dock.c index 592446a2..b127d40b 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -129,7 +129,7 @@ void dock_add(Window win, XWMHints *wmhints) if (PROP_GETSS(app->win, wm_class, locale, &data)) { if (data[0]) { - app->name = g_strdup(data[0]); + app->name = g_strdup(data[0]); if (data[1]) app->class = g_strdup(data[1]); } @@ -158,7 +158,7 @@ void dock_add(Window win, XWMHints *wmhints) handled and need to be ignored. */ if (ob_state() == OB_STATE_STARTING) - app->ignore_unmaps += 2; + app->ignore_unmaps += 2; if (app->win != app->icon_win) { /* have to map it so that it can be re-managed on a restart */ @@ -197,7 +197,7 @@ void dock_remove(ObDockApp *app, gboolean reparent) g_hash_table_remove(window_map, &app->icon_win); if (reparent) - XReparentWindow(ob_display, app->icon_win, + XReparentWindow(ob_display, app->icon_win, RootWindow(ob_display, ob_screen), app->x, app->y); dock->dock_apps = g_list_remove(dock->dock_apps, app); diff --git a/openbox/event.c b/openbox/event.c index 0c843ac7..c0e6f96c 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -251,9 +251,9 @@ static void event_set_lasttime(XEvent *e) } #define STRIP_MODS(s) \ - s &= ~(LockMask | NumLockMask | ScrollLockMask), \ - /* kill off the Button1Mask etc, only want the modifiers */ \ - s &= (ControlMask | ShiftMask | Mod1Mask | \ + s &= ~(LockMask | NumLockMask | ScrollLockMask), \ + /* kill off the Button1Mask etc, only want the modifiers */ \ + s &= (ControlMask | ShiftMask | Mod1Mask | \ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) \ static void event_hack_mods(XEvent *e) @@ -317,7 +317,7 @@ static gboolean event_ignore(XEvent *e, ObClient *client) want will be of type NotifyAncestor. This situation does not occur for FocusOut, so it is safely ignored there. */ - if (INVALID_FOCUSIN(e) || + if (INVALID_FOCUSIN(e) || client == NULL) { #ifdef DEBUG_FOCUS ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n", @@ -336,7 +336,7 @@ static gboolean event_ignore(XEvent *e, ObClient *client) #endif break; case FocusOut: - if (INVALID_FOCUSOUT(e)) { + if (INVALID_FOCUSOUT(e)) { #ifdef DEBUG_FOCUS ob_debug("FocusOut on %lx mode %d detail %d IGNORED\n", e->xfocus.window, e->xfocus.mode, e->xfocus.detail); @@ -840,7 +840,7 @@ static void event_handle_client(ObClient *client, XEvent *e) if (e->xconfigurerequest.value_mask & CWY) y = newy; } - + switch (client->gravity) { case NorthEastGravity: case EastGravity: @@ -1038,7 +1038,7 @@ static void event_handle_client(ObClient *client, XEvent *e) if (e->xclient.data.l[0] & 1 << 9) y = newy; } - + client_configure(client, OB_CORNER_TOPLEFT, x, y, w, h, FALSE, TRUE); diff --git a/openbox/extensions.c b/openbox/extensions.c index 3ee3928c..4679f939 100644 --- a/openbox/extensions.c +++ b/openbox/extensions.c @@ -63,7 +63,7 @@ void extensions_query_all() #ifdef VIDMODE extensions_vidmode = - XF86VidModeQueryExtension(ob_display, &extensions_vidmode_event_basep, + XF86VidModeQueryExtension(ob_display, &extensions_vidmode_event_basep, &junk); #endif } diff --git a/openbox/frame.c b/openbox/frame.c index 74d5630e..18a32eab 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -37,7 +37,7 @@ EnterWindowMask | LeaveWindowMask) #define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \ - f->cbwidth_y) + f->cbwidth_y) static void layout_title(ObFrame *self); static void flash_done(gpointer data); @@ -47,10 +47,10 @@ static void set_theme_statics(ObFrame *self); static void free_theme_statics(ObFrame *self); static Window createWindow(Window parent, gulong mask, - XSetWindowAttributes *attrib) + XSetWindowAttributes *attrib) { return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0, - RrDepth(ob_rr_inst), InputOutput, + RrDepth(ob_rr_inst), InputOutput, RrVisual(ob_rr_inst), mask, attrib); } @@ -109,9 +109,9 @@ ObFrame *frame_new() XMapWindow(ob_display, self->label); self->max_press = self->close_press = self->desk_press = - self->iconify_press = self->shade_press = FALSE; + self->iconify_press = self->shade_press = FALSE; self->max_hover = self->close_hover = self->desk_hover = - self->iconify_hover = self->shade_hover = FALSE; + self->iconify_hover = self->shade_hover = FALSE; set_theme_statics(self); @@ -218,41 +218,41 @@ void frame_adjust_shape(ObFrame *self) XRectangle xrect[2]; if (!self->client->shaped) { - /* clear the shape on the frame window */ - XShapeCombineMask(ob_display, self->window, ShapeBounding, - self->innersize.left, - self->innersize.top, - None, ShapeSet); + /* clear the shape on the frame window */ + XShapeCombineMask(ob_display, self->window, ShapeBounding, + self->innersize.left, + self->innersize.top, + None, ShapeSet); } else { - /* make the frame's shape match the clients */ - XShapeCombineShape(ob_display, self->window, ShapeBounding, - self->innersize.left, - self->innersize.top, - self->client->window, - ShapeBounding, ShapeSet); - - num = 0; - if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { - xrect[0].x = -ob_rr_theme->bwidth; - xrect[0].y = -ob_rr_theme->bwidth; - xrect[0].width = self->width + self->rbwidth * 2; - xrect[0].height = ob_rr_theme->title_height + - self->bwidth * 2; - ++num; - } - - if (self->decorations & OB_FRAME_DECOR_HANDLE) { - xrect[1].x = -ob_rr_theme->bwidth; - xrect[1].y = FRAME_HANDLE_Y(self); - xrect[1].width = self->width + self->rbwidth * 2; - xrect[1].height = ob_rr_theme->handle_height + - self->bwidth * 2; - ++num; - } - - XShapeCombineRectangles(ob_display, self->window, - ShapeBounding, 0, 0, xrect, num, - ShapeUnion, Unsorted); + /* make the frame's shape match the clients */ + XShapeCombineShape(ob_display, self->window, ShapeBounding, + self->innersize.left, + self->innersize.top, + self->client->window, + ShapeBounding, ShapeSet); + + num = 0; + if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { + xrect[0].x = -ob_rr_theme->bwidth; + xrect[0].y = -ob_rr_theme->bwidth; + xrect[0].width = self->width + self->rbwidth * 2; + xrect[0].height = ob_rr_theme->title_height + + self->bwidth * 2; + ++num; + } + + if (self->decorations & OB_FRAME_DECOR_HANDLE) { + xrect[1].x = -ob_rr_theme->bwidth; + xrect[1].y = FRAME_HANDLE_Y(self); + xrect[1].width = self->width + self->rbwidth * 2; + xrect[1].height = ob_rr_theme->handle_height + + self->bwidth * 2; + ++num; + } + + XShapeCombineRectangles(ob_display, self->window, + ShapeBounding, 0, 0, xrect, num, + ShapeUnion, Unsorted); } #endif } @@ -391,9 +391,9 @@ void frame_adjust_area(ObFrame *self, gboolean moved, /* shading can change without being moved or resized */ RECT_SET_SIZE(self->area, - self->client->area.width + - self->size.left + self->size.right, - (self->client->shaded ? + self->client->area.width + + self->size.left + self->size.right, + (self->client->shaded ? ob_rr_theme->title_height + self->rbwidth * 2: self->client->area.height + self->size.top + self->size.bottom)); @@ -473,7 +473,7 @@ void frame_grab_client(ObFrame *self, ObClient *client) handled and need to be ignored. */ if (ob_state() == OB_STATE_STARTING) - client->ignore_unmaps += 2; + client->ignore_unmaps += 2; /* select the event mask on the client's parent (to receive config/map req's) the ButtonPress is to catch clicks on the client border */ @@ -569,48 +569,48 @@ static void layout_title(ObFrame *self) /* figure out whats being shown, and the width of the label */ self->label_width = self->width - (ob_rr_theme->padding + 1) * 2; for (lc = config_title_layout; *lc != '\0'; ++lc) { - switch (*lc) { - case 'N': + switch (*lc) { + case 'N': if (n) { *lc = ' '; break; } /* rm duplicates */ - n = TRUE; - self->label_width -= (ob_rr_theme->button_size + 2 + + n = TRUE; + self->label_width -= (ob_rr_theme->button_size + 2 + ob_rr_theme->padding + 1); - break; - case 'D': + break; + case 'D': if (d) { *lc = ' '; break; } /* rm duplicates */ - d = TRUE; - self->label_width -= (ob_rr_theme->button_size + + d = TRUE; + self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->padding + 1); - break; - case 'S': + break; + case 'S': if (s) { *lc = ' '; break; } /* rm duplicates */ - s = TRUE; - self->label_width -= (ob_rr_theme->button_size + + s = TRUE; + self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->padding + 1); - break; - case 'I': + break; + case 'I': if (i) { *lc = ' '; break; } /* rm duplicates */ - i = TRUE; - self->label_width -= (ob_rr_theme->button_size + + i = TRUE; + self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->padding + 1); - break; - case 'L': + break; + case 'L': if (l) { *lc = ' '; break; } /* rm duplicates */ - l = TRUE; - break; - case 'M': + l = TRUE; + break; + case 'M': if (m) { *lc = ' '; break; } /* rm duplicates */ - m = TRUE; - self->label_width -= (ob_rr_theme->button_size + + m = TRUE; + self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->padding + 1); - break; - case 'C': + break; + case 'C': if (c) { *lc = ' '; break; } /* rm duplicates */ - c = TRUE; - self->label_width -= (ob_rr_theme->button_size + + c = TRUE; + self->label_width -= (ob_rr_theme->button_size + ob_rr_theme->padding + 1); - break; - } + break; + } } if (self->label_width < 1) self->label_width = 1; @@ -627,57 +627,57 @@ static void layout_title(ObFrame *self) x = ob_rr_theme->padding + 1; for (lc = config_title_layout; *lc != '\0'; ++lc) { - switch (*lc) { - case 'N': - if (!n) break; - self->icon_x = x; - XMapWindow(ob_display, self->icon); - XMoveWindow(ob_display, self->icon, x, ob_rr_theme->padding); - x += ob_rr_theme->button_size + 2 + ob_rr_theme->padding + 1; - break; - case 'D': - if (!d) break; - self->desk_x = x; - XMapWindow(ob_display, self->desk); - XMoveWindow(ob_display, self->desk, x, ob_rr_theme->padding + 1); - x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; - break; - case 'S': - if (!s) break; - self->shade_x = x; - XMapWindow(ob_display, self->shade); - XMoveWindow(ob_display, self->shade, x, ob_rr_theme->padding + 1); - x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; - break; - case 'I': - if (!i) break; - self->iconify_x = x; - XMapWindow(ob_display, self->iconify); - XMoveWindow(ob_display,self->iconify, x, ob_rr_theme->padding + 1); - x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; - break; - case 'L': - if (!l) break; - self->label_x = x; - XMapWindow(ob_display, self->label); - XMoveWindow(ob_display, self->label, x, ob_rr_theme->padding); - x += self->label_width + ob_rr_theme->padding + 1; - break; - case 'M': - if (!m) break; - self->max_x = x; - XMapWindow(ob_display, self->max); - XMoveWindow(ob_display, self->max, x, ob_rr_theme->padding + 1); - x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; - break; - case 'C': - if (!c) break; - self->close_x = x; - XMapWindow(ob_display, self->close); - XMoveWindow(ob_display, self->close, x, ob_rr_theme->padding + 1); - x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; - break; - } + switch (*lc) { + case 'N': + if (!n) break; + self->icon_x = x; + XMapWindow(ob_display, self->icon); + XMoveWindow(ob_display, self->icon, x, ob_rr_theme->padding); + x += ob_rr_theme->button_size + 2 + ob_rr_theme->padding + 1; + break; + case 'D': + if (!d) break; + self->desk_x = x; + XMapWindow(ob_display, self->desk); + XMoveWindow(ob_display, self->desk, x, ob_rr_theme->padding + 1); + x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; + break; + case 'S': + if (!s) break; + self->shade_x = x; + XMapWindow(ob_display, self->shade); + XMoveWindow(ob_display, self->shade, x, ob_rr_theme->padding + 1); + x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; + break; + case 'I': + if (!i) break; + self->iconify_x = x; + XMapWindow(ob_display, self->iconify); + XMoveWindow(ob_display,self->iconify, x, ob_rr_theme->padding + 1); + x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; + break; + case 'L': + if (!l) break; + self->label_x = x; + XMapWindow(ob_display, self->label); + XMoveWindow(ob_display, self->label, x, ob_rr_theme->padding); + x += self->label_width + ob_rr_theme->padding + 1; + break; + case 'M': + if (!m) break; + self->max_x = x; + XMapWindow(ob_display, self->max); + XMoveWindow(ob_display, self->max, x, ob_rr_theme->padding + 1); + x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; + break; + case 'C': + if (!c) break; + self->close_x = x; + XMapWindow(ob_display, self->close); + XMoveWindow(ob_display, self->close, x, ob_rr_theme->padding + 1); + x += ob_rr_theme->button_size + ob_rr_theme->padding + 1; + break; + } } } @@ -771,24 +771,24 @@ void frame_client_gravity(ObFrame *self, gint *x, gint *y) case NorthWestGravity: case SouthWestGravity: case WestGravity: - break; + break; case NorthGravity: case SouthGravity: case CenterGravity: - *x -= (self->size.left + self->size.right) / 2; - break; + *x -= (self->size.left + self->size.right) / 2; + break; case NorthEastGravity: case SouthEastGravity: case EastGravity: - *x -= self->size.left + self->size.right; - break; + *x -= self->size.left + self->size.right; + break; case ForgetGravity: case StaticGravity: - *x -= self->size.left; - break; + *x -= self->size.left; + break; } /* vertical */ @@ -797,24 +797,24 @@ void frame_client_gravity(ObFrame *self, gint *x, gint *y) case NorthWestGravity: case NorthEastGravity: case NorthGravity: - break; + break; case CenterGravity: case EastGravity: case WestGravity: - *y -= (self->size.top + self->size.bottom) / 2; - break; + *y -= (self->size.top + self->size.bottom) / 2; + break; case SouthWestGravity: case SouthEastGravity: case SouthGravity: - *y -= self->size.top + self->size.bottom; - break; + *y -= self->size.top + self->size.bottom; + break; case ForgetGravity: case StaticGravity: - *y -= self->size.top; - break; + *y -= self->size.top; + break; } } @@ -826,21 +826,21 @@ void frame_frame_gravity(ObFrame *self, gint *x, gint *y) case NorthWestGravity: case WestGravity: case SouthWestGravity: - break; + break; case NorthGravity: case CenterGravity: case SouthGravity: - *x += (self->size.left + self->size.right) / 2; - break; + *x += (self->size.left + self->size.right) / 2; + break; case NorthEastGravity: case EastGravity: case SouthEastGravity: - *x += self->size.left + self->size.right; - break; + *x += self->size.left + self->size.right; + break; case StaticGravity: case ForgetGravity: - *x += self->size.left; - break; + *x += self->size.left; + break; } /* vertical */ @@ -849,21 +849,21 @@ void frame_frame_gravity(ObFrame *self, gint *x, gint *y) case NorthWestGravity: case NorthGravity: case NorthEastGravity: - break; + break; case WestGravity: case CenterGravity: case EastGravity: - *y += (self->size.top + self->size.bottom) / 2; - break; + *y += (self->size.top + self->size.bottom) / 2; + break; case SouthWestGravity: case SouthGravity: case SouthEastGravity: - *y += self->size.top + self->size.bottom; - break; + *y += self->size.top + self->size.bottom; + break; case StaticGravity: case ForgetGravity: - *y += self->size.top; - break; + *y += self->size.top; + break; } } diff --git a/openbox/geom.h b/openbox/geom.h index 6b5fb0a0..91dd48eb 100644 --- a/openbox/geom.h +++ b/openbox/geom.h @@ -53,7 +53,7 @@ typedef struct _Rect { (r).x = (nx), (r).y = (ny), (r).width = (w), (r).height = (h) #define RECT_EQUAL(r1, r2) ((r1).x == (r2).x && (r1).y == (r2).y && \ - (r1).width == (r2).width && \ + (r1).width == (r2).width && \ (r1).height == (r2).height) #define RECT_CONTAINS(r, px, py) \ diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 51650348..3e56125d 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -119,7 +119,7 @@ gboolean keyboard_bind(GList *keylist, ObAction *action) return FALSE; if ((t = tree_find(tree, &conflict)) != NULL) { - /* already bound to something, use the existing tree */ + /* already bound to something, use the existing tree */ tree_destroy(tree); tree = NULL; } else diff --git a/openbox/keytree.c b/openbox/keytree.c index cc3f6407..676f3612 100644 --- a/openbox/keytree.c +++ b/openbox/keytree.c @@ -25,20 +25,20 @@ void tree_destroy(KeyBindingTree *tree) KeyBindingTree *c; while (tree) { - tree_destroy(tree->next_sibling); - c = tree->first_child; - if (c == NULL) { - GList *it; + tree_destroy(tree->next_sibling); + c = tree->first_child; + if (c == NULL) { + GList *it; GSList *sit; - for (it = tree->keylist; it != NULL; it = it->next) - g_free(it->data); - g_list_free(tree->keylist); - for (sit = tree->actions; sit != NULL; sit = sit->next) + for (it = tree->keylist; it != NULL; it = it->next) + g_free(it->data); + g_list_free(tree->keylist); + for (sit = tree->actions; sit != NULL; sit = sit->next) action_unref(sit->data); - g_slist_free(tree->actions); - } - g_free(tree); - tree = c; + g_slist_free(tree->actions); + } + g_free(tree); + tree = c; } } @@ -48,24 +48,24 @@ KeyBindingTree *tree_build(GList *keylist) KeyBindingTree *ret = NULL, *p; if (g_list_length(keylist) <= 0) - return NULL; /* nothing in the list.. */ + return NULL; /* nothing in the list.. */ for (it = g_list_last(keylist); it; it = g_list_previous(it)) { - p = ret; - ret = g_new0(KeyBindingTree, 1); - if (p == NULL) { - GList *it; - - /* this is the first built node, the bottom node of the tree */ - ret->keylist = g_list_copy(keylist); /* shallow copy */ - for (it = ret->keylist; it; it = g_list_next(it)) /* deep copy */ - it->data = g_strdup(it->data); - } - ret->first_child = p; - if (!translate_key(it->data, &ret->state, &ret->key)) { - tree_destroy(ret); - return NULL; - } + p = ret; + ret = g_new0(KeyBindingTree, 1); + if (p == NULL) { + GList *it; + + /* this is the first built node, the bottom node of the tree */ + ret->keylist = g_list_copy(keylist); /* shallow copy */ + for (it = ret->keylist; it; it = g_list_next(it)) /* deep copy */ + it->data = g_strdup(it->data); + } + ret->first_child = p; + if (!translate_key(it->data, &ret->state, &ret->key)) { + tree_destroy(ret); + return NULL; + } } return ret; } @@ -75,29 +75,29 @@ void tree_assimilate(KeyBindingTree *node) KeyBindingTree *a, *b, *tmp, *last; if (keyboard_firstnode == NULL) { - /* there are no nodes at this level yet */ - keyboard_firstnode = node; + /* there are no nodes at this level yet */ + keyboard_firstnode = node; } else { - a = keyboard_firstnode; - last = a; - b = node; - while (a) { - last = a; - if (!(a->state == b->state && a->key == b->key)) { - a = a->next_sibling; - } else { - tmp = b; - b = b->first_child; - g_free(tmp); - a = a->first_child; - } - } - if (!(last->state == b->state && last->key == b->key)) - last->next_sibling = b; - else { - last->first_child = b->first_child; - g_free(b); - } + a = keyboard_firstnode; + last = a; + b = node; + while (a) { + last = a; + if (!(a->state == b->state && a->key == b->key)) { + a = a->next_sibling; + } else { + tmp = b; + b = b->first_child; + g_free(tmp); + a = a->first_child; + } + } + if (!(last->state == b->state && last->key == b->key)) + last->next_sibling = b; + else { + last->first_child = b->first_child; + g_free(b); + } } } @@ -110,21 +110,21 @@ KeyBindingTree *tree_find(KeyBindingTree *search, gboolean *conflict) a = keyboard_firstnode; b = search; while (a && b) { - if (!(a->state == b->state && a->key == b->key)) { - a = a->next_sibling; - } else { - if ((a->first_child == NULL) == (b->first_child == NULL)) { - if (a->first_child == NULL) { - /* found it! (return the actual node, not the search's) */ - return a; - } - } else { - *conflict = TRUE; - return NULL; /* the chain status' don't match (conflict!) */ - } - b = b->first_child; - a = a->first_child; - } + if (!(a->state == b->state && a->key == b->key)) { + a = a->next_sibling; + } else { + if ((a->first_child == NULL) == (b->first_child == NULL)) { + if (a->first_child == NULL) { + /* found it! (return the actual node, not the search's) */ + return a; + } + } else { + *conflict = TRUE; + return NULL; /* the chain status' don't match (conflict!) */ + } + b = b->first_child; + a = a->first_child; + } } return NULL; /* it just isn't in here */ } diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 5a18c51c..0d04c7a8 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -29,7 +29,7 @@ #define MAX_MENU_WIDTH 400 #define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask |\ - LeaveWindowMask) + LeaveWindowMask) #define TITLE_EVENTMASK (ButtonPressMask | ButtonMotionMask) #define ENTRY_EVENTMASK (EnterWindowMask | LeaveWindowMask | \ ButtonPressMask | ButtonReleaseMask) @@ -43,10 +43,10 @@ static void menu_frame_render(ObMenuFrame *self); static void menu_frame_update(ObMenuFrame *self); static Window createWindow(Window parent, gulong mask, - XSetWindowAttributes *attrib) + XSetWindowAttributes *attrib) { return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0, - RrDepth(ob_rr_inst), InputOutput, + RrDepth(ob_rr_inst), InputOutput, RrVisual(ob_rr_inst), mask, attrib); } diff --git a/openbox/mouse.c b/openbox/mouse.c index 9a5ab53b..0ed181d9 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -125,7 +125,7 @@ static void grab_all_clients(gboolean grab) GList *it; for (it = client_list; it; it = g_list_next(it)) - mouse_grab_for_client(it->data, grab); + mouse_grab_for_client(it->data, grab); } void mouse_unbind_all() @@ -315,11 +315,11 @@ gboolean mouse_bind(const gchar *buttonstr, const gchar *contextstr, } for (it = bound_contexts[context]; it; it = g_slist_next(it)) { - b = it->data; - if (b->state == state && b->button == button) { + b = it->data; + if (b->state == state && b->button == button) { b->actions[mact] = g_slist_append(b->actions[mact], action); return TRUE; - } + } } /* when there are no modifiers in the binding, then the action cannot diff --git a/openbox/prop.c b/openbox/prop.c index 69fa4b80..f6559c40 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -170,14 +170,14 @@ static gboolean get(Window win, Atom prop, Atom type, gint size, glong num32 = 32 / size * num; /\* num in 32-bit elements *\/ res = XGetWindowProperty(display, win, prop, 0l, num32, - FALSE, type, &ret_type, &ret_size, - &ret_items, &bytes_left, &xdata); + FALSE, type, &ret_type, &ret_size, + &ret_items, &bytes_left, &xdata); if (res == Success && ret_items && xdata) { - if (ret_size == size && ret_items >= num) { - *data = g_memdup(xdata, num * (size / 8)); - ret = TRUE; - } - XFree(xdata); + if (ret_size == size && ret_items >= num) { + *data = g_memdup(xdata, num * (size / 8)); + ret = TRUE; + } + XFree(xdata); } return ret; } @@ -195,28 +195,28 @@ static gboolean get_prealloc(Window win, Atom prop, Atom type, gint size, glong num32 = 32 / size * num; /* num in 32-bit elements */ res = XGetWindowProperty(ob_display, win, prop, 0l, num32, - FALSE, type, &ret_type, &ret_size, - &ret_items, &bytes_left, &xdata); + FALSE, type, &ret_type, &ret_size, + &ret_items, &bytes_left, &xdata); if (res == Success && ret_items && xdata) { - if (ret_size == size && ret_items >= num) { - guint i; - for (i = 0; i < num; ++i) - switch (size) { - case 8: - data[i] = xdata[i]; - break; - case 16: - ((guint16*)data)[i] = ((guint16*)xdata)[i]; - break; - case 32: - ((guint32*)data)[i] = ((gulong*)xdata)[i]; - break; - default: - g_assert_not_reached(); /* unhandled size */ - } - ret = TRUE; - } - XFree(xdata); + if (ret_size == size && ret_items >= num) { + guint i; + for (i = 0; i < num; ++i) + switch (size) { + case 8: + data[i] = xdata[i]; + break; + case 16: + ((guint16*)data)[i] = ((guint16*)xdata)[i]; + break; + case 32: + ((guint32*)data)[i] = ((gulong*)xdata)[i]; + break; + default: + g_assert_not_reached(); /* unhandled size */ + } + ret = TRUE; + } + XFree(xdata); } return ret; } @@ -232,31 +232,31 @@ static gboolean get_all(Window win, Atom prop, Atom type, gint size, gulong ret_items, bytes_left; res = XGetWindowProperty(ob_display, win, prop, 0l, G_MAXLONG, - FALSE, type, &ret_type, &ret_size, - &ret_items, &bytes_left, &xdata); + FALSE, type, &ret_type, &ret_size, + &ret_items, &bytes_left, &xdata); if (res == Success) { - if (ret_size == size && ret_items > 0) { - guint i; - - *data = g_malloc(ret_items * (size / 8)); - for (i = 0; i < ret_items; ++i) - switch (size) { - case 8: - (*data)[i] = xdata[i]; - break; - case 16: - ((guint16*)*data)[i] = ((guint16*)xdata)[i]; - break; - case 32: - ((guint32*)*data)[i] = ((gulong*)xdata)[i]; - break; - default: - g_assert_not_reached(); /* unhandled size */ - } - *num = ret_items; - ret = TRUE; - } - XFree(xdata); + if (ret_size == size && ret_items > 0) { + guint i; + + *data = g_malloc(ret_items * (size / 8)); + for (i = 0; i < ret_items; ++i) + switch (size) { + case 8: + (*data)[i] = xdata[i]; + break; + case 16: + ((guint16*)*data)[i] = ((guint16*)xdata)[i]; + break; + case 32: + ((guint32*)*data)[i] = ((gulong*)xdata)[i]; + break; + default: + g_assert_not_reached(); /* unhandled size */ + } + *num = ret_items; + ret = TRUE; + } + XFree(xdata); } return ret; } @@ -328,9 +328,9 @@ gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret) if (!(*ret)[i]) (*ret)[i] = g_strdup(""); } - g_free(raw); + g_free(raw); g_slist_free(strs); - return TRUE; + return TRUE; } return FALSE; } @@ -342,8 +342,8 @@ gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret) guint num; if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) { - str = g_strndup(raw, num); /* grab the first string from the list */ - g_free(raw); + str = g_strndup(raw, num); /* grab the first string from the list */ + g_free(raw); if (g_utf8_validate(str, -1, NULL)) { *ret = str; return TRUE; @@ -376,9 +376,9 @@ gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret) else (*ret)[i] = g_strdup(""); } - g_free(raw); + g_free(raw); g_slist_free(strs); - return TRUE; + return TRUE; } return FALSE; } @@ -423,7 +423,7 @@ void prop_erase(Window win, Atom prop) } void prop_message(Window about, Atom messagetype, glong data0, glong data1, - glong data2, glong data3, glong mask) + glong data2, glong data3, glong mask) { XEvent ce; ce.xclient.type = ClientMessage; @@ -436,5 +436,5 @@ void prop_message(Window about, Atom messagetype, glong data0, glong data1, ce.xclient.data.l[2] = data2; ce.xclient.data.l[3] = data3; XSendEvent(ob_display, RootWindow(ob_display, ob_screen), FALSE, - mask, &ce); + mask, &ce); } diff --git a/openbox/prop.h b/openbox/prop.h index ca603d6d..4a7b44a0 100644 --- a/openbox/prop.h +++ b/openbox/prop.h @@ -186,7 +186,7 @@ void prop_set_strings_utf8(Window win, Atom prop, gchar **strs); void prop_erase(Window win, Atom prop); void prop_message(Window about, Atom messagetype, glong data0, glong data1, - glong data2, glong data3, glong mask); + glong data2, glong data3, glong mask); #define PROP_GET32(win, prop, type, ret) \ (prop_get32(win, prop_atoms.prop, prop_atoms.type, ret)) diff --git a/openbox/screen.c b/openbox/screen.c index ef791bad..aa296f9f 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -182,7 +182,7 @@ gboolean screen_annex() ob_screen); XDestroyWindow(ob_display, screen_support_win); - return FALSE; + return FALSE; } @@ -355,7 +355,7 @@ void screen_resize() net_desktop_geometry, cardinal, geometry, 2); if (ob_state() == OB_STATE_STARTING) - return; + return; screen_update_areas(); dock_configure(); @@ -403,7 +403,7 @@ void screen_set_num_desktops(guint num) /* change our desktop if we're on one that no longer exists! */ if (screen_desktop >= screen_num_desktops) - screen_set_desktop(num - 1); + screen_set_desktop(num - 1); /* update the focus lists */ /* free our lists for the desktops which have disappeared */ @@ -1159,9 +1159,9 @@ Rect *screen_area_monitor(guint desktop, guint head) if (head > screen_num_monitors) return NULL; if (desktop >= screen_num_desktops) { - if (desktop == DESKTOP_ALL) - return &area[screen_num_desktops][head]; - return NULL; + if (desktop == DESKTOP_ALL) + return &area[screen_num_desktops][head]; + return NULL; } return &area[desktop][head]; } diff --git a/openbox/stacking.c b/openbox/stacking.c index c715eae0..d053bec4 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -41,7 +41,7 @@ void stacking_set_list() /* create an array of the window ids (from bottom to top, reverse order!) */ if (stacking_list) { - windows = g_new(Window, g_list_length(stacking_list)); + windows = g_new(Window, g_list_length(stacking_list)); for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { if (WINDOW_IS_CLIENT(it->data)) windows[i++] = WINDOW_AS_CLIENT(it->data)->window; diff --git a/openbox/translate.c b/openbox/translate.c index 312d3292..48f1c150 100644 --- a/openbox/translate.c +++ b/openbox/translate.c @@ -51,16 +51,16 @@ gboolean translate_button(const gchar *str, guint *state, guint *button) /* first, find the button (last token) */ l = NULL; for (i = 0; parsed[i] != NULL; ++i) - l = parsed[i]; + l = parsed[i]; if (l == NULL) - goto translation_fail; + goto translation_fail; /* figure out the mod mask */ *state = 0; for (i = 0; parsed[i] != l; ++i) { - guint m = translate_modifier(parsed[i]); - if (!m) goto translation_fail; - *state |= m; + guint m = translate_modifier(parsed[i]); + if (!m) goto translation_fail; + *state |= m; } /* figure out the button */ @@ -71,8 +71,8 @@ gboolean translate_button(const gchar *str, guint *state, guint *button) else if (!g_ascii_strcasecmp("Down", l)) *button = 5; else if (!g_ascii_strncasecmp("Button", l, 6)) *button = atoi(l+6); if (!*button) { - g_warning("Invalid button '%s' in pointer binding.", l); - goto translation_fail; + g_warning("Invalid button '%s' in pointer binding.", l); + goto translation_fail; } ret = TRUE; @@ -95,16 +95,16 @@ gboolean translate_key(const gchar *str, guint *state, guint *keycode) /* first, find the key (last token) */ l = NULL; for (i = 0; parsed[i] != NULL; ++i) - l = parsed[i]; + l = parsed[i]; if (l == NULL) - goto translation_fail; + goto translation_fail; /* figure out the mod mask */ *state = 0; for (i = 0; parsed[i] != l; ++i) { - guint m = translate_modifier(parsed[i]); - if (!m) goto translation_fail; - *state |= m; + guint m = translate_modifier(parsed[i]); + if (!m) goto translation_fail; + *state |= m; } if (!g_ascii_strncasecmp("0x", l, 2)) { @@ -126,8 +126,8 @@ gboolean translate_key(const gchar *str, guint *state, guint *keycode) *keycode = XKeysymToKeycode(ob_display, sym); } if (!*keycode) { - g_warning("Key '%s' does not exist on the display.", l); - goto translation_fail; + g_warning("Key '%s' does not exist on the display.", l); + goto translation_fail; } ret = TRUE; diff --git a/openbox/xerror.c b/openbox/xerror.c index 12a66afc..25041fda 100644 --- a/openbox/xerror.c +++ b/openbox/xerror.c @@ -29,7 +29,7 @@ gint xerror_handler(Display *d, XErrorEvent *e) #ifdef DEBUG if (!xerror_ignore) { gchar errtxt[128]; - + /*if (e->error_code != BadWindow) */ { XGetErrorText(d, e->error_code, errtxt, 127); diff --git a/render/color.c b/render/color.c index 491dc47b..9f053e97 100644 --- a/render/color.c +++ b/render/color.c @@ -49,7 +49,7 @@ RrColor *RrColorParse(const RrInstance *inst, gchar *colorname) xcol.pixel = 0; if (!XParseColor(RrDisplay(inst), RrColormap(inst), colorname, &xcol)) { g_warning("unable to parse color '%s'", colorname); - return NULL; + return NULL; } return RrColorNew(inst, xcol.red >> 8, xcol.green >> 8, xcol.blue >> 8); } diff --git a/render/test.c b/render/test.c index b50053c2..cb67c2b0 100644 --- a/render/test.c +++ b/render/test.c @@ -28,10 +28,10 @@ static gint x_error_handler(Display * disp, XErrorEvent * error) { - gchar buf[1024]; - XGetErrorText(disp, error->error_code, buf, 1024); - printf("%s\n", buf); - return 0; + gchar buf[1024]; + XGetErrorText(disp, error->error_code, buf, 1024); + printf("%s\n", buf); + return 0; } Display *ob_display; @@ -40,58 +40,58 @@ Window ob_root; gint main() { - Window win; - RrInstance *inst; - RrAppearance *look; + Window win; + RrInstance *inst; + RrAppearance *look; - Window root; - XEvent report; - gint h = 500, w = 500; + Window root; + XEvent report; + gint h = 500, w = 500; - ob_display = XOpenDisplay(NULL); - XSetErrorHandler(x_error_handler); - ob_screen = DefaultScreen(ob_display); - ob_root = RootWindow(ob_display, ob_screen); - win = - XCreateWindow(ob_display, RootWindow(ob_display, 0), - 10, 10, w, h, 10, - CopyFromParent, /* depth */ - CopyFromParent, /* class */ - CopyFromParent, /* visual */ - 0, /* valuemask */ - 0); /* attributes */ - XMapWindow(ob_display, win); - XSelectInput(ob_display, win, ExposureMask | StructureNotifyMask); - root = RootWindow (ob_display, DefaultScreen (ob_display)); - inst = RrInstanceNew(ob_display, ob_screen); + ob_display = XOpenDisplay(NULL); + XSetErrorHandler(x_error_handler); + ob_screen = DefaultScreen(ob_display); + ob_root = RootWindow(ob_display, ob_screen); + win = + XCreateWindow(ob_display, RootWindow(ob_display, 0), + 10, 10, w, h, 10, + CopyFromParent, /* depth */ + CopyFromParent, /* class */ + CopyFromParent, /* visual */ + 0, /* valuemask */ + 0); /* attributes */ + XMapWindow(ob_display, win); + XSelectInput(ob_display, win, ExposureMask | StructureNotifyMask); + root = RootWindow (ob_display, DefaultScreen (ob_display)); + inst = RrInstanceNew(ob_display, ob_screen); - look = RrAppearanceNew(inst, 0); - look->surface.grad = RR_SURFACE_PYRAMID; - look->surface.secondary = RrColorParse(inst, "Yellow"); - look->surface.primary = RrColorParse(inst, "Blue"); - look->surface.interlaced = FALSE; - if (ob_display == NULL) { - fprintf(stderr, "couldn't connect to X server :0\n"); - return 0; - } + look = RrAppearanceNew(inst, 0); + look->surface.grad = RR_SURFACE_PYRAMID; + look->surface.secondary = RrColorParse(inst, "Yellow"); + look->surface.primary = RrColorParse(inst, "Blue"); + look->surface.interlaced = FALSE; + if (ob_display == NULL) { + fprintf(stderr, "couldn't connect to X server :0\n"); + return 0; + } - RrPaint(look, win, w, h); - while (1) { - XNextEvent(ob_display, &report); - switch (report.type) { - case Expose: - break; - case ConfigureNotify: - RrPaint(look, win, - report.xconfigure.width, - report.xconfigure.height); - break; - } + RrPaint(look, win, w, h); + while (1) { + XNextEvent(ob_display, &report); + switch (report.type) { + case Expose: + break; + case ConfigureNotify: + RrPaint(look, win, + report.xconfigure.width, + report.xconfigure.height); + break; + } - } + } - RrAppearanceFree (look); - RrInstanceFree (inst); + RrAppearanceFree (look); + RrInstanceFree (inst); - return 1; + return 1; } diff --git a/render/theme.c b/render/theme.c index bb6a1232..3b44b525 100644 --- a/render/theme.c +++ b/render/theme.c @@ -500,17 +500,17 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) /* read buttons textures */ if (!read_appearance(db, inst, "window.active.button.disabled.bg", - theme->a_disabled_focused_max, + theme->a_disabled_focused_max, TRUE)) set_default_appearance(theme->a_disabled_focused_max); if (!read_appearance(db, inst, "window.inactive.button.disabled.bg", - theme->a_disabled_unfocused_max, + theme->a_disabled_unfocused_max, TRUE)) set_default_appearance(theme->a_disabled_unfocused_max); if (!read_appearance(db, inst, "window.active.button.pressed.bg", - theme->a_focused_pressed_max, + theme->a_focused_pressed_max, TRUE)) set_default_appearance(theme->a_focused_pressed_max); if (!read_appearance(db, inst, @@ -1212,7 +1212,7 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad, *relief = RR_RELIEF_FLAT; else *relief = RR_RELIEF_RAISED; - + *border = FALSE; if (*relief == RR_RELIEF_FLAT) { if (strstr(tex, "border") != NULL) diff --git a/tools/kdetrayproxy/kdetrayproxy.c b/tools/kdetrayproxy/kdetrayproxy.c index d2de3017..00f2d248 100644 --- a/tools/kdetrayproxy/kdetrayproxy.c +++ b/tools/kdetrayproxy/kdetrayproxy.c @@ -223,9 +223,9 @@ Window findclient(Window win) /* try me */ XGetWindowProperty(display, win, state, 0, 1, - False, state, &ret_type, &ret_format, - &ret_items, &ret_bytesleft, - (unsigned char**) &prop_return); + False, state, &ret_type, &ret_format, + &ret_items, &ret_bytesleft, + (unsigned char**) &prop_return); if (ret_type == None || ret_items < 1) return None; return win; /* found it! */ -- 2.45.2