/*! The event mask to grab on client windows */
#define CLIENT_EVENTMASK (PropertyChangeMask | FocusChangeMask | \
- StructureNotifyMask)
+ StructureNotifyMask)
#define CLIENT_NOPROPAGATEMASK (ButtonPressMask | ButtonReleaseMask | \
- ButtonMotionMask)
+ ButtonMotionMask)
typedef struct
{
/* 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))
@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.
*/
/*! 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 */
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]);
}
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 */
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);
}
#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)
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",
#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);
if (e->xconfigurerequest.value_mask & CWY)
y = newy;
}
-
+
switch (client->gravity) {
case NorthEastGravity:
case EastGravity:
if (e->xclient.data.l[0] & 1 << 9)
y = newy;
}
-
+
client_configure(client, OB_CORNER_TOPLEFT,
x, y, w, h, FALSE, TRUE);
#ifdef VIDMODE
extensions_vidmode =
- XF86VidModeQueryExtension(ob_display, &extensions_vidmode_event_basep,
+ XF86VidModeQueryExtension(ob_display, &extensions_vidmode_event_basep,
&junk);
#endif
}
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);
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);
}
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);
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
}
/* 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));
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 */
/* 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;
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;
+ }
}
}
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 */
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;
}
}
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 */
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;
}
}
(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) \
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
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;
}
}
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;
}
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);
+ }
}
}
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 */
}
#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)
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);
}
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()
}
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
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;
}
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;
}
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;
}
if (!(*ret)[i])
(*ret)[i] = g_strdup("");
}
- g_free(raw);
+ g_free(raw);
g_slist_free(strs);
- return TRUE;
+ return TRUE;
}
return FALSE;
}
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;
else
(*ret)[i] = g_strdup("");
}
- g_free(raw);
+ g_free(raw);
g_slist_free(strs);
- return TRUE;
+ return TRUE;
}
return FALSE;
}
}
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;
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);
}
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))
ob_screen);
XDestroyWindow(ob_display, screen_support_win);
- return FALSE;
+ return FALSE;
}
net_desktop_geometry, cardinal, geometry, 2);
if (ob_state() == OB_STATE_STARTING)
- return;
+ return;
screen_update_areas();
dock_configure();
/* 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 */
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];
}
/* 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;
/* 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 */
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;
/* 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)) {
*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;
#ifdef DEBUG
if (!xerror_ignore) {
gchar errtxt[128];
-
+
/*if (e->error_code != BadWindow) */
{
XGetErrorText(d, e->error_code, errtxt, 127);
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);
}
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;
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;
}
/* 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,
*relief = RR_RELIEF_FLAT;
else
*relief = RR_RELIEF_RAISED;
-
+
*border = FALSE;
if (*relief == RR_RELIEF_FLAT) {
if (strstr(tex, "border") != NULL)
/* 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! */