consistant glib type usage
This commit is contained in:
parent
8085f3490f
commit
740c5b2a20
50 changed files with 399 additions and 396 deletions
|
@ -809,7 +809,7 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact)
|
||||||
{
|
{
|
||||||
ObAction *a = NULL;
|
ObAction *a = NULL;
|
||||||
gboolean exist = FALSE;
|
gboolean exist = FALSE;
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; actionstrings[i].name; i++)
|
for (i = 0; actionstrings[i].name; i++)
|
||||||
if (!g_ascii_strcasecmp(name, actionstrings[i].name)) {
|
if (!g_ascii_strcasecmp(name, actionstrings[i].name)) {
|
||||||
|
@ -831,7 +831,7 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact)
|
||||||
ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
||||||
ObUserAction uact)
|
ObUserAction uact)
|
||||||
{
|
{
|
||||||
char *actname;
|
gchar *actname;
|
||||||
ObAction *act = NULL;
|
ObAction *act = NULL;
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ void action_run_string(const gchar *name, struct _ObClient *c)
|
||||||
void action_execute(union ActionData *data)
|
void action_execute(union ActionData *data)
|
||||||
{
|
{
|
||||||
GError *e = NULL;
|
GError *e = NULL;
|
||||||
char *cmd;
|
gchar *cmd;
|
||||||
if (data->execute.path) {
|
if (data->execute.path) {
|
||||||
cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
|
cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
|
@ -1307,7 +1307,7 @@ void action_toggle_decorations(union ActionData *data)
|
||||||
client_action_end(data);
|
client_action_end(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32 pick_corner(int x, int y, int cx, int cy, int cw, int ch)
|
static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch)
|
||||||
{
|
{
|
||||||
if ((cw / 3 < 1) || (x - cx > cw / 3 * 2)) {
|
if ((cw / 3 < 1) || (x - cx > cw / 3 * 2)) {
|
||||||
if ((ch / 3 < 1) || (y - cy > ch / 3 * 2))
|
if ((ch / 3 < 1) || (y - cy > ch / 3 * 2))
|
||||||
|
@ -1408,7 +1408,7 @@ void action_directional_focus(union ActionData *data)
|
||||||
|
|
||||||
void action_movetoedge(union ActionData *data)
|
void action_movetoedge(union ActionData *data)
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
ObClient *c = data->diraction.any.c;
|
ObClient *c = data->diraction.any.c;
|
||||||
|
|
||||||
x = c->frame->area.x;
|
x = c->frame->area.x;
|
||||||
|
@ -1440,7 +1440,7 @@ void action_movetoedge(union ActionData *data)
|
||||||
|
|
||||||
void action_growtoedge(union ActionData *data)
|
void action_growtoedge(union ActionData *data)
|
||||||
{
|
{
|
||||||
int x, y, width, height, dest;
|
gint x, y, width, height, dest;
|
||||||
ObClient *c = data->diraction.any.c;
|
ObClient *c = data->diraction.any.c;
|
||||||
Rect *a;
|
Rect *a;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct DirectionalAction{
|
||||||
|
|
||||||
struct Execute {
|
struct Execute {
|
||||||
struct AnyAction any;
|
struct AnyAction any;
|
||||||
char *path;
|
gchar *path;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClientAction {
|
struct ClientAction {
|
||||||
|
@ -82,7 +82,7 @@ struct Activate {
|
||||||
|
|
||||||
struct MoveResizeRelative {
|
struct MoveResizeRelative {
|
||||||
struct AnyAction any;
|
struct AnyAction any;
|
||||||
int delta;
|
gint delta;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SendToDesktop {
|
struct SendToDesktop {
|
||||||
|
@ -106,7 +106,7 @@ struct Desktop {
|
||||||
|
|
||||||
struct Layer {
|
struct Layer {
|
||||||
struct AnyAction any;
|
struct AnyAction any;
|
||||||
int layer; /* < 0 = below, 0 = normal, > 0 = above */
|
gint layer; /* < 0 = below, 0 = normal, > 0 = above */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DesktopDirection {
|
struct DesktopDirection {
|
||||||
|
@ -124,7 +124,7 @@ struct MoveResize {
|
||||||
|
|
||||||
struct ShowMenu {
|
struct ShowMenu {
|
||||||
struct AnyAction any;
|
struct AnyAction any;
|
||||||
char *name;
|
gchar *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CycleWindows {
|
struct CycleWindows {
|
||||||
|
|
110
openbox/client.c
110
openbox/client.c
|
@ -166,7 +166,7 @@ void client_set_list()
|
||||||
|
|
||||||
void client_manage_all()
|
void client_manage_all()
|
||||||
{
|
{
|
||||||
unsigned int i, j, nchild;
|
guint i, j, nchild;
|
||||||
Window w, *children;
|
Window w, *children;
|
||||||
XWMHints *wmhints;
|
XWMHints *wmhints;
|
||||||
XWindowAttributes attrib;
|
XWindowAttributes attrib;
|
||||||
|
@ -337,8 +337,8 @@ void client_manage(Window window)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ob_state() == OB_STATE_RUNNING) {
|
if (ob_state() == OB_STATE_RUNNING) {
|
||||||
int x = self->area.x, ox = x;
|
gint x = self->area.x, ox = x;
|
||||||
int y = self->area.y, oy = y;
|
gint y = self->area.y, oy = y;
|
||||||
|
|
||||||
place_client(self, &x, &y);
|
place_client(self, &x, &y);
|
||||||
|
|
||||||
|
@ -585,8 +585,8 @@ static void client_restore_session_stacking(ObClient *self)
|
||||||
|
|
||||||
void client_move_onscreen(ObClient *self, gboolean rude)
|
void client_move_onscreen(ObClient *self, gboolean rude)
|
||||||
{
|
{
|
||||||
int x = self->area.x;
|
gint x = self->area.x;
|
||||||
int y = self->area.y;
|
gint y = self->area.y;
|
||||||
if (client_find_onscreen(self, &x, &y,
|
if (client_find_onscreen(self, &x, &y,
|
||||||
self->frame->area.width,
|
self->frame->area.width,
|
||||||
self->frame->area.height, rude)) {
|
self->frame->area.height, rude)) {
|
||||||
|
@ -594,11 +594,11 @@ void client_move_onscreen(ObClient *self, gboolean rude)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean client_find_onscreen(ObClient *self, int *x, int *y, int w, int h,
|
gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
|
||||||
gboolean rude)
|
gboolean rude)
|
||||||
{
|
{
|
||||||
Rect *a;
|
Rect *a;
|
||||||
int ox = *x, oy = *y;
|
gint ox = *x, oy = *y;
|
||||||
|
|
||||||
frame_client_gravity(self->frame, x, y); /* get where the frame
|
frame_client_gravity(self->frame, x, y); /* get where the frame
|
||||||
would be */
|
would be */
|
||||||
|
@ -648,8 +648,8 @@ static void client_toggle_border(ObClient *self, gboolean show)
|
||||||
different position.
|
different position.
|
||||||
when re-adding the border to the client, the same operation needs to be
|
when re-adding the border to the client, the same operation needs to be
|
||||||
reversed. */
|
reversed. */
|
||||||
int oldx = self->area.x, oldy = self->area.y;
|
gint oldx = self->area.x, oldy = self->area.y;
|
||||||
int x = oldx, y = oldy;
|
gint x = oldx, y = oldy;
|
||||||
switch(self->gravity) {
|
switch(self->gravity) {
|
||||||
default:
|
default:
|
||||||
case NorthWestGravity:
|
case NorthWestGravity:
|
||||||
|
@ -886,9 +886,9 @@ static void client_get_shaped(ObClient *self)
|
||||||
self->shaped = FALSE;
|
self->shaped = FALSE;
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
if (extensions_shape) {
|
if (extensions_shape) {
|
||||||
int foo;
|
gint foo;
|
||||||
guint ufoo;
|
guint ufoo;
|
||||||
int s;
|
gint s;
|
||||||
|
|
||||||
XShapeSelectInput(ob_display, self->window, ShapeNotifyMask);
|
XShapeSelectInput(ob_display, self->window, ShapeNotifyMask);
|
||||||
|
|
||||||
|
@ -1082,8 +1082,8 @@ static void client_get_gravity(ObClient *self)
|
||||||
void client_update_normal_hints(ObClient *self)
|
void client_update_normal_hints(ObClient *self)
|
||||||
{
|
{
|
||||||
XSizeHints size;
|
XSizeHints size;
|
||||||
long ret;
|
glong ret;
|
||||||
int oldgravity = self->gravity;
|
gint oldgravity = self->gravity;
|
||||||
|
|
||||||
/* defaults */
|
/* defaults */
|
||||||
self->min_ratio = 0.0f;
|
self->min_ratio = 0.0f;
|
||||||
|
@ -1116,9 +1116,11 @@ void client_update_normal_hints(ObClient *self)
|
||||||
|
|
||||||
if (size.flags & PAspect) {
|
if (size.flags & PAspect) {
|
||||||
if (size.min_aspect.y)
|
if (size.min_aspect.y)
|
||||||
self->min_ratio = (float)size.min_aspect.x / size.min_aspect.y;
|
self->min_ratio =
|
||||||
|
(gfloat) size.min_aspect.x / size.min_aspect.y;
|
||||||
if (size.max_aspect.y)
|
if (size.max_aspect.y)
|
||||||
self->max_ratio = (float)size.max_aspect.x / size.max_aspect.y;
|
self->max_ratio =
|
||||||
|
(gfloat) size.max_aspect.x / size.max_aspect.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size.flags & PMinSize)
|
if (size.flags & PMinSize)
|
||||||
|
@ -1266,7 +1268,7 @@ void client_setup_decor_and_functions(ObClient *self)
|
||||||
static void client_change_allowed_actions(ObClient *self)
|
static void client_change_allowed_actions(ObClient *self)
|
||||||
{
|
{
|
||||||
guint32 actions[9];
|
guint32 actions[9];
|
||||||
int num = 0;
|
gint num = 0;
|
||||||
|
|
||||||
/* desktop windows are kept on all desktops */
|
/* desktop windows are kept on all desktops */
|
||||||
if (self->type != OB_CLIENT_TYPE_DESKTOP)
|
if (self->type != OB_CLIENT_TYPE_DESKTOP)
|
||||||
|
@ -1447,7 +1449,7 @@ void client_update_title(ObClient *self)
|
||||||
}
|
}
|
||||||
/* dont display the number for the first window */
|
/* dont display the number for the first window */
|
||||||
if (self->title_count > 1) {
|
if (self->title_count > 1) {
|
||||||
char *ndata;
|
gchar *ndata;
|
||||||
ndata = g_strdup_printf("%s - [%u]", data, self->title_count);
|
ndata = g_strdup_printf("%s - [%u]", data, self->title_count);
|
||||||
g_free(data);
|
g_free(data);
|
||||||
data = ndata;
|
data = ndata;
|
||||||
|
@ -1477,7 +1479,7 @@ void client_update_title(ObClient *self)
|
||||||
|
|
||||||
/* append the title count, dont display the number for the first window */
|
/* append the title count, dont display the number for the first window */
|
||||||
if (read_title && self->title_count > 1) {
|
if (read_title && self->title_count > 1) {
|
||||||
char *vdata, *ndata;
|
gchar *vdata, *ndata;
|
||||||
ndata = g_strdup_printf(" - [%u]", self->title_count);
|
ndata = g_strdup_printf(" - [%u]", self->title_count);
|
||||||
vdata = g_strconcat(data, ndata, NULL);
|
vdata = g_strconcat(data, ndata, NULL);
|
||||||
g_free(ndata);
|
g_free(ndata);
|
||||||
|
@ -1492,8 +1494,8 @@ void client_update_title(ObClient *self)
|
||||||
|
|
||||||
void client_update_class(ObClient *self)
|
void client_update_class(ObClient *self)
|
||||||
{
|
{
|
||||||
char **data;
|
gchar **data;
|
||||||
char *s;
|
gchar *s;
|
||||||
|
|
||||||
if (self->name) g_free(self->name);
|
if (self->name) g_free(self->name);
|
||||||
if (self->class) g_free(self->class);
|
if (self->class) g_free(self->class);
|
||||||
|
@ -1893,7 +1895,7 @@ static void client_apply_startup_state(ObClient *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_configure_full(ObClient *self, ObCorner anchor,
|
void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
int x, int y, int w, int h,
|
gint x, gint y, gint w, gint h,
|
||||||
gboolean user, gboolean final,
|
gboolean user, gboolean final,
|
||||||
gboolean force_reply)
|
gboolean force_reply)
|
||||||
{
|
{
|
||||||
|
@ -1916,7 +1918,7 @@ void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
/* set the size and position if fullscreen */
|
/* set the size and position if fullscreen */
|
||||||
if (self->fullscreen) {
|
if (self->fullscreen) {
|
||||||
#ifdef VIDMODE
|
#ifdef VIDMODE
|
||||||
int dot;
|
gint dot;
|
||||||
XF86VidModeModeLine mode;
|
XF86VidModeModeLine mode;
|
||||||
#endif
|
#endif
|
||||||
Rect *a;
|
Rect *a;
|
||||||
|
@ -1978,7 +1980,7 @@ void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(w == self->area.width && h == self->area.height)) {
|
if (!(w == self->area.width && h == self->area.height)) {
|
||||||
int basew, baseh, minw, minh;
|
gint basew, baseh, minw, minh;
|
||||||
|
|
||||||
/* base size is substituted with min size if not specified */
|
/* base size is substituted with min size if not specified */
|
||||||
if (self->base_size.width || self->base_size.height) {
|
if (self->base_size.width || self->base_size.height) {
|
||||||
|
@ -2035,22 +2037,22 @@ void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
|
|
||||||
if (self->min_ratio)
|
if (self->min_ratio)
|
||||||
if (h * self->min_ratio > w) {
|
if (h * self->min_ratio > w) {
|
||||||
h = (int)(w / self->min_ratio);
|
h = (gint)(w / self->min_ratio);
|
||||||
|
|
||||||
/* you cannot resize to nothing */
|
/* you cannot resize to nothing */
|
||||||
if (h < 1) {
|
if (h < 1) {
|
||||||
h = 1;
|
h = 1;
|
||||||
w = (int)(h * self->min_ratio);
|
w = (gint)(h * self->min_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self->max_ratio)
|
if (self->max_ratio)
|
||||||
if (h * self->max_ratio < w) {
|
if (h * self->max_ratio < w) {
|
||||||
h = (int)(w / self->max_ratio);
|
h = (gint)(w / self->max_ratio);
|
||||||
|
|
||||||
/* you cannot resize to nothing */
|
/* you cannot resize to nothing */
|
||||||
if (h < 1) {
|
if (h < 1) {
|
||||||
h = 1;
|
h = 1;
|
||||||
w = (int)(h * self->min_ratio);
|
w = (gint)(h * self->min_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2134,7 +2136,7 @@ void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
|
|
||||||
void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea)
|
void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
gint x, y, w, h;
|
||||||
|
|
||||||
if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) || /* can't */
|
if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) || /* can't */
|
||||||
self->fullscreen == fs) return; /* already done */
|
self->fullscreen == fs) return; /* already done */
|
||||||
|
@ -2194,7 +2196,7 @@ static void client_iconify_recursive(ObClient *self,
|
||||||
|
|
||||||
if (iconic) {
|
if (iconic) {
|
||||||
if (self->functions & OB_CLIENT_FUNC_ICONIFY) {
|
if (self->functions & OB_CLIENT_FUNC_ICONIFY) {
|
||||||
long old;
|
glong old;
|
||||||
|
|
||||||
old = self->wmstate;
|
old = self->wmstate;
|
||||||
self->wmstate = IconicState;
|
self->wmstate = IconicState;
|
||||||
|
@ -2210,7 +2212,7 @@ static void client_iconify_recursive(ObClient *self,
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
long old;
|
glong old;
|
||||||
|
|
||||||
if (curdesk)
|
if (curdesk)
|
||||||
client_set_desktop(self, screen_desktop, FALSE);
|
client_set_desktop(self, screen_desktop, FALSE);
|
||||||
|
@ -2256,9 +2258,9 @@ void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk)
|
||||||
iconic, curdesk);
|
iconic, curdesk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_maximize(ObClient *self, gboolean max, int dir, gboolean savearea)
|
void client_maximize(ObClient *self, gboolean max, gint dir, gboolean savearea)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
gint x, y, w, h;
|
||||||
|
|
||||||
g_assert(dir == 0 || dir == 1 || dir == 2);
|
g_assert(dir == 0 || dir == 1 || dir == 2);
|
||||||
if (!(self->functions & OB_CLIENT_FUNC_MAXIMIZE)) return; /* can't */
|
if (!(self->functions & OB_CLIENT_FUNC_MAXIMIZE)) return; /* can't */
|
||||||
|
@ -2346,7 +2348,7 @@ void client_shade(ObClient *self, gboolean shade)
|
||||||
|
|
||||||
/* when we're iconic, don't change the wmstate */
|
/* when we're iconic, don't change the wmstate */
|
||||||
if (!self->iconic) {
|
if (!self->iconic) {
|
||||||
long old;
|
glong old;
|
||||||
|
|
||||||
old = self->wmstate;
|
old = self->wmstate;
|
||||||
self->wmstate = shade ? IconicState : NormalState;
|
self->wmstate = shade ? IconicState : NormalState;
|
||||||
|
@ -2473,7 +2475,7 @@ gboolean client_validate(ObClient *self)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_wm_state(ObClient *self, long state)
|
void client_set_wm_state(ObClient *self, glong state)
|
||||||
{
|
{
|
||||||
if (state == self->wmstate) return; /* no change */
|
if (state == self->wmstate) return; /* no change */
|
||||||
|
|
||||||
|
@ -2487,7 +2489,7 @@ void client_set_wm_state(ObClient *self, long state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
|
||||||
{
|
{
|
||||||
gboolean shaded = self->shaded;
|
gboolean shaded = self->shaded;
|
||||||
gboolean fullscreen = self->fullscreen;
|
gboolean fullscreen = self->fullscreen;
|
||||||
|
@ -2495,7 +2497,7 @@ void client_set_state(ObClient *self, Atom action, long data1, long data2)
|
||||||
gboolean max_horz = self->max_horz;
|
gboolean max_horz = self->max_horz;
|
||||||
gboolean max_vert = self->max_vert;
|
gboolean max_vert = self->max_vert;
|
||||||
gboolean modal = self->modal;
|
gboolean modal = self->modal;
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
if (!(action == prop_atoms.net_wm_state_add ||
|
if (!(action == prop_atoms.net_wm_state_add ||
|
||||||
action == prop_atoms.net_wm_state_remove ||
|
action == prop_atoms.net_wm_state_remove ||
|
||||||
|
@ -2714,7 +2716,7 @@ gboolean client_focus(ObClient *self)
|
||||||
#ifdef DEBUG_FOCUS
|
#ifdef DEBUG_FOCUS
|
||||||
ob_debug("%sively focusing %lx at %d\n",
|
ob_debug("%sively focusing %lx at %d\n",
|
||||||
(self->can_focus ? "act" : "pass"),
|
(self->can_focus ? "act" : "pass"),
|
||||||
self->window, (int) event_lasttime);
|
self->window, (gint) event_lasttime);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Cause the FocusIn to come back to us. Important for desktop switches,
|
/* Cause the FocusIn to come back to us. Important for desktop switches,
|
||||||
|
@ -2778,12 +2780,12 @@ gboolean client_focused(ObClient *self)
|
||||||
return self == focus_client;
|
return self == focus_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ObClientIcon* client_icon_recursive(ObClient *self, int w, int h)
|
static ObClientIcon* client_icon_recursive(ObClient *self, gint w, gint h)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
/* si is the smallest image >= req */
|
/* si is the smallest image >= req */
|
||||||
/* li is the largest image < req */
|
/* li is the largest image < req */
|
||||||
unsigned long size, smallest = 0xffffffff, largest = 0, si = 0, li = 0;
|
gulong size, smallest = 0xffffffff, largest = 0, si = 0, li = 0;
|
||||||
|
|
||||||
if (!self->nicons) {
|
if (!self->nicons) {
|
||||||
ObClientIcon *parent = NULL;
|
ObClientIcon *parent = NULL;
|
||||||
|
@ -2822,7 +2824,7 @@ static ObClientIcon* client_icon_recursive(ObClient *self, int w, int h)
|
||||||
return &self->icons[li];
|
return &self->icons[li];
|
||||||
}
|
}
|
||||||
|
|
||||||
const ObClientIcon* client_icon(ObClient *self, int w, int h)
|
const ObClientIcon* client_icon(ObClient *self, gint w, gint h)
|
||||||
{
|
{
|
||||||
ObClientIcon *ret;
|
ObClientIcon *ret;
|
||||||
static ObClientIcon deficon;
|
static ObClientIcon deficon;
|
||||||
|
@ -2838,10 +2840,10 @@ const ObClientIcon* client_icon(ObClient *self, int w, int h)
|
||||||
/* this be mostly ripped from fvwm */
|
/* this be mostly ripped from fvwm */
|
||||||
ObClient *client_find_directional(ObClient *c, ObDirection dir)
|
ObClient *client_find_directional(ObClient *c, ObDirection dir)
|
||||||
{
|
{
|
||||||
int my_cx, my_cy, his_cx, his_cy;
|
gint my_cx, my_cy, his_cx, his_cy;
|
||||||
int offset = 0;
|
gint offset = 0;
|
||||||
int distance = 0;
|
gint distance = 0;
|
||||||
int score, best_score;
|
gint score, best_score;
|
||||||
ObClient *best_client, *cur;
|
ObClient *best_client, *cur;
|
||||||
GList *it;
|
GList *it;
|
||||||
|
|
||||||
|
@ -2880,7 +2882,7 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir)
|
||||||
|
|
||||||
if(dir == OB_DIRECTION_NORTHEAST || dir == OB_DIRECTION_SOUTHEAST ||
|
if(dir == OB_DIRECTION_NORTHEAST || dir == OB_DIRECTION_SOUTHEAST ||
|
||||||
dir == OB_DIRECTION_SOUTHWEST || dir == OB_DIRECTION_NORTHWEST) {
|
dir == OB_DIRECTION_SOUTHWEST || dir == OB_DIRECTION_NORTHWEST) {
|
||||||
int tx;
|
gint tx;
|
||||||
/* Rotate the diagonals 45 degrees counterclockwise.
|
/* Rotate the diagonals 45 degrees counterclockwise.
|
||||||
* To do this, multiply the matrix /+h +h\ with the
|
* To do this, multiply the matrix /+h +h\ with the
|
||||||
* vector (x y). \-h +h/
|
* vector (x y). \-h +h/
|
||||||
|
@ -2933,7 +2935,7 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir)
|
||||||
return best_client;
|
return best_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_layer(ObClient *self, int layer)
|
void client_set_layer(ObClient *self, gint layer)
|
||||||
{
|
{
|
||||||
if (layer < 0) {
|
if (layer < 0) {
|
||||||
self->below = TRUE;
|
self->below = TRUE;
|
||||||
|
@ -3081,10 +3083,10 @@ void client_update_sm_client_id(ObClient *self)
|
||||||
* note to self: the edge is the -frame- edge (the actual one), not the
|
* note to self: the edge is the -frame- edge (the actual one), not the
|
||||||
* client edge.
|
* client edge.
|
||||||
*/
|
*/
|
||||||
int client_directional_edge_search(ObClient *c, ObDirection dir)
|
gint client_directional_edge_search(ObClient *c, ObDirection dir)
|
||||||
{
|
{
|
||||||
int dest;
|
gint dest;
|
||||||
int my_edge_start, my_edge_end, my_offset;
|
gint my_edge_start, my_edge_end, my_offset;
|
||||||
GList *it;
|
GList *it;
|
||||||
Rect *a;
|
Rect *a;
|
||||||
|
|
||||||
|
@ -3103,7 +3105,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir)
|
||||||
dest = a->y;
|
dest = a->y;
|
||||||
|
|
||||||
for(it = g_list_first(client_list); it; it = it->next) {
|
for(it = g_list_first(client_list); it; it = it->next) {
|
||||||
int his_edge_start, his_edge_end, his_offset;
|
gint his_edge_start, his_edge_end, his_offset;
|
||||||
ObClient *cur = it->data;
|
ObClient *cur = it->data;
|
||||||
|
|
||||||
if(cur == c)
|
if(cur == c)
|
||||||
|
@ -3144,7 +3146,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir)
|
||||||
dest = a->y + a->height;
|
dest = a->y + a->height;
|
||||||
|
|
||||||
for(it = g_list_first(client_list); it; it = it->next) {
|
for(it = g_list_first(client_list); it; it = it->next) {
|
||||||
int his_edge_start, his_edge_end, his_offset;
|
gint his_edge_start, his_edge_end, his_offset;
|
||||||
ObClient *cur = it->data;
|
ObClient *cur = it->data;
|
||||||
|
|
||||||
if(cur == c)
|
if(cur == c)
|
||||||
|
@ -3186,7 +3188,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir)
|
||||||
dest = a->x;
|
dest = a->x;
|
||||||
|
|
||||||
for(it = g_list_first(client_list); it; it = it->next) {
|
for(it = g_list_first(client_list); it; it = it->next) {
|
||||||
int his_edge_start, his_edge_end, his_offset;
|
gint his_edge_start, his_edge_end, his_offset;
|
||||||
ObClient *cur = it->data;
|
ObClient *cur = it->data;
|
||||||
|
|
||||||
if(cur == c)
|
if(cur == c)
|
||||||
|
@ -3228,7 +3230,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir)
|
||||||
dest = a->x + a->width;
|
dest = a->x + a->width;
|
||||||
|
|
||||||
for(it = g_list_first(client_list); it; it = it->next) {
|
for(it = g_list_first(client_list); it; it = it->next) {
|
||||||
int his_edge_start, his_edge_end, his_offset;
|
gint his_edge_start, his_edge_end, his_offset;
|
||||||
ObClient *cur = it->data;
|
ObClient *cur = it->data;
|
||||||
|
|
||||||
if(cur == c)
|
if(cur == c)
|
||||||
|
@ -3273,7 +3275,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir)
|
||||||
|
|
||||||
ObClient* client_under_pointer()
|
ObClient* client_under_pointer()
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
GList *it;
|
GList *it;
|
||||||
ObClient *ret = NULL;
|
ObClient *ret = NULL;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct _ObClient
|
||||||
struct _ObFrame *frame;
|
struct _ObFrame *frame;
|
||||||
|
|
||||||
/*! The number of unmap events to ignore on the window */
|
/*! The number of unmap events to ignore on the window */
|
||||||
int ignore_unmaps;
|
gint ignore_unmaps;
|
||||||
|
|
||||||
/*! The id of the group the window belongs to */
|
/*! The id of the group the window belongs to */
|
||||||
struct _ObGroup *group;
|
struct _ObGroup *group;
|
||||||
|
@ -165,11 +165,11 @@ struct _ObClient
|
||||||
/*! The minimum aspect ratio the client window can be sized to.
|
/*! The minimum aspect ratio the client window can be sized to.
|
||||||
A value of 0 means this is ignored.
|
A value of 0 means this is ignored.
|
||||||
*/
|
*/
|
||||||
float min_ratio;
|
gfloat min_ratio;
|
||||||
/*! The maximum aspect ratio the client window can be sized to.
|
/*! The maximum aspect ratio the client window can be sized to.
|
||||||
A value of 0 means this is ignored.
|
A value of 0 means this is ignored.
|
||||||
*/
|
*/
|
||||||
float max_ratio;
|
gfloat max_ratio;
|
||||||
|
|
||||||
/*! The minimum size of the client window
|
/*! The minimum size of the client window
|
||||||
If the min is > the max, then the window is not resizable
|
If the min is > the max, then the window is not resizable
|
||||||
|
@ -192,11 +192,11 @@ struct _ObClient
|
||||||
|
|
||||||
/*! Where to place the decorated window in relation to the undecorated
|
/*! Where to place the decorated window in relation to the undecorated
|
||||||
window */
|
window */
|
||||||
int gravity;
|
gint gravity;
|
||||||
|
|
||||||
/*! The state of the window, one of WithdrawnState, IconicState, or
|
/*! The state of the window, one of WithdrawnState, IconicState, or
|
||||||
NormalState */
|
NormalState */
|
||||||
long wmstate;
|
glong wmstate;
|
||||||
|
|
||||||
/*! True if the client supports the delete_window protocol */
|
/*! True if the client supports the delete_window protocol */
|
||||||
gboolean delete_window;
|
gboolean delete_window;
|
||||||
|
@ -333,7 +333,7 @@ gboolean client_focused(ObClient *self);
|
||||||
the position changed.
|
the position changed.
|
||||||
*/
|
*/
|
||||||
void client_configure_full(ObClient *self, ObCorner anchor,
|
void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
int x, int y, int w, int h,
|
gint x, gint y, gint w, gint h,
|
||||||
gboolean user, gboolean final,
|
gboolean user, gboolean final,
|
||||||
gboolean force_reply);
|
gboolean force_reply);
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ void client_reconfigure(ObClient *self);
|
||||||
struts if possible.
|
struts if possible.
|
||||||
@return true if the client was moved to be on-screen; false if not.
|
@return true if the client was moved to be on-screen; false if not.
|
||||||
*/
|
*/
|
||||||
gboolean client_find_onscreen(ObClient *self, int *x, int *y, int w, int h,
|
gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
|
||||||
gboolean rude);
|
gboolean rude);
|
||||||
|
|
||||||
/*! Moves a client so that it is on screen if it is entirely out of the
|
/*! Moves a client so that it is on screen if it is entirely out of the
|
||||||
|
@ -367,8 +367,8 @@ void client_move_onscreen(ObClient *self, gboolean rude);
|
||||||
be returned to normal state.
|
be returned to normal state.
|
||||||
@param savearea true to have the client's current size and position saved;
|
@param savearea true to have the client's current size and position saved;
|
||||||
otherwise, they are not. You should not save when mapping a
|
otherwise, they are not. You should not save when mapping a
|
||||||
new window that is set to fullscreen. This has no effect
|
new window that is set to fullscreen. This has no effect
|
||||||
when restoring a window from fullscreen.
|
when restoring a window from fullscreen.
|
||||||
*/
|
*/
|
||||||
void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea);
|
void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea);
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea);
|
||||||
restored.
|
restored.
|
||||||
@param curdesk If iconic is FALSE, then this determines if the window will
|
@param curdesk If iconic is FALSE, then this determines if the window will
|
||||||
be uniconified to the current viewable desktop (true) or to
|
be uniconified to the current viewable desktop (true) or to
|
||||||
its previous desktop (false)
|
its previous desktop (false)
|
||||||
*/
|
*/
|
||||||
void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk);
|
void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk);
|
||||||
|
|
||||||
|
@ -387,11 +387,11 @@ void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk);
|
||||||
@param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
|
@param dir 0 to set both horz and vert, 1 to set horz, 2 to set vert.
|
||||||
@param savearea true to have the client's current size and position saved;
|
@param savearea true to have the client's current size and position saved;
|
||||||
otherwise, they are not. You should not save when mapping a
|
otherwise, they are not. You should not save when mapping a
|
||||||
new window that is set to fullscreen. This has no effect
|
new window that is set to fullscreen. This has no effect
|
||||||
when unmaximizing a window.
|
when unmaximizing a window.
|
||||||
*/
|
*/
|
||||||
void client_maximize(ObClient *self, gboolean max, int dir,
|
void client_maximize(ObClient *self, gboolean max, gint dir,
|
||||||
gboolean savearea);
|
gboolean savearea);
|
||||||
|
|
||||||
/*! Shades or unshades the client window
|
/*! Shades or unshades the client window
|
||||||
@param shade true if the window should be shaded; false if it should be
|
@param shade true if the window should be shaded; false if it should be
|
||||||
|
@ -418,7 +418,7 @@ void client_set_desktop(ObClient *self, guint target, gboolean donthide);
|
||||||
gboolean client_validate(ObClient *self);
|
gboolean client_validate(ObClient *self);
|
||||||
|
|
||||||
/*! Sets the wm_state to the specified value */
|
/*! Sets the wm_state to the specified value */
|
||||||
void client_set_wm_state(ObClient *self, long state);
|
void client_set_wm_state(ObClient *self, glong state);
|
||||||
|
|
||||||
/*! Adjusts the window's net_state
|
/*! Adjusts the window's net_state
|
||||||
This should not be called as part of the window mapping process! It is for
|
This should not be called as part of the window mapping process! It is for
|
||||||
|
@ -426,7 +426,7 @@ void client_set_wm_state(ObClient *self, long state);
|
||||||
client_apply_startup_state is used to do the same things during the mapping
|
client_apply_startup_state is used to do the same things during the mapping
|
||||||
process.
|
process.
|
||||||
*/
|
*/
|
||||||
void client_set_state(ObClient *self, Atom action, long data1, long data2);
|
void client_set_state(ObClient *self, Atom action, glong data1, glong data2);
|
||||||
|
|
||||||
/* Given a ObClient, find the client that focus would actually be sent to if
|
/* Given a ObClient, find the client that focus would actually be sent to if
|
||||||
you wanted to give focus to the specified ObClient. Will return the same
|
you wanted to give focus to the specified ObClient. Will return the same
|
||||||
|
@ -505,7 +505,7 @@ void client_setup_decor_and_functions(ObClient *self);
|
||||||
/*! Retrieves the window's type and sets ObClient->type */
|
/*! Retrieves the window's type and sets ObClient->type */
|
||||||
void client_get_type(ObClient *self);
|
void client_get_type(ObClient *self);
|
||||||
|
|
||||||
const ObClientIcon *client_icon(ObClient *self, int w, int h);
|
const ObClientIcon *client_icon(ObClient *self, gint w, gint h);
|
||||||
|
|
||||||
/*! Searches a client's direct parents for a focused window. The function does
|
/*! Searches a client's direct parents for a focused window. The function does
|
||||||
not check for the passed client, only for *ONE LEVEL* of its parents.
|
not check for the passed client, only for *ONE LEVEL* of its parents.
|
||||||
|
@ -545,14 +545,14 @@ ObClient *client_search_transient(ObClient *self, ObClient *search);
|
||||||
ObClient *client_find_directional(ObClient *c, ObDirection dir);
|
ObClient *client_find_directional(ObClient *c, ObDirection dir);
|
||||||
|
|
||||||
/*! Return the closest edge in the given direction */
|
/*! Return the closest edge in the given direction */
|
||||||
int client_directional_edge_search(ObClient *c, ObDirection dir);
|
gint client_directional_edge_search(ObClient *c, ObDirection dir);
|
||||||
|
|
||||||
/*! Set a client window to be above/below other clients.
|
/*! Set a client window to be above/below other clients.
|
||||||
@layer < 0 indicates the client should be placed below other clients.<br>
|
@layer < 0 indicates the client should be placed below other clients.<br>
|
||||||
= 0 indicates the client should be placed with other clients.<br>
|
= 0 indicates the client should be placed with other clients.<br>
|
||||||
> 0 indicates the client should be placed above other clients.
|
> 0 indicates the client should be placed above other clients.
|
||||||
*/
|
*/
|
||||||
void client_set_layer(ObClient *self, int layer);
|
void client_set_layer(ObClient *self, gint layer);
|
||||||
|
|
||||||
/*! Set a client window to have decorations or not */
|
/*! Set a client window to have decorations or not */
|
||||||
void client_set_undecorated(ObClient *self, gboolean undecorated);
|
void client_set_undecorated(ObClient *self, gboolean undecorated);
|
||||||
|
|
|
@ -31,11 +31,11 @@ guint config_focus_raise;
|
||||||
|
|
||||||
ObPlacePolicy config_place_policy;
|
ObPlacePolicy config_place_policy;
|
||||||
|
|
||||||
char *config_theme;
|
gchar *config_theme;
|
||||||
|
|
||||||
gchar *config_title_layout;
|
gchar *config_title_layout;
|
||||||
|
|
||||||
int config_desktops_num;
|
gint config_desktops_num;
|
||||||
GSList *config_desktops_names;
|
GSList *config_desktops_names;
|
||||||
|
|
||||||
gboolean config_redraw_resize;
|
gboolean config_redraw_resize;
|
||||||
|
@ -75,7 +75,7 @@ gint config_resist_edge;
|
||||||
static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
||||||
GList *keylist)
|
GList *keylist)
|
||||||
{
|
{
|
||||||
char *key;
|
gchar *key;
|
||||||
ObAction *action;
|
ObAction *action;
|
||||||
xmlNodePtr n, nact;
|
xmlNodePtr n, nact;
|
||||||
GList *it;
|
GList *it;
|
||||||
|
@ -133,8 +133,8 @@ static void parse_mouse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
||||||
void *d)
|
void *d)
|
||||||
{
|
{
|
||||||
xmlNodePtr n, nbut, nact;
|
xmlNodePtr n, nbut, nact;
|
||||||
char *buttonstr;
|
gchar *buttonstr;
|
||||||
char *contextstr;
|
gchar *contextstr;
|
||||||
ObUserAction uact;
|
ObUserAction uact;
|
||||||
ObMouseAction mact;
|
ObMouseAction mact;
|
||||||
ObAction *action;
|
ObAction *action;
|
||||||
|
|
|
@ -67,13 +67,13 @@ extern guint config_dock_app_move_button;
|
||||||
extern guint config_dock_app_move_modifiers;
|
extern guint config_dock_app_move_modifiers;
|
||||||
|
|
||||||
/* The name of the theme */
|
/* The name of the theme */
|
||||||
extern char *config_theme;
|
extern gchar *config_theme;
|
||||||
|
|
||||||
/* Titlebar button layout */
|
/* Titlebar button layout */
|
||||||
extern gchar *config_title_layout;
|
extern gchar *config_title_layout;
|
||||||
|
|
||||||
/*! The number of desktops */
|
/*! The number of desktops */
|
||||||
extern int config_desktops_num;
|
extern gint config_desktops_num;
|
||||||
/*! Names for the desktops */
|
/*! Names for the desktops */
|
||||||
extern GSList *config_desktops_names;
|
extern GSList *config_desktops_names;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ void ob_debug_show_output(gboolean enable)
|
||||||
show = enable;
|
show = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ob_debug(char *a, ...)
|
void ob_debug(gchar *a, ...)
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@
|
||||||
|
|
||||||
void ob_debug_show_output(gboolean enable);
|
void ob_debug_show_output(gboolean enable);
|
||||||
|
|
||||||
void ob_debug(char *a, ...);
|
void ob_debug(gchar *a, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,17 +73,17 @@ static gboolean menu_hide_delay_func(gpointer data);
|
||||||
Time event_lasttime = 0;
|
Time event_lasttime = 0;
|
||||||
|
|
||||||
/*! The value of the mask for the NumLock modifier */
|
/*! The value of the mask for the NumLock modifier */
|
||||||
unsigned int NumLockMask;
|
guint NumLockMask;
|
||||||
/*! The value of the mask for the ScrollLock modifier */
|
/*! The value of the mask for the ScrollLock modifier */
|
||||||
unsigned int ScrollLockMask;
|
guint ScrollLockMask;
|
||||||
/*! The key codes for the modifier keys */
|
/*! The key codes for the modifier keys */
|
||||||
static XModifierKeymap *modmap;
|
static XModifierKeymap *modmap;
|
||||||
/*! Table of the constant modifier masks */
|
/*! Table of the constant modifier masks */
|
||||||
static const int mask_table[] = {
|
static const gint mask_table[] = {
|
||||||
ShiftMask, LockMask, ControlMask, Mod1Mask,
|
ShiftMask, LockMask, ControlMask, Mod1Mask,
|
||||||
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
||||||
};
|
};
|
||||||
static int mask_table_size;
|
static gint mask_table_size;
|
||||||
|
|
||||||
static guint ignore_enter_focus = 0;
|
static guint ignore_enter_focus = 0;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ static gboolean menu_can_hide;
|
||||||
static ObClient *focus_in, *focus_out;
|
static ObClient *focus_in, *focus_out;
|
||||||
|
|
||||||
#ifdef USE_SM
|
#ifdef USE_SM
|
||||||
static void ice_handler(int fd, gpointer conn)
|
static void ice_handler(gint fd, gpointer conn)
|
||||||
{
|
{
|
||||||
Bool b;
|
Bool b;
|
||||||
IceProcessMessages(conn, NULL, &b);
|
IceProcessMessages(conn, NULL, &b);
|
||||||
|
@ -249,7 +249,7 @@ static void event_set_lasttime(XEvent *e)
|
||||||
static void event_hack_mods(XEvent *e)
|
static void event_hack_mods(XEvent *e)
|
||||||
{
|
{
|
||||||
KeyCode *kp;
|
KeyCode *kp;
|
||||||
int i, k;
|
gint i, k;
|
||||||
|
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
|
@ -360,7 +360,7 @@ static void event_done(gpointer data)
|
||||||
if (focus_client != last) {
|
if (focus_client != last) {
|
||||||
if (!focus_client) {
|
if (!focus_client) {
|
||||||
Window w;
|
Window w;
|
||||||
int r;
|
gint r;
|
||||||
|
|
||||||
/* is focus anywhere valid? */
|
/* is focus anywhere valid? */
|
||||||
XGetInputFocus(ob_display, &w, &r);
|
XGetInputFocus(ob_display, &w, &r);
|
||||||
|
@ -498,11 +498,11 @@ static void event_handle_root(XEvent *e)
|
||||||
|
|
||||||
msgtype = e->xclient.message_type;
|
msgtype = e->xclient.message_type;
|
||||||
if (msgtype == prop_atoms.net_current_desktop) {
|
if (msgtype == prop_atoms.net_current_desktop) {
|
||||||
unsigned int d = e->xclient.data.l[0];
|
guint d = e->xclient.data.l[0];
|
||||||
if (d < screen_num_desktops)
|
if (d < screen_num_desktops)
|
||||||
screen_set_desktop(d);
|
screen_set_desktop(d);
|
||||||
} else if (msgtype == prop_atoms.net_number_of_desktops) {
|
} else if (msgtype == prop_atoms.net_number_of_desktops) {
|
||||||
unsigned int d = e->xclient.data.l[0];
|
guint d = e->xclient.data.l[0];
|
||||||
if (d > 0)
|
if (d > 0)
|
||||||
screen_set_num_desktops(d);
|
screen_set_num_desktops(d);
|
||||||
} else if (msgtype == prop_atoms.net_showing_desktop) {
|
} else if (msgtype == prop_atoms.net_showing_desktop) {
|
||||||
|
@ -561,7 +561,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
{
|
{
|
||||||
XEvent ce;
|
XEvent ce;
|
||||||
Atom msgtype;
|
Atom msgtype;
|
||||||
int i=0;
|
gint i=0;
|
||||||
ObFrameContext con;
|
ObFrameContext con;
|
||||||
|
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
|
@ -746,7 +746,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight |
|
if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight |
|
||||||
CWX | CWY |
|
CWX | CWY |
|
||||||
CWBorderWidth)) {
|
CWBorderWidth)) {
|
||||||
int x, y, w, h;
|
gint x, y, w, h;
|
||||||
ObCorner corner;
|
ObCorner corner;
|
||||||
|
|
||||||
if (e->xconfigurerequest.value_mask & CWBorderWidth)
|
if (e->xconfigurerequest.value_mask & CWBorderWidth)
|
||||||
|
@ -762,12 +762,12 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
e->xconfigurerequest.height : client->area.height;
|
e->xconfigurerequest.height : client->area.height;
|
||||||
|
|
||||||
{
|
{
|
||||||
int newx = x;
|
gint newx = x;
|
||||||
int newy = y;
|
gint newy = y;
|
||||||
int fw = w +
|
gint fw = w +
|
||||||
client->frame->size.left + client->frame->size.right;
|
client->frame->size.left + client->frame->size.right;
|
||||||
int fh = h +
|
gint fh = h +
|
||||||
client->frame->size.top + client->frame->size.bottom;
|
client->frame->size.top + client->frame->size.bottom;
|
||||||
client_find_onscreen(client, &newx, &newy, fw, fh,
|
client_find_onscreen(client, &newx, &newy, fw, fh,
|
||||||
client_normal(client));
|
client_normal(client));
|
||||||
if (e->xconfigurerequest.value_mask & CWX)
|
if (e->xconfigurerequest.value_mask & CWX)
|
||||||
|
@ -930,8 +930,8 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
e->xclient.data.l[2]);
|
e->xclient.data.l[2]);
|
||||||
}
|
}
|
||||||
} else if (msgtype == prop_atoms.net_moveresize_window) {
|
} else if (msgtype == prop_atoms.net_moveresize_window) {
|
||||||
int oldg = client->gravity;
|
gint oldg = client->gravity;
|
||||||
int tmpg, x, y, w, h;
|
gint tmpg, x, y, w, h;
|
||||||
|
|
||||||
if (e->xclient.data.l[0] & 0xff)
|
if (e->xclient.data.l[0] & 0xff)
|
||||||
tmpg = e->xclient.data.l[0] & 0xff;
|
tmpg = e->xclient.data.l[0] & 0xff;
|
||||||
|
@ -957,12 +957,12 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
client->gravity = tmpg;
|
client->gravity = tmpg;
|
||||||
|
|
||||||
{
|
{
|
||||||
int newx = x;
|
gint newx = x;
|
||||||
int newy = y;
|
gint newy = y;
|
||||||
int fw = w +
|
gint fw = w +
|
||||||
client->frame->size.left + client->frame->size.right;
|
client->frame->size.left + client->frame->size.right;
|
||||||
int fh = h +
|
gint fh = h +
|
||||||
client->frame->size.top + client->frame->size.bottom;
|
client->frame->size.top + client->frame->size.bottom;
|
||||||
client_find_onscreen(client, &newx, &newy, fw, fh,
|
client_find_onscreen(client, &newx, &newy, fw, fh,
|
||||||
client_normal(client));
|
client_normal(client));
|
||||||
if (e->xclient.data.l[0] & 1 << 8)
|
if (e->xclient.data.l[0] & 1 << 8)
|
||||||
|
|
|
@ -22,19 +22,19 @@ See the COPYING file for a copy of the GNU General Public License.
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
gboolean extensions_xkb = FALSE;
|
gboolean extensions_xkb = FALSE;
|
||||||
int extensions_xkb_event_basep;
|
gint extensions_xkb_event_basep;
|
||||||
gboolean extensions_shape = FALSE;
|
gboolean extensions_shape = FALSE;
|
||||||
int extensions_shape_event_basep;
|
gint extensions_shape_event_basep;
|
||||||
gboolean extensions_xinerama = FALSE;
|
gboolean extensions_xinerama = FALSE;
|
||||||
int extensions_xinerama_event_basep;
|
gint extensions_xinerama_event_basep;
|
||||||
gboolean extensions_randr = FALSE;
|
gboolean extensions_randr = FALSE;
|
||||||
int extensions_randr_event_basep;
|
gint extensions_randr_event_basep;
|
||||||
gboolean extensions_vidmode = FALSE;
|
gboolean extensions_vidmode = FALSE;
|
||||||
int extensions_vidmode_event_basep;
|
gint extensions_vidmode_event_basep;
|
||||||
|
|
||||||
void extensions_query_all()
|
void extensions_query_all()
|
||||||
{
|
{
|
||||||
int junk;
|
gint junk;
|
||||||
(void)junk;
|
(void)junk;
|
||||||
|
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
|
|
|
@ -44,27 +44,27 @@
|
||||||
/*! Does the display have the XKB extension? */
|
/*! Does the display have the XKB extension? */
|
||||||
extern gboolean extensions_xkb;
|
extern gboolean extensions_xkb;
|
||||||
/*! Base for events for the XKB extension */
|
/*! Base for events for the XKB extension */
|
||||||
extern int extensions_xkb_event_basep;
|
extern gint extensions_xkb_event_basep;
|
||||||
|
|
||||||
/*! Does the display have the Shape extension? */
|
/*! Does the display have the Shape extension? */
|
||||||
extern gboolean extensions_shape;
|
extern gboolean extensions_shape;
|
||||||
/*! Base for events for the Shape extension */
|
/*! Base for events for the Shape extension */
|
||||||
extern int extensions_shape_event_basep;
|
extern gint extensions_shape_event_basep;
|
||||||
|
|
||||||
/*! Does the display have the Xinerama extension? */
|
/*! Does the display have the Xinerama extension? */
|
||||||
extern gboolean extensions_xinerama;
|
extern gboolean extensions_xinerama;
|
||||||
/*! Base for events for the Xinerama extension */
|
/*! Base for events for the Xinerama extension */
|
||||||
extern int extensions_xinerama_event_basep;
|
extern gint extensions_xinerama_event_basep;
|
||||||
|
|
||||||
/*! Does the display have the RandR extension? */
|
/*! Does the display have the RandR extension? */
|
||||||
extern gboolean extensions_randr;
|
extern gboolean extensions_randr;
|
||||||
/*! Base for events for the Randr extension */
|
/*! Base for events for the Randr extension */
|
||||||
extern int extensions_randr_event_basep;
|
extern gint extensions_randr_event_basep;
|
||||||
|
|
||||||
/*! Does the display have the VidMode extension? */
|
/*! Does the display have the VidMode extension? */
|
||||||
extern gboolean extensions_vidmode;
|
extern gboolean extensions_vidmode;
|
||||||
/*! Base for events for the VidMode extension */
|
/*! Base for events for the VidMode extension */
|
||||||
extern int extensions_vidmode_event_basep;
|
extern gint extensions_vidmode_event_basep;
|
||||||
|
|
||||||
void extensions_query_all();
|
void extensions_query_all();
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ static void focus_cycle_destructor(ObClient *client, gpointer data)
|
||||||
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE);
|
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Window createWindow(Window parent, unsigned long mask,
|
static Window createWindow(Window parent, gulong mask,
|
||||||
XSetWindowAttributes *attrib)
|
XSetWindowAttributes *attrib)
|
||||||
{
|
{
|
||||||
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
||||||
|
@ -210,7 +210,8 @@ void focus_set_client(ObClient *client)
|
||||||
|
|
||||||
/* finds the first transient that isn't 'skip' and ensure's that client_normal
|
/* finds the first transient that isn't 'skip' and ensure's that client_normal
|
||||||
is true for it */
|
is true for it */
|
||||||
static ObClient *find_transient_recursive(ObClient *c, ObClient *top, ObClient *skip)
|
static ObClient *find_transient_recursive(ObClient *c, ObClient *top,
|
||||||
|
ObClient *skip)
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
ObClient *ret;
|
ObClient *ret;
|
||||||
|
@ -332,7 +333,7 @@ static void popup_cycle(ObClient *c, gboolean show)
|
||||||
} else {
|
} else {
|
||||||
Rect *a;
|
Rect *a;
|
||||||
ObClient *p = c;
|
ObClient *p = c;
|
||||||
char *title;
|
gchar *title;
|
||||||
|
|
||||||
a = screen_physical_area_monitor(0);
|
a = screen_physical_area_monitor(0);
|
||||||
icon_popup_position(focus_cycle_popup, CenterGravity,
|
icon_popup_position(focus_cycle_popup, CenterGravity,
|
||||||
|
@ -378,8 +379,8 @@ void focus_cycle_draw_indicator()
|
||||||
frame_adjust_focus(focus_cycle_target->frame, FALSE);
|
frame_adjust_focus(focus_cycle_target->frame, FALSE);
|
||||||
frame_adjust_focus(focus_cycle_target->frame, TRUE);
|
frame_adjust_focus(focus_cycle_target->frame, TRUE);
|
||||||
*/
|
*/
|
||||||
int x, y, w, h;
|
gint x, y, w, h;
|
||||||
int wt, wl, wr, wb;
|
gint wt, wl, wr, wb;
|
||||||
|
|
||||||
wt = wl = wr = wb = MAX(3,
|
wt = wl = wr = wb = MAX(3,
|
||||||
ob_rr_theme->handle_height +
|
ob_rr_theme->handle_height +
|
||||||
|
|
|
@ -46,7 +46,7 @@ static gboolean flash_timeout(gpointer data);
|
||||||
static void set_theme_statics(ObFrame *self);
|
static void set_theme_statics(ObFrame *self);
|
||||||
static void free_theme_statics(ObFrame *self);
|
static void free_theme_statics(ObFrame *self);
|
||||||
|
|
||||||
static Window createWindow(Window parent, unsigned long mask,
|
static Window createWindow(Window parent, gulong mask,
|
||||||
XSetWindowAttributes *attrib)
|
XSetWindowAttributes *attrib)
|
||||||
{
|
{
|
||||||
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
||||||
|
@ -58,7 +58,7 @@ static Window createWindow(Window parent, unsigned long mask,
|
||||||
ObFrame *frame_new()
|
ObFrame *frame_new()
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attrib;
|
XSetWindowAttributes attrib;
|
||||||
unsigned long mask;
|
gulong mask;
|
||||||
ObFrame *self;
|
ObFrame *self;
|
||||||
|
|
||||||
self = g_new0(ObFrame, 1);
|
self = g_new0(ObFrame, 1);
|
||||||
|
@ -215,7 +215,7 @@ void frame_adjust_theme(ObFrame *self)
|
||||||
void frame_adjust_shape(ObFrame *self)
|
void frame_adjust_shape(ObFrame *self)
|
||||||
{
|
{
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
int num;
|
gint num;
|
||||||
XRectangle xrect[2];
|
XRectangle xrect[2];
|
||||||
|
|
||||||
if (!self->client->shaped) {
|
if (!self->client->shaped) {
|
||||||
|
@ -552,8 +552,8 @@ void frame_release_client(ObFrame *self, ObClient *client)
|
||||||
|
|
||||||
static void layout_title(ObFrame *self)
|
static void layout_title(ObFrame *self)
|
||||||
{
|
{
|
||||||
char *lc;
|
gchar *lc;
|
||||||
int x;
|
gint x;
|
||||||
gboolean n, d, i, l, m, c, s;
|
gboolean n, d, i, l, m, c, s;
|
||||||
|
|
||||||
n = d = i = l = m = c = s = FALSE;
|
n = d = i = l = m = c = s = FALSE;
|
||||||
|
@ -755,7 +755,7 @@ ObFrameContext frame_context(ObClient *client, Window win)
|
||||||
return OB_FRAME_CONTEXT_NONE;
|
return OB_FRAME_CONTEXT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_client_gravity(ObFrame *self, int *x, int *y)
|
void frame_client_gravity(ObFrame *self, gint *x, gint *y)
|
||||||
{
|
{
|
||||||
/* horizontal */
|
/* horizontal */
|
||||||
switch (self->client->gravity) {
|
switch (self->client->gravity) {
|
||||||
|
@ -810,7 +810,7 @@ void frame_client_gravity(ObFrame *self, int *x, int *y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_frame_gravity(ObFrame *self, int *x, int *y)
|
void frame_frame_gravity(ObFrame *self, gint *x, gint *y)
|
||||||
{
|
{
|
||||||
/* horizontal */
|
/* horizontal */
|
||||||
switch (self->client->gravity) {
|
switch (self->client->gravity) {
|
||||||
|
|
|
@ -163,13 +163,13 @@ ObFrameContext frame_context(struct _ObClient *self, Window win);
|
||||||
be positioned.
|
be positioned.
|
||||||
@return The proper coordinates for the frame, based on the client.
|
@return The proper coordinates for the frame, based on the client.
|
||||||
*/
|
*/
|
||||||
void frame_client_gravity(ObFrame *self, int *x, int *y);
|
void frame_client_gravity(ObFrame *self, gint *x, gint *y);
|
||||||
|
|
||||||
/*! Reversly applies gravity to the frame's position to find where the client
|
/*! Reversly applies gravity to the frame's position to find where the client
|
||||||
should be positioned.
|
should be positioned.
|
||||||
@return The proper coordinates for the client, based on the frame.
|
@return The proper coordinates for the client, based on the frame.
|
||||||
*/
|
*/
|
||||||
void frame_frame_gravity(ObFrame *self, int *x, int *y);
|
void frame_frame_gravity(ObFrame *self, gint *x, gint *y);
|
||||||
|
|
||||||
void frame_flash_start(ObFrame *self);
|
void frame_flash_start(ObFrame *self);
|
||||||
void frame_flash_stop(ObFrame *self);
|
void frame_flash_stop(ObFrame *self);
|
||||||
|
|
|
@ -34,7 +34,7 @@ static void framerender_close(ObFrame *self, RrAppearance *a);
|
||||||
void framerender_frame(ObFrame *self)
|
void framerender_frame(ObFrame *self)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
unsigned long px;
|
gulong px;
|
||||||
|
|
||||||
px = (self->focused ?
|
px = (self->focused ?
|
||||||
RrColorPixel(ob_rr_theme->cb_focused_color) :
|
RrColorPixel(ob_rr_theme->cb_focused_color) :
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define MASK_LIST_SIZE 8
|
#define MASK_LIST_SIZE 8
|
||||||
|
|
||||||
/*! A list of all possible combinations of keyboard lock masks */
|
/*! A list of all possible combinations of keyboard lock masks */
|
||||||
static unsigned int mask_list[MASK_LIST_SIZE];
|
static guint mask_list[MASK_LIST_SIZE];
|
||||||
static guint kgrabs = 0;
|
static guint kgrabs = 0;
|
||||||
static guint pgrabs = 0;
|
static guint pgrabs = 0;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void grab_shutdown(gboolean reconfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
void grab_button_full(guint button, guint state, Window win, guint mask,
|
void grab_button_full(guint button, guint state, Window win, guint mask,
|
||||||
int pointer_mode, ObCursor cur)
|
gint pointer_mode, ObCursor cur)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ void ungrab_button(guint button, guint state, Window win)
|
||||||
XUngrabButton(ob_display, button, state | mask_list[i], win);
|
XUngrabButton(ob_display, button, state | mask_list[i], win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void grab_key(guint keycode, guint state, Window win, int keyboard_mode)
|
void grab_key(guint keycode, guint state, Window win, gint keyboard_mode)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,10 @@ gboolean grab_on_pointer();
|
||||||
|
|
||||||
void grab_button(guint button, guint state, Window win, guint mask);
|
void grab_button(guint button, guint state, Window win, guint mask);
|
||||||
void grab_button_full(guint button, guint state, Window win, guint mask,
|
void grab_button_full(guint button, guint state, Window win, guint mask,
|
||||||
int pointer_mode, ObCursor cursor);
|
gint pointer_mode, ObCursor cursor);
|
||||||
void ungrab_button(guint button, guint state, Window win);
|
void ungrab_button(guint button, guint state, Window win);
|
||||||
|
|
||||||
void grab_key(guint keycode, guint state, Window win, int keyboard_mode);
|
void grab_key(guint keycode, guint state, Window win, gint keyboard_mode);
|
||||||
|
|
||||||
void ungrab_all_keys(Window win);
|
void ungrab_all_keys(Window win);
|
||||||
|
|
||||||
|
|
|
@ -565,9 +565,9 @@ void ob_main_loop_fd_remove(ObMainLoop *loop,
|
||||||
#define NEAREST_TIMEOUT(loop) \
|
#define NEAREST_TIMEOUT(loop) \
|
||||||
(((ObMainLoopTimer*)(loop)->timers->data)->timeout)
|
(((ObMainLoopTimer*)(loop)->timers->data)->timeout)
|
||||||
|
|
||||||
static long timecompare(GTimeVal *a, GTimeVal *b)
|
static glong timecompare(GTimeVal *a, GTimeVal *b)
|
||||||
{
|
{
|
||||||
long r;
|
glong r;
|
||||||
|
|
||||||
if ((r = b->tv_sec - a->tv_sec)) return r;
|
if ((r = b->tv_sec - a->tv_sec)) return r;
|
||||||
return b->tv_usec - a->tv_usec;
|
return b->tv_usec - a->tv_usec;
|
||||||
|
|
|
@ -42,7 +42,7 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self);
|
||||||
static void menu_frame_render(ObMenuFrame *self);
|
static void menu_frame_render(ObMenuFrame *self);
|
||||||
static void menu_frame_update(ObMenuFrame *self);
|
static void menu_frame_update(ObMenuFrame *self);
|
||||||
|
|
||||||
static Window createWindow(Window parent, unsigned long mask,
|
static Window createWindow(Window parent, gulong mask,
|
||||||
XSetWindowAttributes *attrib)
|
XSetWindowAttributes *attrib)
|
||||||
{
|
{
|
||||||
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
|
||||||
|
|
|
@ -89,7 +89,7 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
|
||||||
|
|
||||||
void mouse_grab_for_client(ObClient *client, gboolean grab)
|
void mouse_grab_for_client(ObClient *client, gboolean grab)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
|
||||||
for (i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i)
|
for (i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i)
|
||||||
|
@ -97,8 +97,8 @@ void mouse_grab_for_client(ObClient *client, gboolean grab)
|
||||||
/* grab/ungrab the button */
|
/* grab/ungrab the button */
|
||||||
ObMouseBinding *b = it->data;
|
ObMouseBinding *b = it->data;
|
||||||
Window win;
|
Window win;
|
||||||
int mode;
|
gint mode;
|
||||||
unsigned int mask;
|
guint mask;
|
||||||
|
|
||||||
if (FRAME_CONTEXT(i, client)) {
|
if (FRAME_CONTEXT(i, client)) {
|
||||||
win = client->frame->window;
|
win = client->frame->window;
|
||||||
|
@ -130,13 +130,13 @@ static void grab_all_clients(gboolean grab)
|
||||||
|
|
||||||
void mouse_unbind_all()
|
void mouse_unbind_all()
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
|
||||||
for(i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) {
|
for(i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) {
|
||||||
for (it = bound_contexts[i]; it != NULL; it = it->next) {
|
for (it = bound_contexts[i]; it != NULL; it = it->next) {
|
||||||
ObMouseBinding *b = it->data;
|
ObMouseBinding *b = it->data;
|
||||||
int j;
|
gint j;
|
||||||
|
|
||||||
for (j = 0; j < OB_NUM_MOUSE_ACTIONS; ++j) {
|
for (j = 0; j < OB_NUM_MOUSE_ACTIONS; ++j) {
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
@ -154,7 +154,7 @@ void mouse_unbind_all()
|
||||||
|
|
||||||
static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
|
static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
|
||||||
ObClient *c, guint state,
|
ObClient *c, guint state,
|
||||||
guint button, int x, int y)
|
guint button, gint x, gint y)
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
ObMouseBinding *b;
|
ObMouseBinding *b;
|
||||||
|
@ -176,7 +176,7 @@ void mouse_event(ObClient *client, XEvent *e)
|
||||||
static Time ltime;
|
static Time ltime;
|
||||||
static guint button = 0, state = 0, lbutton = 0;
|
static guint button = 0, state = 0, lbutton = 0;
|
||||||
static Window lwindow = None;
|
static Window lwindow = None;
|
||||||
static int px, py;
|
static gint px, py;
|
||||||
|
|
||||||
ObFrameContext context;
|
ObFrameContext context;
|
||||||
gboolean click = FALSE;
|
gboolean click = FALSE;
|
||||||
|
@ -210,7 +210,7 @@ void mouse_event(ObClient *client, XEvent *e)
|
||||||
|
|
||||||
if (e->xbutton.button == button) {
|
if (e->xbutton.button == button) {
|
||||||
/* clicks are only valid if its released over the window */
|
/* clicks are only valid if its released over the window */
|
||||||
int junk1, junk2;
|
gint junk1, junk2;
|
||||||
Window wjunk;
|
Window wjunk;
|
||||||
guint ujunk, b, w, h;
|
guint ujunk, b, w, h;
|
||||||
/* this can cause errors to occur when the window closes */
|
/* this can cause errors to occur when the window closes */
|
||||||
|
|
|
@ -38,8 +38,8 @@ ObClient *moveresize_client = NULL;
|
||||||
|
|
||||||
static gboolean moving = FALSE; /* TRUE - moving, FALSE - resizing */
|
static gboolean moving = FALSE; /* TRUE - moving, FALSE - resizing */
|
||||||
|
|
||||||
static int start_x, start_y, start_cx, start_cy, start_cw, start_ch;
|
static gint start_x, start_y, start_cx, start_cy, start_cw, start_ch;
|
||||||
static int cur_x, cur_y;
|
static gint cur_x, cur_y;
|
||||||
static guint button;
|
static guint button;
|
||||||
static guint32 corner;
|
static guint32 corner;
|
||||||
static ObCorner lockcorner;
|
static ObCorner lockcorner;
|
||||||
|
@ -72,9 +72,9 @@ void moveresize_shutdown(gboolean reconfig)
|
||||||
popup = NULL;
|
popup = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void popup_coords(ObClient *c, char *format, int a, int b)
|
static void popup_coords(ObClient *c, gchar *format, gint a, gint b)
|
||||||
{
|
{
|
||||||
char *text;
|
gchar *text;
|
||||||
|
|
||||||
text = g_strdup_printf(format, a, b);
|
text = g_strdup_printf(format, a, b);
|
||||||
popup_position(popup, CenterGravity,
|
popup_position(popup, CenterGravity,
|
||||||
|
@ -86,7 +86,7 @@ static void popup_coords(ObClient *c, char *format, int a, int b)
|
||||||
g_free(text);
|
g_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveresize_start(ObClient *c, int x, int y, guint b, guint32 cnr)
|
void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr)
|
||||||
{
|
{
|
||||||
ObCursor cur;
|
ObCursor cur;
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ void moveresize_event(XEvent *e)
|
||||||
moveresize_end(FALSE);
|
moveresize_end(FALSE);
|
||||||
else {
|
else {
|
||||||
if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
|
if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
|
||||||
int dx = 0, dy = 0, ox = cur_x, oy = cur_y;
|
gint dx = 0, dy = 0, ox = cur_x, oy = cur_y;
|
||||||
|
|
||||||
if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
|
if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
|
||||||
dx = MAX(4, moveresize_client->size_inc.width);
|
dx = MAX(4, moveresize_client->size_inc.width);
|
||||||
|
@ -329,8 +329,8 @@ void moveresize_event(XEvent *e)
|
||||||
start_x += dx - (cur_x - ox);
|
start_x += dx - (cur_x - ox);
|
||||||
start_y += dy - (cur_y - oy);
|
start_y += dy - (cur_y - oy);
|
||||||
} else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
|
} else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
|
||||||
int dx = 0, dy = 0, ox = cur_x, oy = cur_y;
|
gint dx = 0, dy = 0, ox = cur_x, oy = cur_y;
|
||||||
int opx, px, opy, py;
|
gint opx, px, opy, py;
|
||||||
|
|
||||||
if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
|
if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
|
||||||
dx = 4;
|
dx = 4;
|
||||||
|
|
|
@ -30,7 +30,7 @@ void moveresize_startup(gboolean reconfig);
|
||||||
void moveresize_shutdown(gboolean reconfig);
|
void moveresize_shutdown(gboolean reconfig);
|
||||||
|
|
||||||
void moveresize_start(struct _ObClient *c,
|
void moveresize_start(struct _ObClient *c,
|
||||||
int x, int y, guint button, guint32 corner);
|
gint x, gint y, guint button, guint32 corner);
|
||||||
void moveresize_end(gboolean cancel);
|
void moveresize_end(gboolean cancel);
|
||||||
|
|
||||||
void moveresize_event(XEvent *e);
|
void moveresize_event(XEvent *e);
|
||||||
|
|
|
@ -76,15 +76,15 @@ static ObState state;
|
||||||
static gboolean xsync;
|
static gboolean xsync;
|
||||||
static gboolean reconfigure;
|
static gboolean reconfigure;
|
||||||
static gboolean restart;
|
static gboolean restart;
|
||||||
static char *restart_path;
|
static gchar *restart_path;
|
||||||
static Cursor cursors[OB_NUM_CURSORS];
|
static Cursor cursors[OB_NUM_CURSORS];
|
||||||
static KeyCode keys[OB_NUM_KEYS];
|
static KeyCode keys[OB_NUM_KEYS];
|
||||||
static gint exitcode = 0;
|
static gint exitcode = 0;
|
||||||
|
|
||||||
static void signal_handler(int signal, gpointer data);
|
static void signal_handler(gint signal, gpointer data);
|
||||||
static void parse_args(int argc, char **argv);
|
static void parse_args(gint argc, gchar **argv);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
gint main(gint argc, gchar **argv)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ob_debug_show_output(TRUE);
|
ob_debug_show_output(TRUE);
|
||||||
|
@ -300,8 +300,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (restart) {
|
if (restart) {
|
||||||
if (restart_path != NULL) {
|
if (restart_path != NULL) {
|
||||||
int argcp;
|
gint argcp;
|
||||||
char **argvp;
|
gchar **argvp;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
|
|
||||||
/* run other shit */
|
/* run other shit */
|
||||||
|
@ -322,7 +322,7 @@ int main(int argc, char **argv)
|
||||||
return exitcode;
|
return exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signal_handler(int signal, gpointer data)
|
static void signal_handler(gint signal, gpointer data)
|
||||||
{
|
{
|
||||||
if (signal == SIGUSR1) {
|
if (signal == SIGUSR1) {
|
||||||
ob_debug("Caught signal %d. Restarting.\n", signal);
|
ob_debug("Caught signal %d. Restarting.\n", signal);
|
||||||
|
@ -367,9 +367,9 @@ static void print_help()
|
||||||
g_print("\nPlease report bugs at %s\n\n", PACKAGE_BUGREPORT);
|
g_print("\nPlease report bugs at %s\n\n", PACKAGE_BUGREPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_args(int argc, char **argv)
|
static void parse_args(gint argc, gchar **argv)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i) {
|
for (i = 1; i < argc; ++i) {
|
||||||
if (!strcmp(argv[i], "--version")) {
|
if (!strcmp(argv[i], "--version")) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ static Rect* pick_head(ObClient *c)
|
||||||
|
|
||||||
static gboolean place_random(ObClient *client, gint *x, gint *y)
|
static gboolean place_random(ObClient *client, gint *x, gint *y)
|
||||||
{
|
{
|
||||||
int l, r, t, b;
|
gint l, r, t, b;
|
||||||
Rect *area;
|
Rect *area;
|
||||||
|
|
||||||
area = pick_head(client);
|
area = pick_head(client);
|
||||||
|
@ -345,7 +345,7 @@ static gboolean place_transient(ObClient *client, gint *x, gint *y)
|
||||||
} else {
|
} else {
|
||||||
GSList *it;
|
GSList *it;
|
||||||
gboolean first = TRUE;
|
gboolean first = TRUE;
|
||||||
int l, r, t, b;
|
gint l, r, t, b;
|
||||||
for (it = client->group->members; it; it = it->next) {
|
for (it = client->group->members; it; it = it->next) {
|
||||||
ObClient *m = it->data;
|
ObClient *m = it->data;
|
||||||
if (!(m == client || m->transient_for)) {
|
if (!(m == client || m->transient_for)) {
|
||||||
|
|
|
@ -158,16 +158,16 @@ void prop_startup()
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* this just isn't used... and it also breaks on 64bit, watch out
|
/* this just isn't used... and it also breaks on 64bit, watch out
|
||||||
static gboolean get(Window win, Atom prop, Atom type, int size,
|
static gboolean get(Window win, Atom prop, Atom type, gint size,
|
||||||
guchar **data, gulong num)
|
guchar **data, gulong num)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
int res;
|
gint res;
|
||||||
guchar *xdata = NULL;
|
guchar *xdata = NULL;
|
||||||
Atom ret_type;
|
Atom ret_type;
|
||||||
int ret_size;
|
gint ret_size;
|
||||||
gulong ret_items, bytes_left;
|
gulong ret_items, bytes_left;
|
||||||
long num32 = 32 / size * num; /\* num in 32-bit elements *\/
|
glong num32 = 32 / size * num; /\* num in 32-bit elements *\/
|
||||||
|
|
||||||
res = XGetWindowProperty(display, win, prop, 0l, num32,
|
res = XGetWindowProperty(display, win, prop, 0l, num32,
|
||||||
FALSE, type, &ret_type, &ret_size,
|
FALSE, type, &ret_type, &ret_size,
|
||||||
|
@ -183,16 +183,16 @@ static gboolean get(Window win, Atom prop, Atom type, int size,
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gboolean get_prealloc(Window win, Atom prop, Atom type, int size,
|
static gboolean get_prealloc(Window win, Atom prop, Atom type, gint size,
|
||||||
guchar *data, gulong num)
|
guchar *data, gulong num)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
int res;
|
gint res;
|
||||||
guchar *xdata = NULL;
|
guchar *xdata = NULL;
|
||||||
Atom ret_type;
|
Atom ret_type;
|
||||||
int ret_size;
|
gint ret_size;
|
||||||
gulong ret_items, bytes_left;
|
gulong ret_items, bytes_left;
|
||||||
long num32 = 32 / size * num; /* num in 32-bit elements */
|
glong num32 = 32 / size * num; /* num in 32-bit elements */
|
||||||
|
|
||||||
res = XGetWindowProperty(ob_display, win, prop, 0l, num32,
|
res = XGetWindowProperty(ob_display, win, prop, 0l, num32,
|
||||||
FALSE, type, &ret_type, &ret_size,
|
FALSE, type, &ret_type, &ret_size,
|
||||||
|
@ -221,14 +221,14 @@ static gboolean get_prealloc(Window win, Atom prop, Atom type, int size,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean get_all(Window win, Atom prop, Atom type, int size,
|
static gboolean get_all(Window win, Atom prop, Atom type, gint size,
|
||||||
guchar **data, guint *num)
|
guchar **data, guint *num)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
int res;
|
gint res;
|
||||||
guchar *xdata = NULL;
|
guchar *xdata = NULL;
|
||||||
Atom ret_type;
|
Atom ret_type;
|
||||||
int ret_size;
|
gint ret_size;
|
||||||
gulong ret_items, bytes_left;
|
gulong ret_items, bytes_left;
|
||||||
|
|
||||||
res = XGetWindowProperty(ob_display, win, prop, 0l, G_MAXLONG,
|
res = XGetWindowProperty(ob_display, win, prop, 0l, G_MAXLONG,
|
||||||
|
@ -261,7 +261,7 @@ static gboolean get_all(Window win, Atom prop, Atom type, int size,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean get_stringlist(Window win, Atom prop, char ***list, int *nstr)
|
static gboolean get_stringlist(Window win, Atom prop, gchar ***list, gint *nstr)
|
||||||
{
|
{
|
||||||
XTextProperty tprop;
|
XTextProperty tprop;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
@ -285,11 +285,11 @@ gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
|
||||||
return get_all(win, prop, type, 32, (guchar**)ret, nret);
|
return get_all(win, prop, type, 32, (guchar**)ret, nret);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean prop_get_string_locale(Window win, Atom prop, char **ret)
|
gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret)
|
||||||
{
|
{
|
||||||
char **list;
|
gchar **list;
|
||||||
int nstr;
|
gint nstr;
|
||||||
char *s;
|
gchar *s;
|
||||||
|
|
||||||
if (get_stringlist(win, prop, &list, &nstr) && nstr) {
|
if (get_stringlist(win, prop, &list, &nstr) && nstr) {
|
||||||
s = g_convert(list[0], strlen(list[0]), "UTF-8", "ISO-8859-1",
|
s = g_convert(list[0], strlen(list[0]), "UTF-8", "ISO-8859-1",
|
||||||
|
@ -303,10 +303,10 @@ gboolean prop_get_string_locale(Window win, Atom prop, char **ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret)
|
gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret)
|
||||||
{
|
{
|
||||||
GSList *strs = NULL, *it;
|
GSList *strs = NULL, *it;
|
||||||
char *raw, *p;
|
gchar *raw, *p;
|
||||||
guint num, i, count = 0;
|
guint num, i, count = 0;
|
||||||
|
|
||||||
if (get_all(win, prop, prop_atoms.string, 8, (guchar**)&raw, &num)) {
|
if (get_all(win, prop, prop_atoms.string, 8, (guchar**)&raw, &num)) {
|
||||||
|
@ -318,7 +318,7 @@ gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret)
|
||||||
p += strlen(p) + 1; /* next string */
|
p += strlen(p) + 1; /* next string */
|
||||||
}
|
}
|
||||||
|
|
||||||
*ret = g_new0(char*, count + 1);
|
*ret = g_new0(gchar*, count + 1);
|
||||||
(*ret)[count] = NULL; /* null terminated list */
|
(*ret)[count] = NULL; /* null terminated list */
|
||||||
|
|
||||||
for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
|
for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
|
||||||
|
@ -335,10 +335,10 @@ gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean prop_get_string_utf8(Window win, Atom prop, char **ret)
|
gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret)
|
||||||
{
|
{
|
||||||
char *raw;
|
gchar *raw;
|
||||||
char *str;
|
gchar *str;
|
||||||
guint num;
|
guint num;
|
||||||
|
|
||||||
if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
|
if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
|
||||||
|
@ -353,10 +353,10 @@ gboolean prop_get_string_utf8(Window win, Atom prop, char **ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean prop_get_strings_utf8(Window win, Atom prop, char ***ret)
|
gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret)
|
||||||
{
|
{
|
||||||
GSList *strs = NULL, *it;
|
GSList *strs = NULL, *it;
|
||||||
char *raw, *p;
|
gchar *raw, *p;
|
||||||
guint num, i, count = 0;
|
guint num, i, count = 0;
|
||||||
|
|
||||||
if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
|
if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
|
||||||
|
@ -368,7 +368,7 @@ gboolean prop_get_strings_utf8(Window win, Atom prop, char ***ret)
|
||||||
p += strlen(p) + 1; /* next string */
|
p += strlen(p) + 1; /* next string */
|
||||||
}
|
}
|
||||||
|
|
||||||
*ret = g_new0(char*, count + 1);
|
*ret = g_new0(gchar*, count + 1);
|
||||||
|
|
||||||
for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
|
for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
|
||||||
if (g_utf8_validate(it->data, -1, NULL))
|
if (g_utf8_validate(it->data, -1, NULL))
|
||||||
|
@ -396,16 +396,16 @@ void prop_set_array32(Window win, Atom prop, Atom type, guint32 *val,
|
||||||
(guchar*)val, num);
|
(guchar*)val, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prop_set_string_utf8(Window win, Atom prop, char *val)
|
void prop_set_string_utf8(Window win, Atom prop, gchar *val)
|
||||||
{
|
{
|
||||||
XChangeProperty(ob_display, win, prop, prop_atoms.utf8, 8,
|
XChangeProperty(ob_display, win, prop, prop_atoms.utf8, 8,
|
||||||
PropModeReplace, (guchar*)val, strlen(val));
|
PropModeReplace, (guchar*)val, strlen(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
void prop_set_strings_utf8(Window win, Atom prop, char **strs)
|
void prop_set_strings_utf8(Window win, Atom prop, gchar **strs)
|
||||||
{
|
{
|
||||||
GString *str;
|
GString *str;
|
||||||
char **s;
|
gchar **s;
|
||||||
|
|
||||||
str = g_string_sized_new(0);
|
str = g_string_sized_new(0);
|
||||||
for (s = strs; *s; ++s) {
|
for (s = strs; *s; ++s) {
|
||||||
|
@ -422,8 +422,8 @@ void prop_erase(Window win, Atom prop)
|
||||||
XDeleteProperty(ob_display, win, prop);
|
XDeleteProperty(ob_display, win, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prop_message(Window about, Atom messagetype, long data0, long data1,
|
void prop_message(Window about, Atom messagetype, glong data0, glong data1,
|
||||||
long data2, long data3, long mask)
|
glong data2, glong data3, glong mask)
|
||||||
{
|
{
|
||||||
XEvent ce;
|
XEvent ce;
|
||||||
ce.xclient.type = ClientMessage;
|
ce.xclient.type = ClientMessage;
|
||||||
|
|
|
@ -172,21 +172,21 @@ void prop_startup();
|
||||||
gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
|
gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
|
||||||
gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
|
gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
|
||||||
guint *nret);
|
guint *nret);
|
||||||
gboolean prop_get_string_locale(Window win, Atom prop, char **ret);
|
gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret);
|
||||||
gboolean prop_get_string_utf8(Window win, Atom prop, char **ret);
|
gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret);
|
||||||
gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret);
|
gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret);
|
||||||
gboolean prop_get_strings_utf8(Window win, Atom prop, char ***ret);
|
gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret);
|
||||||
|
|
||||||
void prop_set32(Window win, Atom prop, Atom type, guint32 val);
|
void prop_set32(Window win, Atom prop, Atom type, guint32 val);
|
||||||
void prop_set_array32(Window win, Atom prop, Atom type, guint32 *val,
|
void prop_set_array32(Window win, Atom prop, Atom type, guint32 *val,
|
||||||
guint num);
|
guint num);
|
||||||
void prop_set_string_utf8(Window win, Atom prop, char *val);
|
void prop_set_string_utf8(Window win, Atom prop, gchar *val);
|
||||||
void prop_set_strings_utf8(Window win, Atom prop, char **strs);
|
void prop_set_strings_utf8(Window win, Atom prop, gchar **strs);
|
||||||
|
|
||||||
void prop_erase(Window win, Atom prop);
|
void prop_erase(Window win, Atom prop);
|
||||||
|
|
||||||
void prop_message(Window about, Atom messagetype, long data0, long data1,
|
void prop_message(Window about, Atom messagetype, glong data0, glong data1,
|
||||||
long data2, long data3, long mask);
|
glong data2, glong data3, glong mask);
|
||||||
|
|
||||||
#define PROP_GET32(win, prop, type, ret) \
|
#define PROP_GET32(win, prop, type, ret) \
|
||||||
(prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
|
(prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
|
||||||
|
|
|
@ -49,7 +49,7 @@ void resist_move_windows(ObClient *c, gint *x, gint *y)
|
||||||
if (config_resist_win)
|
if (config_resist_win)
|
||||||
for (it = stacking_list; it != NULL; it = it->next) {
|
for (it = stacking_list; it != NULL; it = it->next) {
|
||||||
ObClient *target;
|
ObClient *target;
|
||||||
int tl, tt, tr, tb; /* 1 past the target's edges on each side */
|
gint tl, tt, tr, tb; /* 1 past the target's edges on each side */
|
||||||
|
|
||||||
if (!WINDOW_IS_CLIENT(it->data))
|
if (!WINDOW_IS_CLIENT(it->data))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -54,7 +54,7 @@ guint screen_last_desktop;
|
||||||
Size screen_physical_size;
|
Size screen_physical_size;
|
||||||
gboolean screen_showing_desktop;
|
gboolean screen_showing_desktop;
|
||||||
DesktopLayout screen_desktop_layout;
|
DesktopLayout screen_desktop_layout;
|
||||||
char **screen_desktop_names;
|
gchar **screen_desktop_names;
|
||||||
Window screen_support_win;
|
Window screen_support_win;
|
||||||
|
|
||||||
static Rect **area; /* array of desktop holding array of xinerama areas */
|
static Rect **area; /* array of desktop holding array of xinerama areas */
|
||||||
|
@ -64,7 +64,7 @@ static ObPagerPopup *desktop_cycle_popup;
|
||||||
|
|
||||||
static gboolean replace_wm()
|
static gboolean replace_wm()
|
||||||
{
|
{
|
||||||
char *wm_sn;
|
gchar *wm_sn;
|
||||||
Atom wm_sn_atom;
|
Atom wm_sn_atom;
|
||||||
Window current_wm_sn_owner;
|
Window current_wm_sn_owner;
|
||||||
Time timestamp;
|
Time timestamp;
|
||||||
|
@ -281,7 +281,7 @@ void screen_startup(gboolean reconfig)
|
||||||
screen_resize();
|
screen_resize();
|
||||||
|
|
||||||
/* set the names */
|
/* set the names */
|
||||||
screen_desktop_names = g_new(char*,
|
screen_desktop_names = g_new(gchar*,
|
||||||
g_slist_length(config_desktops_names) + 1);
|
g_slist_length(config_desktops_names) + 1);
|
||||||
for (i = 0, it = config_desktops_names; it; ++i, it = it->next)
|
for (i = 0, it = config_desktops_names; it; ++i, it = it->next)
|
||||||
screen_desktop_names[i] = it->data; /* dont strdup */
|
screen_desktop_names[i] = it->data; /* dont strdup */
|
||||||
|
@ -336,8 +336,8 @@ void screen_shutdown(gboolean reconfig)
|
||||||
|
|
||||||
void screen_resize()
|
void screen_resize()
|
||||||
{
|
{
|
||||||
static int oldw = 0, oldh = 0;
|
static gint oldw = 0, oldh = 0;
|
||||||
int w, h;
|
gint w, h;
|
||||||
GList *it;
|
GList *it;
|
||||||
guint32 geometry[2];
|
guint32 geometry[2];
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ void screen_update_desktop_names()
|
||||||
else
|
else
|
||||||
i = 0;
|
i = 0;
|
||||||
if (i <= screen_num_desktops) {
|
if (i <= screen_num_desktops) {
|
||||||
screen_desktop_names = g_renew(char*, screen_desktop_names,
|
screen_desktop_names = g_renew(gchar*, screen_desktop_names,
|
||||||
screen_num_desktops + 1);
|
screen_num_desktops + 1);
|
||||||
screen_desktop_names[screen_num_desktops] = NULL;
|
screen_desktop_names[screen_num_desktops] = NULL;
|
||||||
for (; i < screen_num_desktops; ++i)
|
for (; i < screen_num_desktops; ++i)
|
||||||
|
@ -1190,10 +1190,10 @@ void screen_set_root_cursor()
|
||||||
ob_cursor(OB_CURSOR_POINTER));
|
ob_cursor(OB_CURSOR_POINTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean screen_pointer_pos(int *x, int *y)
|
gboolean screen_pointer_pos(gint *x, gint *y)
|
||||||
{
|
{
|
||||||
Window w;
|
Window w;
|
||||||
int i;
|
gint i;
|
||||||
guint u;
|
guint u;
|
||||||
|
|
||||||
return !!XQueryPointer(ob_display, RootWindow(ob_display, ob_screen),
|
return !!XQueryPointer(ob_display, RootWindow(ob_display, ob_screen),
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef struct DesktopLayout {
|
||||||
extern DesktopLayout screen_desktop_layout;
|
extern DesktopLayout screen_desktop_layout;
|
||||||
|
|
||||||
/*! An array of gchar*'s which are desktop names in UTF-8 format */
|
/*! An array of gchar*'s which are desktop names in UTF-8 format */
|
||||||
extern char **screen_desktop_names;
|
extern gchar **screen_desktop_names;
|
||||||
|
|
||||||
/*! Take over the screen, set the basic hints on it claming it as ours */
|
/*! Take over the screen, set the basic hints on it claming it as ours */
|
||||||
gboolean screen_annex();
|
gboolean screen_annex();
|
||||||
|
@ -100,6 +100,6 @@ Rect *screen_area_monitor(guint desktop, guint head);
|
||||||
gotta call it to let it know it should change. */
|
gotta call it to let it know it should change. */
|
||||||
void screen_set_root_cursor();
|
void screen_set_root_cursor();
|
||||||
|
|
||||||
gboolean screen_pointer_pos(int *x, int *y);
|
gboolean screen_pointer_pos(gint *x, gint *y);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
GList *session_saved_state;
|
GList *session_saved_state;
|
||||||
|
|
||||||
void session_startup(int *argc, char ***argv) {}
|
void session_startup(gint *argc, gchar ***argv) {}
|
||||||
void session_shutdown() {}
|
void session_shutdown() {}
|
||||||
GList* session_state_find(ObClient *c) { return NULL; }
|
GList* session_state_find(ObClient *c) { return NULL; }
|
||||||
gboolean session_state_cmp(ObSessionState *s, ObClient *c) { return FALSE; }
|
gboolean session_state_cmp(ObSessionState *s, ObClient *c) { return FALSE; }
|
||||||
|
@ -62,11 +62,11 @@ static gint sm_argc;
|
||||||
static gchar **sm_argv;
|
static gchar **sm_argv;
|
||||||
static gchar *sm_sessions_path;
|
static gchar *sm_sessions_path;
|
||||||
|
|
||||||
static void session_load(char *path);
|
static void session_load(gchar *path);
|
||||||
static gboolean session_save();
|
static gboolean session_save();
|
||||||
|
|
||||||
static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type,
|
static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type,
|
||||||
Bool shutdown, int interact_style, Bool fast);
|
Bool shutdown, gint interact_style, Bool fast);
|
||||||
static void sm_die(SmcConn conn, SmPointer data);
|
static void sm_die(SmcConn conn, SmPointer data);
|
||||||
static void sm_save_complete(SmcConn conn, SmPointer data);
|
static void sm_save_complete(SmcConn conn, SmPointer data);
|
||||||
static void sm_shutdown_cancelled(SmcConn conn, SmPointer data);
|
static void sm_shutdown_cancelled(SmcConn conn, SmPointer data);
|
||||||
|
@ -112,18 +112,18 @@ static void save_commands()
|
||||||
g_free(prop_cmd.vals);
|
g_free(prop_cmd.vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_args(int *argc, char ***argv, int index, int num)
|
static void remove_args(gint *argc, gchar ***argv, gint index, gint num)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
for (i = index; i < index + num; ++i)
|
for (i = index; i < index + num; ++i)
|
||||||
(*argv)[i] = (*argv)[i+num];
|
(*argv)[i] = (*argv)[i+num];
|
||||||
*argc -= num;
|
*argc -= num;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_args(int *argc, char ***argv)
|
static void parse_args(gint *argc, gchar ***argv)
|
||||||
{
|
{
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
for (i = 1; i < *argc; ++i) {
|
for (i = 1; i < *argc; ++i) {
|
||||||
if (!strcmp((*argv)[i], "--sm-client-id")) {
|
if (!strcmp((*argv)[i], "--sm-client-id")) {
|
||||||
|
@ -149,12 +149,12 @@ static void parse_args(int *argc, char ***argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_startup(int *argc, char ***argv)
|
void session_startup(gint *argc, gchar ***argv)
|
||||||
{
|
{
|
||||||
#define SM_ERR_LEN 1024
|
#define SM_ERR_LEN 1024
|
||||||
|
|
||||||
SmcCallbacks cb;
|
SmcCallbacks cb;
|
||||||
char sm_err[SM_ERR_LEN];
|
gchar sm_err[SM_ERR_LEN];
|
||||||
|
|
||||||
parse_args(argc, argv);
|
parse_args(argc, argv);
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void session_startup(int *argc, char ***argv)
|
||||||
val_hint.value = &hint;
|
val_hint.value = &hint;
|
||||||
val_hint.length = 1;
|
val_hint.length = 1;
|
||||||
|
|
||||||
sprintf(pid, "%ld", (long)getpid());
|
sprintf(pid, "%ld", (glong)getpid());
|
||||||
val_pid.value = pid;
|
val_pid.value = pid;
|
||||||
val_pid.length = strlen(pid);
|
val_pid.length = strlen(pid);
|
||||||
|
|
||||||
|
@ -289,8 +289,8 @@ static void sm_save_yourself_phase2(SmcConn conn, SmPointer data)
|
||||||
SmcSaveYourselfDone(conn, success);
|
SmcSaveYourselfDone(conn, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type,
|
static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type,
|
||||||
Bool shutdown, int interact_style, Bool fast)
|
Bool shutdown, gint interact_style, Bool fast)
|
||||||
{
|
{
|
||||||
if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_phase2, data)) {
|
if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_phase2, data)) {
|
||||||
ob_debug("SAVE YOURSELF PHASE 2 failed\n");
|
ob_debug("SAVE YOURSELF PHASE 2 failed\n");
|
||||||
|
@ -320,8 +320,8 @@ static gboolean session_save()
|
||||||
|
|
||||||
/* this algo is from metacity */
|
/* this algo is from metacity */
|
||||||
filename = g_strdup_printf("%d-%d-%u.obs",
|
filename = g_strdup_printf("%d-%d-%u.obs",
|
||||||
(int) time(NULL),
|
(gint) time(NULL),
|
||||||
(int) getpid(),
|
(gint) getpid(),
|
||||||
g_random_int());
|
g_random_int());
|
||||||
save_file = g_build_filename(sm_sessions_path, filename, NULL);
|
save_file = g_build_filename(sm_sessions_path, filename, NULL);
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
|
@ -468,7 +468,7 @@ static gint stack_sort(const ObSessionState *s1, const ObSessionState *s2)
|
||||||
return s1->stacking - s2->stacking;
|
return s1->stacking - s2->stacking;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void session_load(char *path)
|
static void session_load(gchar *path)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlNodePtr node, n;
|
xmlNodePtr node, n;
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct _ObSessionState {
|
||||||
|
|
||||||
extern GList *session_saved_state;
|
extern GList *session_saved_state;
|
||||||
|
|
||||||
void session_startup(int *argc, char ***argv);
|
void session_startup(gint *argc, gchar ***argv);
|
||||||
void session_shutdown();
|
void session_shutdown();
|
||||||
|
|
||||||
GList* session_state_find(struct _ObClient *c);
|
GList* session_state_find(struct _ObClient *c);
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void do_restack(GList *wins, GList *before)
|
||||||
{
|
{
|
||||||
GList *it, *next;
|
GList *it, *next;
|
||||||
Window *win;
|
Window *win;
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* pls only restack stuff in the same layer at a time */
|
/* pls only restack stuff in the same layer at a time */
|
||||||
|
@ -106,7 +106,7 @@ static void do_raise(GList *wins)
|
||||||
{
|
{
|
||||||
GList *it;
|
GList *it;
|
||||||
GList *layer[OB_NUM_STACKING_LAYERS] = {NULL};
|
GList *layer[OB_NUM_STACKING_LAYERS] = {NULL};
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
for (it = wins; it; it = g_list_next(it)) {
|
for (it = wins; it; it = g_list_next(it)) {
|
||||||
ObStackingLayer l;
|
ObStackingLayer l;
|
||||||
|
@ -133,7 +133,7 @@ static void do_lower(GList *wins)
|
||||||
{
|
{
|
||||||
GList *it;
|
GList *it;
|
||||||
GList *layer[OB_NUM_STACKING_LAYERS] = {NULL};
|
GList *layer[OB_NUM_STACKING_LAYERS] = {NULL};
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
for (it = wins; it; it = g_list_next(it)) {
|
for (it = wins; it; it = g_list_next(it)) {
|
||||||
ObStackingLayer l;
|
ObStackingLayer l;
|
||||||
|
@ -161,7 +161,7 @@ static GList *pick_windows(ObClient *top, ObClient *selected, gboolean raise)
|
||||||
GList *ret = NULL;
|
GList *ret = NULL;
|
||||||
GList *it, *next, *prev;
|
GList *it, *next, *prev;
|
||||||
GSList *sit;
|
GSList *sit;
|
||||||
int i, n;
|
gint i, n;
|
||||||
GList *modals = NULL;
|
GList *modals = NULL;
|
||||||
GList *trans = NULL;
|
GList *trans = NULL;
|
||||||
GList *modal_sel = NULL; /* the selected guys if modal */
|
GList *modal_sel = NULL; /* the selected guys if modal */
|
||||||
|
@ -234,7 +234,7 @@ static GList *pick_group_windows(ObClient *top, ObClient *selected,
|
||||||
GList *ret = NULL;
|
GList *ret = NULL;
|
||||||
GList *it, *next, *prev;
|
GList *it, *next, *prev;
|
||||||
GSList *sit;
|
GSList *sit;
|
||||||
int i, n;
|
gint i, n;
|
||||||
|
|
||||||
/* add group members in their stacking order */
|
/* add group members in their stacking order */
|
||||||
if (top->group) {
|
if (top->group) {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static guint translate_modifier(char *str)
|
static guint translate_modifier(gchar *str)
|
||||||
{
|
{
|
||||||
if (!g_ascii_strcasecmp("Mod1", str) ||
|
if (!g_ascii_strcasecmp("Mod1", str) ||
|
||||||
!g_ascii_strcasecmp("A", str)) return Mod1Mask;
|
!g_ascii_strcasecmp("A", str)) return Mod1Mask;
|
||||||
|
@ -41,9 +41,9 @@ static guint translate_modifier(char *str)
|
||||||
|
|
||||||
gboolean translate_button(const gchar *str, guint *state, guint *button)
|
gboolean translate_button(const gchar *str, guint *state, guint *button)
|
||||||
{
|
{
|
||||||
char **parsed;
|
gchar **parsed;
|
||||||
char *l;
|
gchar *l;
|
||||||
int i;
|
gint i;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
parsed = g_strsplit(str, "-", -1);
|
parsed = g_strsplit(str, "-", -1);
|
||||||
|
@ -84,9 +84,9 @@ translation_fail:
|
||||||
|
|
||||||
gboolean translate_key(const gchar *str, guint *state, guint *keycode)
|
gboolean translate_key(const gchar *str, guint *state, guint *keycode)
|
||||||
{
|
{
|
||||||
char **parsed;
|
gchar **parsed;
|
||||||
char *l;
|
gchar *l;
|
||||||
int i;
|
gint i;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
KeySym sym;
|
KeySym sym;
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
static gboolean xerror_ignore = FALSE;
|
static gboolean xerror_ignore = FALSE;
|
||||||
gboolean xerror_occured = FALSE;
|
gboolean xerror_occured = FALSE;
|
||||||
|
|
||||||
int xerror_handler(Display *d, XErrorEvent *e)
|
gint xerror_handler(Display *d, XErrorEvent *e)
|
||||||
{
|
{
|
||||||
xerror_occured = TRUE;
|
xerror_occured = TRUE;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!xerror_ignore) {
|
if (!xerror_ignore) {
|
||||||
char errtxt[128];
|
gchar errtxt[128];
|
||||||
|
|
||||||
/*if (e->error_code != BadWindow) */
|
/*if (e->error_code != BadWindow) */
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
/* can be used to track errors */
|
/* can be used to track errors */
|
||||||
extern gboolean xerror_occured;
|
extern gboolean xerror_occured;
|
||||||
|
|
||||||
int xerror_handler(Display *, XErrorEvent *);
|
gint xerror_handler(Display *, XErrorEvent *);
|
||||||
|
|
||||||
void xerror_set_ignore(gboolean ignore);
|
void xerror_set_ignore(gboolean ignore);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ static GSList *xdg_config_dir_paths;
|
||||||
static GSList *xdg_data_dir_paths;
|
static GSList *xdg_data_dir_paths;
|
||||||
|
|
||||||
struct Callback {
|
struct Callback {
|
||||||
char *tag;
|
gchar *tag;
|
||||||
ParseCallback func;
|
ParseCallback func;
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ void parse_shutdown(ObParseInst *i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_register(ObParseInst *i, const char *tag,
|
void parse_register(ObParseInst *i, const gchar *tag,
|
||||||
ParseCallback func, void *data)
|
ParseCallback func, void *data)
|
||||||
{
|
{
|
||||||
struct Callback *c;
|
struct Callback *c;
|
||||||
|
@ -113,7 +113,7 @@ gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_load(const char *path, const char *rootname,
|
gboolean parse_load(const gchar *path, const gchar *rootname,
|
||||||
xmlDocPtr *doc, xmlNodePtr *root)
|
xmlDocPtr *doc, xmlNodePtr *root)
|
||||||
{
|
{
|
||||||
if ((*doc = xmlParseFile(path))) {
|
if ((*doc = xmlParseFile(path))) {
|
||||||
|
@ -136,7 +136,7 @@ gboolean parse_load(const char *path, const char *rootname,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_load_mem(gpointer data, guint len, const char *rootname,
|
gboolean parse_load_mem(gpointer data, guint len, const gchar *rootname,
|
||||||
xmlDocPtr *doc, xmlNodePtr *root)
|
xmlDocPtr *doc, xmlNodePtr *root)
|
||||||
{
|
{
|
||||||
if ((*doc = xmlParseMemory(data, len))) {
|
if ((*doc = xmlParseMemory(data, len))) {
|
||||||
|
@ -176,18 +176,18 @@ void parse_tree(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *parse_string(xmlDocPtr doc, xmlNodePtr node)
|
gchar *parse_string(xmlDocPtr doc, xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
|
xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
|
||||||
char *s = g_strdup(c ? (char*)c : "");
|
gchar *s = g_strdup(c ? (gchar*)c : "");
|
||||||
xmlFree(c);
|
xmlFree(c);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_int(xmlDocPtr doc, xmlNodePtr node)
|
gint parse_int(xmlDocPtr doc, xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
|
xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
|
||||||
int i = atoi((char*)c);
|
gint i = atoi((gchar*)c);
|
||||||
xmlFree(c);
|
xmlFree(c);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node)
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node)
|
gboolean parse_contains(const gchar *val, xmlDocPtr doc, xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
|
xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE);
|
||||||
gboolean r;
|
gboolean r;
|
||||||
|
@ -215,7 +215,7 @@ gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node)
|
xmlNodePtr parse_find_node(const gchar *tag, xmlNodePtr node)
|
||||||
{
|
{
|
||||||
while (node) {
|
while (node) {
|
||||||
if (!xmlStrcasecmp(node->name, (const xmlChar*) tag))
|
if (!xmlStrcasecmp(node->name, (const xmlChar*) tag))
|
||||||
|
@ -225,32 +225,32 @@ xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_attr_int(const char *name, xmlNodePtr node, int *value)
|
gboolean parse_attr_int(const gchar *name, xmlNodePtr node, gint *value)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
||||||
gboolean r = FALSE;
|
gboolean r = FALSE;
|
||||||
if (c) {
|
if (c) {
|
||||||
*value = atoi((char*)c);
|
*value = atoi((gchar*)c);
|
||||||
r = TRUE;
|
r = TRUE;
|
||||||
}
|
}
|
||||||
xmlFree(c);
|
xmlFree(c);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_attr_string(const char *name, xmlNodePtr node, char **value)
|
gboolean parse_attr_string(const gchar *name, xmlNodePtr node, gchar **value)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
||||||
gboolean r = FALSE;
|
gboolean r = FALSE;
|
||||||
if (c) {
|
if (c) {
|
||||||
*value = g_strdup((char*)c);
|
*value = g_strdup((gchar*)c);
|
||||||
r = TRUE;
|
r = TRUE;
|
||||||
}
|
}
|
||||||
xmlFree(c);
|
xmlFree(c);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean parse_attr_contains(const char *val, xmlNodePtr node,
|
gboolean parse_attr_contains(const gchar *val, xmlNodePtr node,
|
||||||
const char *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
||||||
gboolean r;
|
gboolean r;
|
||||||
|
|
|
@ -37,34 +37,34 @@ gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root);
|
||||||
/* Loads an Openbox menu, from the normal paths */
|
/* Loads an Openbox menu, from the normal paths */
|
||||||
gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root);
|
gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root);
|
||||||
|
|
||||||
void parse_register(ObParseInst *inst, const char *tag,
|
void parse_register(ObParseInst *inst, const gchar *tag,
|
||||||
ParseCallback func, gpointer data);
|
ParseCallback func, gpointer data);
|
||||||
void parse_tree(ObParseInst *inst, xmlDocPtr doc, xmlNodePtr node);
|
void parse_tree(ObParseInst *inst, xmlDocPtr doc, xmlNodePtr node);
|
||||||
|
|
||||||
|
|
||||||
/* open/close */
|
/* open/close */
|
||||||
|
|
||||||
gboolean parse_load(const char *path, const char *rootname,
|
gboolean parse_load(const gchar *path, const gchar *rootname,
|
||||||
xmlDocPtr *doc, xmlNodePtr *root);
|
xmlDocPtr *doc, xmlNodePtr *root);
|
||||||
gboolean parse_load_mem(gpointer data, guint len, const char *rootname,
|
gboolean parse_load_mem(gpointer data, guint len, const gchar *rootname,
|
||||||
xmlDocPtr *doc, xmlNodePtr *root);
|
xmlDocPtr *doc, xmlNodePtr *root);
|
||||||
void parse_close(xmlDocPtr doc);
|
void parse_close(xmlDocPtr doc);
|
||||||
|
|
||||||
|
|
||||||
/* helpers */
|
/* helpers */
|
||||||
|
|
||||||
xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node);
|
xmlNodePtr parse_find_node(const gchar *tag, xmlNodePtr node);
|
||||||
|
|
||||||
char *parse_string(xmlDocPtr doc, xmlNodePtr node);
|
gchar *parse_string(xmlDocPtr doc, xmlNodePtr node);
|
||||||
int parse_int(xmlDocPtr doc, xmlNodePtr node);
|
gint parse_int(xmlDocPtr doc, xmlNodePtr node);
|
||||||
gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node);
|
gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node);
|
||||||
|
|
||||||
gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node);
|
gboolean parse_contains(const gchar *val, xmlDocPtr doc, xmlNodePtr node);
|
||||||
gboolean parse_attr_contains(const char *val, xmlNodePtr node,
|
gboolean parse_attr_contains(const gchar *val, xmlNodePtr node,
|
||||||
const char *name);
|
const gchar *name);
|
||||||
|
|
||||||
gboolean parse_attr_string(const char *name, xmlNodePtr node, char **value);
|
gboolean parse_attr_string(const gchar *name, xmlNodePtr node, gchar **value);
|
||||||
gboolean parse_attr_int(const char *name, xmlNodePtr node, int *value);
|
gboolean parse_attr_int(const gchar *name, xmlNodePtr node, gint *value);
|
||||||
|
|
||||||
/* paths */
|
/* paths */
|
||||||
|
|
||||||
|
|
|
@ -114,11 +114,11 @@ void RrColorFree(RrColor *c)
|
||||||
|
|
||||||
void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
gint r, g, b;
|
||||||
int x,y;
|
gint x,y;
|
||||||
RrPixel32 *p32 = (RrPixel32 *) im->data;
|
RrPixel32 *p32 = (RrPixel32 *) im->data;
|
||||||
RrPixel16 *p16 = (RrPixel16 *) im->data;
|
RrPixel16 *p16 = (RrPixel16 *) im->data;
|
||||||
unsigned char *p8 = (unsigned char *)im->data;
|
guchar *p8 = (guchar *)im->data;
|
||||||
switch (im->bits_per_pixel) {
|
switch (im->bits_per_pixel) {
|
||||||
case 32:
|
case 32:
|
||||||
if ((RrRedOffset(inst) != RrDefaultRedOffset) ||
|
if ((RrRedOffset(inst) != RrDefaultRedOffset) ||
|
||||||
|
@ -136,7 +136,7 @@ void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
||||||
data += im->width;
|
data += im->width;
|
||||||
p32 += im->width;
|
p32 += im->width;
|
||||||
}
|
}
|
||||||
} else im->data = (char*) data;
|
} else im->data = (gchar*) data;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
for (y = 0; y < im->height; y++) {
|
for (y = 0; y < im->height; y++) {
|
||||||
|
@ -186,13 +186,13 @@ XColor *RrPickColor(const RrInstance *inst, gint r, gint g, gint b)
|
||||||
|
|
||||||
static void swap_byte_order(XImage *im)
|
static void swap_byte_order(XImage *im)
|
||||||
{
|
{
|
||||||
int x, y, di;
|
gint x, y, di;
|
||||||
|
|
||||||
di = 0;
|
di = 0;
|
||||||
for (y = 0; y < im->height; ++y) {
|
for (y = 0; y < im->height; ++y) {
|
||||||
for (x = 0; x < im->height; ++x) {
|
for (x = 0; x < im->height; ++x) {
|
||||||
char *c = &im->data[di + x * im->bits_per_pixel / 8];
|
gchar *c = &im->data[di + x * im->bits_per_pixel / 8];
|
||||||
char t;
|
gchar t;
|
||||||
|
|
||||||
switch (im->bits_per_pixel) {
|
switch (im->bits_per_pixel) {
|
||||||
case 32:
|
case 32:
|
||||||
|
@ -220,11 +220,11 @@ static void swap_byte_order(XImage *im)
|
||||||
|
|
||||||
void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
gint r, g, b;
|
||||||
int x,y;
|
gint x,y;
|
||||||
RrPixel32 *p32 = (RrPixel32 *) im->data;
|
RrPixel32 *p32 = (RrPixel32 *) im->data;
|
||||||
RrPixel16 *p16 = (RrPixel16 *) im->data;
|
RrPixel16 *p16 = (RrPixel16 *) im->data;
|
||||||
unsigned char *p8 = (unsigned char *)im->data;
|
guchar *p8 = (guchar *)im->data;
|
||||||
|
|
||||||
if (im->byte_order != LSBFirst)
|
if (im->byte_order != LSBFirst)
|
||||||
swap_byte_order(im);
|
swap_byte_order(im);
|
||||||
|
@ -286,17 +286,17 @@ void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RrColorRed(const RrColor *c)
|
gint RrColorRed(const RrColor *c)
|
||||||
{
|
{
|
||||||
return c->r;
|
return c->r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RrColorGreen(const RrColor *c)
|
gint RrColorGreen(const RrColor *c)
|
||||||
{
|
{
|
||||||
return c->g;
|
return c->g;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RrColorBlue(const RrColor *c)
|
gint RrColorBlue(const RrColor *c)
|
||||||
{
|
{
|
||||||
return c->b;
|
return c->b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
struct _RrColor {
|
struct _RrColor {
|
||||||
const RrInstance *inst;
|
const RrInstance *inst;
|
||||||
|
|
||||||
int r;
|
gint r;
|
||||||
int g;
|
gint g;
|
||||||
int b;
|
gint b;
|
||||||
unsigned long pixel;
|
gulong pixel;
|
||||||
GC gc;
|
GC gc;
|
||||||
|
|
||||||
gint key;
|
gint key;
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void measure_font(RrFont *f)
|
||||||
f->elipses_length = (signed) info.xOff;
|
f->elipses_length = (signed) info.xOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RrFont *openfont(const RrInstance *inst, char *fontstring)
|
static RrFont *openfont(const RrInstance *inst, gchar *fontstring)
|
||||||
{
|
{
|
||||||
RrFont *out;
|
RrFont *out;
|
||||||
FcPattern *pat, *match;
|
FcPattern *pat, *match;
|
||||||
|
@ -108,7 +108,7 @@ static RrFont *openfont(const RrInstance *inst, char *fontstring)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
RrFont *RrFontOpen(const RrInstance *inst, char *fontstring)
|
RrFont *RrFontOpen(const RrInstance *inst, gchar *fontstring)
|
||||||
{
|
{
|
||||||
RrFont *out;
|
RrFont *out;
|
||||||
|
|
||||||
|
@ -149,20 +149,20 @@ static void font_measure_full(const RrFont *f, const gchar *str,
|
||||||
*y = info.height + (f->shadow ? ABS(f->offset) : 0);
|
*y = info.height + (f->shadow ? ABS(f->offset) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RrFontMeasureString(const RrFont *f, const gchar *str)
|
gint RrFontMeasureString(const RrFont *f, const gchar *str)
|
||||||
{
|
{
|
||||||
gint x, y;
|
gint x, y;
|
||||||
font_measure_full (f, str, &x, &y);
|
font_measure_full (f, str, &x, &y);
|
||||||
return x + 4;
|
return x + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RrFontHeight(const RrFont *f)
|
gint RrFontHeight(const RrFont *f)
|
||||||
{
|
{
|
||||||
return f->xftfont->ascent + f->xftfont->descent +
|
return f->xftfont->ascent + f->xftfont->descent +
|
||||||
(f->shadow ? f->offset : 0);
|
(f->shadow ? f->offset : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RrFontMaxCharWidth(const RrFont *f)
|
gint RrFontMaxCharWidth(const RrFont *f)
|
||||||
{
|
{
|
||||||
return (signed) f->xftfont->max_advance_width;
|
return (signed) f->xftfont->max_advance_width;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct _RrFont {
|
||||||
gint offset;
|
gint offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
RrFont *RrFontOpen(const RrInstance *inst, char *fontstring);
|
RrFont *RrFontOpen(const RrInstance *inst, gchar *fontstring);
|
||||||
void RrFontClose(RrFont *f);
|
void RrFontClose(RrFont *f);
|
||||||
void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *position);
|
void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *position);
|
||||||
#endif /* __font_h */
|
#endif /* __font_h */
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
|
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
|
||||||
static void gradient_solid(RrAppearance *l, int w, int h);
|
static void gradient_solid(RrAppearance *l, gint w, gint h);
|
||||||
static void gradient_vertical(RrSurface *sf, int w, int h);
|
static void gradient_vertical(RrSurface *sf, gint w, gint h);
|
||||||
static void gradient_horizontal(RrSurface *sf, int w, int h);
|
static void gradient_horizontal(RrSurface *sf, gint w, gint h);
|
||||||
static void gradient_diagonal(RrSurface *sf, int w, int h);
|
static void gradient_diagonal(RrSurface *sf, gint w, gint h);
|
||||||
static void gradient_crossdiagonal(RrSurface *sf, int w, int h);
|
static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h);
|
||||||
static void gradient_pyramid(RrSurface *sf, int inw, int inh);
|
static void gradient_pyramid(RrSurface *sf, gint inw, gint inh);
|
||||||
|
|
||||||
void RrRender(RrAppearance *a, int w, int h)
|
void RrRender(RrAppearance *a, gint w, gint h)
|
||||||
{
|
{
|
||||||
RrPixel32 *data = a->surface.pixel_data;
|
RrPixel32 *data = a->surface.pixel_data;
|
||||||
RrPixel32 current;
|
RrPixel32 current;
|
||||||
unsigned int r,g,b;
|
guint r,g,b;
|
||||||
int off, x;
|
gint off, x;
|
||||||
|
|
||||||
switch (a->surface.grad) {
|
switch (a->surface.grad) {
|
||||||
case RR_SURFACE_SOLID:
|
case RR_SURFACE_SOLID:
|
||||||
|
@ -62,7 +62,7 @@ void RrRender(RrAppearance *a, int w, int h)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->surface.interlaced) {
|
if (a->surface.interlaced) {
|
||||||
int i;
|
gint i;
|
||||||
RrPixel32 *p;
|
RrPixel32 *p;
|
||||||
|
|
||||||
r = a->surface.interlace_color->r;
|
r = a->surface.interlace_color->r;
|
||||||
|
@ -121,7 +121,7 @@ void RrRender(RrAppearance *a, int w, int h)
|
||||||
|
|
||||||
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
|
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
gint r, g, b;
|
||||||
|
|
||||||
RrPixel32 *up, *down;
|
RrPixel32 *up, *down;
|
||||||
if (raised) {
|
if (raised) {
|
||||||
|
@ -155,7 +155,7 @@ static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
|
||||||
|
|
||||||
static void create_bevel_colors(RrAppearance *l)
|
static void create_bevel_colors(RrAppearance *l)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
gint r, g, b;
|
||||||
|
|
||||||
/* light color */
|
/* light color */
|
||||||
r = l->surface.primary->r;
|
r = l->surface.primary->r;
|
||||||
|
@ -181,12 +181,12 @@ static void create_bevel_colors(RrAppearance *l)
|
||||||
l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
|
l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gradient_solid(RrAppearance *l, int w, int h)
|
static void gradient_solid(RrAppearance *l, gint w, gint h)
|
||||||
{
|
{
|
||||||
RrPixel32 pix;
|
RrPixel32 pix;
|
||||||
int i, a, b;
|
gint i, a, b;
|
||||||
RrSurface *sp = &l->surface;
|
RrSurface *sp = &l->surface;
|
||||||
int left = 0, top = 0, right = w - 1, bottom = h - 1;
|
gint left = 0, top = 0, right = w - 1, bottom = h - 1;
|
||||||
|
|
||||||
pix = (sp->primary->r << RrDefaultRedOffset)
|
pix = (sp->primary->r << RrDefaultRedOffset)
|
||||||
+ (sp->primary->g << RrDefaultGreenOffset)
|
+ (sp->primary->g << RrDefaultGreenOffset)
|
||||||
|
@ -285,8 +285,8 @@ static void gradient_solid(RrAppearance *l, int w, int h)
|
||||||
/* * * * * * * * * * * * * * GRADIENT MAGIC WOOT * * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * GRADIENT MAGIC WOOT * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#define VARS(x) \
|
#define VARS(x) \
|
||||||
unsigned int color##x[3]; \
|
guint color##x[3]; \
|
||||||
int len##x, cdelta##x[3], error##x[3] = { 0, 0, 0 }, inc##x[3]; \
|
gint len##x, cdelta##x[3], error##x[3] = { 0, 0, 0 }, inc##x[3]; \
|
||||||
gboolean bigslope##x[3] /* color slope > 1 */
|
gboolean bigslope##x[3] /* color slope > 1 */
|
||||||
|
|
||||||
#define SETUP(x, from, to, w) \
|
#define SETUP(x, from, to, w) \
|
||||||
|
@ -334,7 +334,7 @@ static void gradient_solid(RrAppearance *l, int w, int h)
|
||||||
|
|
||||||
#define NEXT(x) \
|
#define NEXT(x) \
|
||||||
{ \
|
{ \
|
||||||
int i; \
|
gint i; \
|
||||||
for (i = 2; i >= 0; --i) { \
|
for (i = 2; i >= 0; --i) { \
|
||||||
if (!cdelta##x[i]) continue; \
|
if (!cdelta##x[i]) continue; \
|
||||||
\
|
\
|
||||||
|
@ -359,9 +359,9 @@ static void gradient_solid(RrAppearance *l, int w, int h)
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gradient_horizontal(RrSurface *sf, int w, int h)
|
static void gradient_horizontal(RrSurface *sf, gint w, gint h)
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
RrPixel32 *data = sf->pixel_data, *datav;
|
RrPixel32 *data = sf->pixel_data, *datav;
|
||||||
RrPixel32 current;
|
RrPixel32 current;
|
||||||
|
|
||||||
|
@ -384,9 +384,9 @@ static void gradient_horizontal(RrSurface *sf, int w, int h)
|
||||||
*(data + y * w) = current;
|
*(data + y * w) = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gradient_vertical(RrSurface *sf, int w, int h)
|
static void gradient_vertical(RrSurface *sf, gint w, gint h)
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
RrPixel32 *data = sf->pixel_data;
|
RrPixel32 *data = sf->pixel_data;
|
||||||
RrPixel32 current;
|
RrPixel32 current;
|
||||||
|
|
||||||
|
@ -406,9 +406,9 @@ static void gradient_vertical(RrSurface *sf, int w, int h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void gradient_diagonal(RrSurface *sf, int w, int h)
|
static void gradient_diagonal(RrSurface *sf, gint w, gint h)
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
RrPixel32 *data = sf->pixel_data;
|
RrPixel32 *data = sf->pixel_data;
|
||||||
RrColor left, right;
|
RrColor left, right;
|
||||||
RrColor extracorner;
|
RrColor extracorner;
|
||||||
|
@ -453,9 +453,9 @@ static void gradient_diagonal(RrSurface *sf, int w, int h)
|
||||||
*data = COLOR(x);
|
*data = COLOR(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gradient_crossdiagonal(RrSurface *sf, int w, int h)
|
static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h)
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
RrPixel32 *data = sf->pixel_data;
|
RrPixel32 *data = sf->pixel_data;
|
||||||
RrColor left, right;
|
RrColor left, right;
|
||||||
RrColor extracorner;
|
RrColor extracorner;
|
||||||
|
@ -500,9 +500,9 @@ static void gradient_crossdiagonal(RrSurface *sf, int w, int h)
|
||||||
*data = COLOR(x);
|
*data = COLOR(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gradient_pyramid(RrSurface *sf, int inw, int inh)
|
static void gradient_pyramid(RrSurface *sf, gint inw, gint inh)
|
||||||
{
|
{
|
||||||
int x, y, w = (inw >> 1) + 1, h = (inh >> 1) + 1;
|
gint x, y, w = (inw >> 1) + 1, h = (inh >> 1) + 1;
|
||||||
RrPixel32 *data = sf->pixel_data;
|
RrPixel32 *data = sf->pixel_data;
|
||||||
RrPixel32 *end = data + inw*inh - 1;
|
RrPixel32 *end = data + inw*inh - 1;
|
||||||
RrPixel32 current;
|
RrPixel32 current;
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
void RrRender(RrAppearance *a, int w, int h);
|
void RrRender(RrAppearance *a, gint w, gint h);
|
||||||
|
|
||||||
#endif /* __gradient_h */
|
#endif /* __gradient_h */
|
||||||
|
|
|
@ -133,10 +133,10 @@ void RrImageDraw(RrPixel32 *target, RrTextureRGBA *rgba,
|
||||||
|
|
||||||
/* keep the ratio */
|
/* keep the ratio */
|
||||||
dw = area->width;
|
dw = area->width;
|
||||||
dh = (int)(dw * ((double)sh / sw));
|
dh = (gint)(dw * ((gdouble)sh / sw));
|
||||||
if (dh > area->height) {
|
if (dh > area->height) {
|
||||||
dh = area->height;
|
dh = area->height;
|
||||||
dw = (int)(dh * ((double)sw / sh));
|
dw = (gint)(dh * ((gdouble)sw / sh));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != dw || sh != dh) {
|
if (sw != dw || sh != dh) {
|
||||||
|
|
|
@ -44,11 +44,11 @@ dest(gpointer data)
|
||||||
static void f(gpointer key, gpointer value, gpointer n)
|
static void f(gpointer key, gpointer value, gpointer n)
|
||||||
{
|
{
|
||||||
RrColor *c = value;
|
RrColor *c = value;
|
||||||
if (c->id == *(int*)n)
|
if (c->id == *(gint*)n)
|
||||||
g_message("color %d has %d references", c->id, c->refcount);
|
g_message("color %d has %d references", c->id, c->refcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_refs(int id)
|
void print_refs(gint id)
|
||||||
{
|
{
|
||||||
g_hash_table_foreach(RrColorHash(definst), f, &id);
|
g_hash_table_foreach(RrColorHash(definst), f, &id);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ RrInstance* RrInstanceNew (Display *display, gint screen)
|
||||||
|
|
||||||
void RrTrueColorSetup (RrInstance *inst)
|
void RrTrueColorSetup (RrInstance *inst)
|
||||||
{
|
{
|
||||||
unsigned long red_mask, green_mask, blue_mask;
|
gulong red_mask, green_mask, blue_mask;
|
||||||
XImage *timage = NULL;
|
XImage *timage = NULL;
|
||||||
|
|
||||||
timage = XCreateImage(inst->display, inst->visual, inst->depth,
|
timage = XCreateImage(inst->display, inst->visual, inst->depth,
|
||||||
|
@ -120,9 +120,9 @@ void RrTrueColorSetup (RrInstance *inst)
|
||||||
void RrPseudoColorSetup (RrInstance *inst)
|
void RrPseudoColorSetup (RrInstance *inst)
|
||||||
{
|
{
|
||||||
XColor icolors[256];
|
XColor icolors[256];
|
||||||
int tr, tg, tb, n, r, g, b, i, incolors, ii;
|
gint tr, tg, tb, n, r, g, b, i, incolors, ii;
|
||||||
unsigned long dev;
|
gulong dev;
|
||||||
int cpc, _ncolors;
|
gint cpc, _ncolors;
|
||||||
|
|
||||||
/* determine the number of colors and the bits-per-color */
|
/* determine the number of colors and the bits-per-color */
|
||||||
inst->pseudo_bpc = 2; /* XXX THIS SHOULD BE A USER OPTION */
|
inst->pseudo_bpc = 2; /* XXX THIS SHOULD BE A USER OPTION */
|
||||||
|
@ -142,9 +142,9 @@ void RrPseudoColorSetup (RrInstance *inst)
|
||||||
for (n = 0, r = 0; r < cpc; r++)
|
for (n = 0, r = 0; r < cpc; r++)
|
||||||
for (g = 0; g < cpc; g++)
|
for (g = 0; g < cpc; g++)
|
||||||
for (b = 0; b < cpc; b++, n++) {
|
for (b = 0; b < cpc; b++, n++) {
|
||||||
tr = (int)(((float)(r)/(float)(cpc-1)) * 0xFF);
|
tr = (gint)(((gfloat)(r)/(gfloat)(cpc-1)) * 0xFF);
|
||||||
tg = (int)(((float)(g)/(float)(cpc-1)) * 0xFF);
|
tg = (gint)(((gfloat)(g)/(gfloat)(cpc-1)) * 0xFF);
|
||||||
tb = (int)(((float)(b)/(float)(cpc-1)) * 0xFF);
|
tb = (gint)(((gfloat)(b)/(gfloat)(cpc-1)) * 0xFF);
|
||||||
inst->pseudo_colors[n].red = tr | tr << 8;
|
inst->pseudo_colors[n].red = tr | tr << 8;
|
||||||
inst->pseudo_colors[n].green = tg | tg << 8;
|
inst->pseudo_colors[n].green = tg | tg << 8;
|
||||||
inst->pseudo_colors[n].blue = tb | tb << 8;
|
inst->pseudo_colors[n].blue = tb | tb << 8;
|
||||||
|
@ -171,7 +171,7 @@ void RrPseudoColorSetup (RrInstance *inst)
|
||||||
/* try match unallocated ones */
|
/* try match unallocated ones */
|
||||||
for (i = 0; i < _ncolors; i++) {
|
for (i = 0; i < _ncolors; i++) {
|
||||||
if (!inst->pseudo_colors[i].flags) { /* if it wasn't allocated... */
|
if (!inst->pseudo_colors[i].flags) { /* if it wasn't allocated... */
|
||||||
unsigned long closest = 0xffffffff, close = 0;
|
gulong closest = 0xffffffff, close = 0;
|
||||||
for (ii = 0; ii < incolors; ii++) {
|
for (ii = 0; ii < incolors; ii++) {
|
||||||
/* find deviations */
|
/* find deviations */
|
||||||
r = (inst->pseudo_colors[i].red - icolors[ii].red) & 0xff;
|
r = (inst->pseudo_colors[i].red - icolors[ii].red) & 0xff;
|
||||||
|
|
|
@ -46,7 +46,7 @@ void RrPixmapMaskFree(RrPixmapMask *m)
|
||||||
|
|
||||||
void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const RrRect *area)
|
void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const RrRect *area)
|
||||||
{
|
{
|
||||||
int x, y;
|
gint x, y;
|
||||||
if (m->mask == None) return; /* no mask given */
|
if (m->mask == None) return; /* no mask given */
|
||||||
|
|
||||||
/* set the clip region */
|
/* set the clip region */
|
||||||
|
|
|
@ -39,7 +39,7 @@ static void pixel_data_to_pixmap(RrAppearance *l,
|
||||||
|
|
||||||
void RrPaint(RrAppearance *a, Window win, gint w, gint h)
|
void RrPaint(RrAppearance *a, Window win, gint w, gint h)
|
||||||
{
|
{
|
||||||
int i, transferred = 0, sw;
|
gint i, transferred = 0, sw;
|
||||||
RrPixel32 *source, *dest;
|
RrPixel32 *source, *dest;
|
||||||
Pixmap oldp;
|
Pixmap oldp;
|
||||||
RrRect tarea; /* area in which to draw textures */
|
RrRect tarea; /* area in which to draw textures */
|
||||||
|
@ -278,7 +278,7 @@ static void pixel_data_to_pixmap(RrAppearance *l,
|
||||||
as reduce_depth just sets im->data = data and returns
|
as reduce_depth just sets im->data = data and returns
|
||||||
*/
|
*/
|
||||||
scratch = g_new(RrPixel32, im->width * im->height);
|
scratch = g_new(RrPixel32, im->width * im->height);
|
||||||
im->data = (char*) scratch;
|
im->data = (gchar*) scratch;
|
||||||
RrReduceDepth(l->inst, in, im);
|
RrReduceDepth(l->inst, in, im);
|
||||||
XPutImage(RrDisplay(l->inst), out,
|
XPutImage(RrDisplay(l->inst), out,
|
||||||
DefaultGC(RrDisplay(l->inst), RrScreen(l->inst)),
|
DefaultGC(RrDisplay(l->inst), RrScreen(l->inst)),
|
||||||
|
|
|
@ -200,9 +200,9 @@ RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
|
||||||
RrAppearance *RrAppearanceCopy (RrAppearance *a);
|
RrAppearance *RrAppearanceCopy (RrAppearance *a);
|
||||||
void RrAppearanceFree (RrAppearance *a);
|
void RrAppearanceFree (RrAppearance *a);
|
||||||
|
|
||||||
int RrFontMeasureString (const RrFont *f, const gchar *str);
|
gint RrFontMeasureString (const RrFont *f, const gchar *str);
|
||||||
int RrFontHeight (const RrFont *f);
|
gint RrFontHeight (const RrFont *f);
|
||||||
int RrFontMaxCharWidth (const RrFont *f);
|
gint RrFontMaxCharWidth (const RrFont *f);
|
||||||
|
|
||||||
void RrPaint (RrAppearance *a, Window win, gint w, gint h);
|
void RrPaint (RrAppearance *a, Window win, gint w, gint h);
|
||||||
void RrMinsize (RrAppearance *a, gint *w, gint *h);
|
void RrMinsize (RrAppearance *a, gint *w, gint *h);
|
||||||
|
|
|
@ -26,19 +26,19 @@
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
static int x_error_handler(Display * disp, XErrorEvent * error)
|
static gint x_error_handler(Display * disp, XErrorEvent * error)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
gchar buf[1024];
|
||||||
XGetErrorText(disp, error->error_code, buf, 1024);
|
XGetErrorText(disp, error->error_code, buf, 1024);
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Display *ob_display;
|
Display *ob_display;
|
||||||
int ob_screen;
|
gint ob_screen;
|
||||||
Window ob_root;
|
Window ob_root;
|
||||||
|
|
||||||
int main()
|
gint main()
|
||||||
{
|
{
|
||||||
Window win;
|
Window win;
|
||||||
RrInstance *inst;
|
RrInstance *inst;
|
||||||
|
@ -46,7 +46,7 @@ int main()
|
||||||
|
|
||||||
Window root;
|
Window root;
|
||||||
XEvent report;
|
XEvent report;
|
||||||
int h = 500, w = 500;
|
gint h = 500, w = 500;
|
||||||
|
|
||||||
ob_display = XOpenDisplay(NULL);
|
ob_display = XOpenDisplay(NULL);
|
||||||
XSetErrorHandler(x_error_handler);
|
XSetErrorHandler(x_error_handler);
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static XrmDatabase loaddb(RrTheme *theme, char *name);
|
static XrmDatabase loaddb(RrTheme *theme, gchar *name);
|
||||||
static gboolean read_int(XrmDatabase db, char *rname, int *value);
|
static gboolean read_int(XrmDatabase db, gchar *rname, gint *value);
|
||||||
static gboolean read_string(XrmDatabase db, char *rname, char **value);
|
static gboolean read_string(XrmDatabase db, gchar *rname, gchar **value);
|
||||||
static gboolean read_color(XrmDatabase db, const RrInstance *inst,
|
static gboolean read_color(XrmDatabase db, const RrInstance *inst,
|
||||||
gchar *rname, RrColor **value);
|
gchar *rname, RrColor **value);
|
||||||
static gboolean read_mask(const RrInstance *inst,
|
static gboolean read_mask(const RrInstance *inst,
|
||||||
|
@ -303,11 +303,11 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
|
guchar data[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
|
||||||
theme->max_mask = RrPixmapMaskNew(inst, 7, 7, (char*)data);
|
theme->max_mask = RrPixmapMaskNew(inst, 7, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
|
guchar data[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
|
||||||
theme->max_toggled_mask = RrPixmapMaskNew(inst, 7, 7, (char*)data);
|
theme->max_toggled_mask = RrPixmapMaskNew(inst, 7, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
theme->max_pressed_mask = RrPixmapMaskCopy(theme->max_mask);
|
theme->max_pressed_mask = RrPixmapMaskCopy(theme->max_mask);
|
||||||
theme->max_disabled_mask = RrPixmapMaskCopy(theme->max_mask);
|
theme->max_disabled_mask = RrPixmapMaskCopy(theme->max_mask);
|
||||||
|
@ -332,7 +332,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
|
guchar data[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
|
||||||
theme->iconify_mask = RrPixmapMaskNew(inst, 7, 7, (char*)data);
|
theme->iconify_mask = RrPixmapMaskNew(inst, 7, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
theme->iconify_pressed_mask = RrPixmapMaskCopy(theme->iconify_mask);
|
theme->iconify_pressed_mask = RrPixmapMaskCopy(theme->iconify_mask);
|
||||||
theme->iconify_disabled_mask = RrPixmapMaskCopy(theme->iconify_mask);
|
theme->iconify_disabled_mask = RrPixmapMaskCopy(theme->iconify_mask);
|
||||||
|
@ -364,12 +364,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
|
guchar data[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
|
||||||
theme->desk_mask = RrPixmapMaskNew(inst, 7, 7, (char*)data);
|
theme->desk_mask = RrPixmapMaskNew(inst, 7, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
|
guchar data[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
|
||||||
theme->desk_toggled_mask = RrPixmapMaskNew(inst, 7, 7,
|
theme->desk_toggled_mask = RrPixmapMaskNew(inst, 7, 7,
|
||||||
(char*)data);
|
(gchar*)data);
|
||||||
}
|
}
|
||||||
theme->desk_pressed_mask = RrPixmapMaskCopy(theme->desk_mask);
|
theme->desk_pressed_mask = RrPixmapMaskCopy(theme->desk_mask);
|
||||||
theme->desk_disabled_mask = RrPixmapMaskCopy(theme->desk_mask);
|
theme->desk_disabled_mask = RrPixmapMaskCopy(theme->desk_mask);
|
||||||
|
@ -397,12 +397,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
|
guchar data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
|
||||||
theme->shade_mask = RrPixmapMaskNew(inst, 7, 7, (char*)data);
|
theme->shade_mask = RrPixmapMaskNew(inst, 7, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
|
guchar data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
|
||||||
theme->shade_toggled_mask = RrPixmapMaskNew(inst, 7, 7,
|
theme->shade_toggled_mask = RrPixmapMaskNew(inst, 7, 7,
|
||||||
(char*)data);
|
(gchar*)data);
|
||||||
}
|
}
|
||||||
theme->shade_pressed_mask = RrPixmapMaskCopy(theme->shade_mask);
|
theme->shade_pressed_mask = RrPixmapMaskCopy(theme->shade_mask);
|
||||||
theme->shade_disabled_mask = RrPixmapMaskCopy(theme->shade_mask);
|
theme->shade_disabled_mask = RrPixmapMaskCopy(theme->shade_mask);
|
||||||
|
@ -425,7 +425,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
guchar data[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
|
guchar data[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
|
||||||
theme->close_mask = RrPixmapMaskNew(inst, 7, 7, (char*)data);
|
theme->close_mask = RrPixmapMaskNew(inst, 7, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
theme->close_pressed_mask = RrPixmapMaskCopy(theme->close_mask);
|
theme->close_pressed_mask = RrPixmapMaskCopy(theme->close_mask);
|
||||||
theme->close_disabled_mask = RrPixmapMaskCopy(theme->close_mask);
|
theme->close_disabled_mask = RrPixmapMaskCopy(theme->close_mask);
|
||||||
|
@ -434,7 +434,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
|
|
||||||
if (!read_mask(inst, "bullet.xbm", theme, &theme->menu_bullet_mask)) {
|
if (!read_mask(inst, "bullet.xbm", theme, &theme->menu_bullet_mask)) {
|
||||||
guchar data[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
|
guchar data[] = { 0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01 };
|
||||||
theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (char*)data);
|
theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (gchar*)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read the decoration textures */
|
/* read the decoration textures */
|
||||||
|
@ -1045,7 +1045,7 @@ void RrThemeFree(RrTheme *theme)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static XrmDatabase loaddb(RrTheme *theme, char *name)
|
static XrmDatabase loaddb(RrTheme *theme, gchar *name)
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
XrmDatabase db = NULL;
|
XrmDatabase db = NULL;
|
||||||
|
@ -1085,10 +1085,10 @@ static XrmDatabase loaddb(RrTheme *theme, char *name)
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *create_class_name(char *rname)
|
static gchar *create_class_name(gchar *rname)
|
||||||
{
|
{
|
||||||
char *rclass = g_strdup(rname);
|
gchar *rclass = g_strdup(rname);
|
||||||
char *p = rclass;
|
gchar *p = rclass;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
*p = toupper(*p);
|
*p = toupper(*p);
|
||||||
|
@ -1100,16 +1100,16 @@ static char *create_class_name(char *rname)
|
||||||
return rclass;
|
return rclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean read_int(XrmDatabase db, char *rname, int *value)
|
static gboolean read_int(XrmDatabase db, gchar *rname, gint *value)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
char *rclass = create_class_name(rname);
|
gchar *rclass = create_class_name(rname);
|
||||||
char *rettype, *end;
|
gchar *rettype, *end;
|
||||||
XrmValue retvalue;
|
XrmValue retvalue;
|
||||||
|
|
||||||
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
||||||
retvalue.addr != NULL) {
|
retvalue.addr != NULL) {
|
||||||
*value = (int)strtol(retvalue.addr, &end, 10);
|
*value = (gint)strtol(retvalue.addr, &end, 10);
|
||||||
if (end != retvalue.addr)
|
if (end != retvalue.addr)
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1118,11 +1118,11 @@ static gboolean read_int(XrmDatabase db, char *rname, int *value)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean read_string(XrmDatabase db, char *rname, char **value)
|
static gboolean read_string(XrmDatabase db, gchar *rname, gchar **value)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
char *rclass = create_class_name(rname);
|
gchar *rclass = create_class_name(rname);
|
||||||
char *rettype;
|
gchar *rettype;
|
||||||
XrmValue retvalue;
|
XrmValue retvalue;
|
||||||
|
|
||||||
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
||||||
|
@ -1139,8 +1139,8 @@ static gboolean read_color(XrmDatabase db, const RrInstance *inst,
|
||||||
gchar *rname, RrColor **value)
|
gchar *rname, RrColor **value)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
char *rclass = create_class_name(rname);
|
gchar *rclass = create_class_name(rname);
|
||||||
char *rettype;
|
gchar *rettype;
|
||||||
XrmValue retvalue;
|
XrmValue retvalue;
|
||||||
|
|
||||||
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
||||||
|
@ -1161,15 +1161,15 @@ static gboolean read_mask(const RrInstance *inst,
|
||||||
RrPixmapMask **value)
|
RrPixmapMask **value)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
char *s;
|
gchar *s;
|
||||||
int hx, hy; /* ignored */
|
gint hx, hy; /* ignored */
|
||||||
unsigned int w, h;
|
guint w, h;
|
||||||
unsigned char *b;
|
guchar *b;
|
||||||
|
|
||||||
s = g_build_filename(theme->path, maskname, NULL);
|
s = g_build_filename(theme->path, maskname, NULL);
|
||||||
if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess) {
|
if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
*value = RrPixmapMaskNew(inst, w, h, (char*)b);
|
*value = RrPixmapMaskNew(inst, w, h, (gchar*)b);
|
||||||
XFree(b);
|
XFree(b);
|
||||||
}
|
}
|
||||||
g_free(s);
|
g_free(s);
|
||||||
|
@ -1182,7 +1182,7 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad,
|
||||||
gboolean *interlaced, gboolean *border,
|
gboolean *interlaced, gboolean *border,
|
||||||
gboolean allow_trans)
|
gboolean allow_trans)
|
||||||
{
|
{
|
||||||
char *t;
|
gchar *t;
|
||||||
|
|
||||||
/* convert to all lowercase */
|
/* convert to all lowercase */
|
||||||
for (t = tex; *t != '\0'; ++t)
|
for (t = tex; *t != '\0'; ++t)
|
||||||
|
@ -1237,9 +1237,9 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst,
|
||||||
gboolean allow_trans)
|
gboolean allow_trans)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
char *rclass = create_class_name(rname);
|
gchar *rclass = create_class_name(rname);
|
||||||
char *cname, *ctoname, *bcname, *icname;
|
gchar *cname, *ctoname, *bcname, *icname;
|
||||||
char *rettype;
|
gchar *rettype;
|
||||||
XrmValue retvalue;
|
XrmValue retvalue;
|
||||||
|
|
||||||
cname = g_strconcat(rname, ".color", NULL);
|
cname = g_strconcat(rname, ".color", NULL);
|
||||||
|
|
Loading…
Reference in a new issue