From: Dana Jansens Date: Wed, 15 Oct 2003 03:59:35 +0000 (+0000) Subject: consistant glib type usage X-Git-Tag: openbox-3_1-RELEASE~57 X-Git-Url: http://git.openbox.org/?p=mikachu%2Fopenbox.git;a=commitdiff_plain;h=740c5b2a20d5110435d0874f8cc6a4c9dfd14777 consistant glib type usage --- diff --git a/openbox/action.c b/openbox/action.c index 5f8b306..483ac8d 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -809,7 +809,7 @@ ObAction *action_from_string(const gchar *name, ObUserAction uact) { ObAction *a = NULL; gboolean exist = FALSE; - int i; + gint i; for (i = 0; actionstrings[i].name; i++) 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, ObUserAction uact) { - char *actname; + gchar *actname; ObAction *act = NULL; xmlNodePtr n; @@ -973,7 +973,7 @@ void action_run_string(const gchar *name, struct _ObClient *c) void action_execute(union ActionData *data) { GError *e = NULL; - char *cmd; + gchar *cmd; if (data->execute.path) { cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL); if (cmd) { @@ -1307,7 +1307,7 @@ void action_toggle_decorations(union ActionData *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 ((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) { - int x, y; + gint x, y; ObClient *c = data->diraction.any.c; x = c->frame->area.x; @@ -1440,7 +1440,7 @@ void action_movetoedge(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; Rect *a; diff --git a/openbox/action.h b/openbox/action.h index 222755f..e0dcd76 100644 --- a/openbox/action.h +++ b/openbox/action.h @@ -68,7 +68,7 @@ struct DirectionalAction{ struct Execute { struct AnyAction any; - char *path; + gchar *path; }; struct ClientAction { @@ -82,7 +82,7 @@ struct Activate { struct MoveResizeRelative { struct AnyAction any; - int delta; + gint delta; }; struct SendToDesktop { @@ -106,7 +106,7 @@ struct Desktop { struct Layer { struct AnyAction any; - int layer; /* < 0 = below, 0 = normal, > 0 = above */ + gint layer; /* < 0 = below, 0 = normal, > 0 = above */ }; struct DesktopDirection { @@ -124,7 +124,7 @@ struct MoveResize { struct ShowMenu { struct AnyAction any; - char *name; + gchar *name; }; struct CycleWindows { diff --git a/openbox/client.c b/openbox/client.c index 78af988..c219d60 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -166,7 +166,7 @@ void client_set_list() void client_manage_all() { - unsigned int i, j, nchild; + guint i, j, nchild; Window w, *children; XWMHints *wmhints; XWindowAttributes attrib; @@ -337,8 +337,8 @@ void client_manage(Window window) } if (ob_state() == OB_STATE_RUNNING) { - int x = self->area.x, ox = x; - int y = self->area.y, oy = y; + gint x = self->area.x, ox = x; + gint y = self->area.y, oy = 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) { - int x = self->area.x; - int y = self->area.y; + gint x = self->area.x; + gint y = self->area.y; if (client_find_onscreen(self, &x, &y, self->frame->area.width, 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) { Rect *a; - int ox = *x, oy = *y; + gint ox = *x, oy = *y; frame_client_gravity(self->frame, x, y); /* get where the frame would be */ @@ -648,8 +648,8 @@ static void client_toggle_border(ObClient *self, gboolean show) different position. when re-adding the border to the client, the same operation needs to be reversed. */ - int oldx = self->area.x, oldy = self->area.y; - int x = oldx, y = oldy; + gint oldx = self->area.x, oldy = self->area.y; + gint x = oldx, y = oldy; switch(self->gravity) { default: case NorthWestGravity: @@ -886,9 +886,9 @@ static void client_get_shaped(ObClient *self) self->shaped = FALSE; #ifdef SHAPE if (extensions_shape) { - int foo; + gint foo; guint ufoo; - int s; + gint s; XShapeSelectInput(ob_display, self->window, ShapeNotifyMask); @@ -1082,8 +1082,8 @@ static void client_get_gravity(ObClient *self) void client_update_normal_hints(ObClient *self) { XSizeHints size; - long ret; - int oldgravity = self->gravity; + glong ret; + gint oldgravity = self->gravity; /* defaults */ self->min_ratio = 0.0f; @@ -1116,9 +1116,11 @@ void client_update_normal_hints(ObClient *self) if (size.flags & PAspect) { 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) - 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) @@ -1266,7 +1268,7 @@ void client_setup_decor_and_functions(ObClient *self) static void client_change_allowed_actions(ObClient *self) { guint32 actions[9]; - int num = 0; + gint num = 0; /* desktop windows are kept on all desktops */ 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 */ if (self->title_count > 1) { - char *ndata; + gchar *ndata; ndata = g_strdup_printf("%s - [%u]", data, self->title_count); g_free(data); data = ndata; @@ -1477,7 +1479,7 @@ void client_update_title(ObClient *self) /* append the title count, dont display the number for the first window */ if (read_title && self->title_count > 1) { - char *vdata, *ndata; + gchar *vdata, *ndata; ndata = g_strdup_printf(" - [%u]", self->title_count); vdata = g_strconcat(data, ndata, NULL); g_free(ndata); @@ -1492,8 +1494,8 @@ void client_update_title(ObClient *self) void client_update_class(ObClient *self) { - char **data; - char *s; + gchar **data; + gchar *s; if (self->name) g_free(self->name); 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, - int x, int y, int w, int h, + gint x, gint y, gint w, gint h, gboolean user, gboolean final, gboolean force_reply) { @@ -1916,7 +1918,7 @@ void client_configure_full(ObClient *self, ObCorner anchor, /* set the size and position if fullscreen */ if (self->fullscreen) { #ifdef VIDMODE - int dot; + gint dot; XF86VidModeModeLine mode; #endif Rect *a; @@ -1978,7 +1980,7 @@ void client_configure_full(ObClient *self, ObCorner anchor, } 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 */ 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 (h * self->min_ratio > w) { - h = (int)(w / self->min_ratio); + h = (gint)(w / self->min_ratio); /* you cannot resize to nothing */ if (h < 1) { h = 1; - w = (int)(h * self->min_ratio); + w = (gint)(h * self->min_ratio); } } if (self->max_ratio) if (h * self->max_ratio < w) { - h = (int)(w / self->max_ratio); + h = (gint)(w / self->max_ratio); /* you cannot resize to nothing */ if (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) { - int x, y, w, h; + gint x, y, w, h; if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) || /* can't */ self->fullscreen == fs) return; /* already done */ @@ -2194,7 +2196,7 @@ static void client_iconify_recursive(ObClient *self, if (iconic) { if (self->functions & OB_CLIENT_FUNC_ICONIFY) { - long old; + glong old; old = self->wmstate; self->wmstate = IconicState; @@ -2210,7 +2212,7 @@ static void client_iconify_recursive(ObClient *self, changed = TRUE; } } else { - long old; + glong old; if (curdesk) client_set_desktop(self, screen_desktop, FALSE); @@ -2256,9 +2258,9 @@ void client_iconify(ObClient *self, gboolean iconic, gboolean 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); 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 */ if (!self->iconic) { - long old; + glong old; old = self->wmstate; self->wmstate = shade ? IconicState : NormalState; @@ -2473,7 +2475,7 @@ gboolean client_validate(ObClient *self) 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 */ @@ -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 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_vert = self->max_vert; gboolean modal = self->modal; - int i; + gint i; if (!(action == prop_atoms.net_wm_state_add || action == prop_atoms.net_wm_state_remove || @@ -2714,7 +2716,7 @@ gboolean client_focus(ObClient *self) #ifdef DEBUG_FOCUS ob_debug("%sively focusing %lx at %d\n", (self->can_focus ? "act" : "pass"), - self->window, (int) event_lasttime); + self->window, (gint) event_lasttime); #endif /* 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; } -static ObClientIcon* client_icon_recursive(ObClient *self, int w, int h) +static ObClientIcon* client_icon_recursive(ObClient *self, gint w, gint h) { guint i; /* si is the smallest 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) { ObClientIcon *parent = NULL; @@ -2822,7 +2824,7 @@ static ObClientIcon* client_icon_recursive(ObClient *self, int w, int h) 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; static ObClientIcon deficon; @@ -2838,10 +2840,10 @@ const ObClientIcon* client_icon(ObClient *self, int w, int h) /* this be mostly ripped from fvwm */ ObClient *client_find_directional(ObClient *c, ObDirection dir) { - int my_cx, my_cy, his_cx, his_cy; - int offset = 0; - int distance = 0; - int score, best_score; + gint my_cx, my_cy, his_cx, his_cy; + gint offset = 0; + gint distance = 0; + gint score, best_score; ObClient *best_client, *cur; GList *it; @@ -2880,7 +2882,7 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir) if(dir == OB_DIRECTION_NORTHEAST || dir == OB_DIRECTION_SOUTHEAST || dir == OB_DIRECTION_SOUTHWEST || dir == OB_DIRECTION_NORTHWEST) { - int tx; + gint tx; /* Rotate the diagonals 45 degrees counterclockwise. * To do this, multiply the matrix /+h +h\ with the * vector (x y). \-h +h/ @@ -2933,7 +2935,7 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir) return best_client; } -void client_set_layer(ObClient *self, int layer) +void client_set_layer(ObClient *self, gint layer) { if (layer < 0) { 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 * client edge. */ -int client_directional_edge_search(ObClient *c, ObDirection dir) +gint client_directional_edge_search(ObClient *c, ObDirection dir) { - int dest; - int my_edge_start, my_edge_end, my_offset; + gint dest; + gint my_edge_start, my_edge_end, my_offset; GList *it; Rect *a; @@ -3103,7 +3105,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir) dest = a->y; 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; if(cur == c) @@ -3144,7 +3146,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir) dest = a->y + a->height; 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; if(cur == c) @@ -3186,7 +3188,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir) dest = a->x; 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; if(cur == c) @@ -3228,7 +3230,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir) dest = a->x + a->width; 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; if(cur == c) @@ -3273,7 +3275,7 @@ int client_directional_edge_search(ObClient *c, ObDirection dir) ObClient* client_under_pointer() { - int x, y; + gint x, y; GList *it; ObClient *ret = NULL; diff --git a/openbox/client.h b/openbox/client.h index aeb2160..5942eb1 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -82,7 +82,7 @@ struct _ObClient struct _ObFrame *frame; /*! 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 */ struct _ObGroup *group; @@ -165,11 +165,11 @@ struct _ObClient /*! The minimum aspect ratio the client window can be sized to. 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. A value of 0 means this is ignored. */ - float max_ratio; + gfloat max_ratio; /*! The minimum size of the client window 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 window */ - int gravity; + gint gravity; /*! The state of the window, one of WithdrawnState, IconicState, or NormalState */ - long wmstate; + glong wmstate; /*! True if the client supports the delete_window protocol */ gboolean delete_window; @@ -333,7 +333,7 @@ gboolean client_focused(ObClient *self); the position changed. */ 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 force_reply); @@ -350,7 +350,7 @@ void client_reconfigure(ObClient *self); struts if possible. @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); /*! 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. @param savearea true to have the client's current size and position saved; otherwise, they are not. You should not save when mapping a - new window that is set to fullscreen. This has no effect - when restoring a window from fullscreen. + new window that is set to fullscreen. This has no effect + when restoring a window from fullscreen. */ void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea); @@ -377,7 +377,7 @@ void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea); restored. @param curdesk If iconic is FALSE, then this determines if the window will 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); @@ -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 savearea true to have the client's current size and position saved; otherwise, they are not. You should not save when mapping a - new window that is set to fullscreen. This has no effect - when unmaximizing a window. + new window that is set to fullscreen. This has no effect + when unmaximizing a window. */ -void client_maximize(ObClient *self, gboolean max, int dir, - gboolean savearea); +void client_maximize(ObClient *self, gboolean max, gint dir, + gboolean savearea); /*! Shades or unshades the client window @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); /*! 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 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 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 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 */ 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 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); /*! 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. @layer < 0 indicates the client should be placed below other clients.
= 0 indicates the client should be placed with 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 */ void client_set_undecorated(ObClient *self, gboolean undecorated); diff --git a/openbox/config.c b/openbox/config.c index b6e7770..507d697 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -31,11 +31,11 @@ guint config_focus_raise; ObPlacePolicy config_place_policy; -char *config_theme; +gchar *config_theme; gchar *config_title_layout; -int config_desktops_num; +gint config_desktops_num; GSList *config_desktops_names; gboolean config_redraw_resize; @@ -75,7 +75,7 @@ gint config_resist_edge; static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, GList *keylist) { - char *key; + gchar *key; ObAction *action; xmlNodePtr n, nact; GList *it; @@ -133,8 +133,8 @@ static void parse_mouse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d) { xmlNodePtr n, nbut, nact; - char *buttonstr; - char *contextstr; + gchar *buttonstr; + gchar *contextstr; ObUserAction uact; ObMouseAction mact; ObAction *action; diff --git a/openbox/config.h b/openbox/config.h index a2cfce3..3754bd6 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -67,13 +67,13 @@ extern guint config_dock_app_move_button; extern guint config_dock_app_move_modifiers; /* The name of the theme */ -extern char *config_theme; +extern gchar *config_theme; /* Titlebar button layout */ extern gchar *config_title_layout; /*! The number of desktops */ -extern int config_desktops_num; +extern gint config_desktops_num; /*! Names for the desktops */ extern GSList *config_desktops_names; diff --git a/openbox/debug.c b/openbox/debug.c index 755fbcd..4152c15 100644 --- a/openbox/debug.c +++ b/openbox/debug.c @@ -28,7 +28,7 @@ void ob_debug_show_output(gboolean enable) show = enable; } -void ob_debug(char *a, ...) +void ob_debug(gchar *a, ...) { va_list vl; diff --git a/openbox/debug.h b/openbox/debug.h index 72a95fd..f7988c2 100644 --- a/openbox/debug.h +++ b/openbox/debug.h @@ -23,6 +23,6 @@ void ob_debug_show_output(gboolean enable); -void ob_debug(char *a, ...); +void ob_debug(gchar *a, ...); #endif diff --git a/openbox/event.c b/openbox/event.c index 1d19a28..8554ce9 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -73,17 +73,17 @@ static gboolean menu_hide_delay_func(gpointer data); Time event_lasttime = 0; /*! The value of the mask for the NumLock modifier */ -unsigned int NumLockMask; +guint NumLockMask; /*! The value of the mask for the ScrollLock modifier */ -unsigned int ScrollLockMask; +guint ScrollLockMask; /*! The key codes for the modifier keys */ static XModifierKeymap *modmap; /*! Table of the constant modifier masks */ -static const int mask_table[] = { +static const gint mask_table[] = { ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; -static int mask_table_size; +static gint mask_table_size; static guint ignore_enter_focus = 0; @@ -92,7 +92,7 @@ static gboolean menu_can_hide; static ObClient *focus_in, *focus_out; #ifdef USE_SM -static void ice_handler(int fd, gpointer conn) +static void ice_handler(gint fd, gpointer conn) { Bool b; IceProcessMessages(conn, NULL, &b); @@ -249,7 +249,7 @@ static void event_set_lasttime(XEvent *e) static void event_hack_mods(XEvent *e) { KeyCode *kp; - int i, k; + gint i, k; switch (e->type) { case ButtonPress: @@ -360,7 +360,7 @@ static void event_done(gpointer data) if (focus_client != last) { if (!focus_client) { Window w; - int r; + gint r; /* is focus anywhere valid? */ XGetInputFocus(ob_display, &w, &r); @@ -498,11 +498,11 @@ static void event_handle_root(XEvent *e) msgtype = e->xclient.message_type; 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) screen_set_desktop(d); } 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) screen_set_num_desktops(d); } else if (msgtype == prop_atoms.net_showing_desktop) { @@ -561,7 +561,7 @@ static void event_handle_client(ObClient *client, XEvent *e) { XEvent ce; Atom msgtype; - int i=0; + gint i=0; ObFrameContext con; switch (e->type) { @@ -746,7 +746,7 @@ static void event_handle_client(ObClient *client, XEvent *e) if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight | CWX | CWY | CWBorderWidth)) { - int x, y, w, h; + gint x, y, w, h; ObCorner corner; 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; { - int newx = x; - int newy = y; - int fw = w + - client->frame->size.left + client->frame->size.right; - int fh = h + - client->frame->size.top + client->frame->size.bottom; + gint newx = x; + gint newy = y; + gint fw = w + + client->frame->size.left + client->frame->size.right; + gint fh = h + + client->frame->size.top + client->frame->size.bottom; client_find_onscreen(client, &newx, &newy, fw, fh, client_normal(client)); if (e->xconfigurerequest.value_mask & CWX) @@ -930,8 +930,8 @@ static void event_handle_client(ObClient *client, XEvent *e) e->xclient.data.l[2]); } } else if (msgtype == prop_atoms.net_moveresize_window) { - int oldg = client->gravity; - int tmpg, x, y, w, h; + gint oldg = client->gravity; + gint tmpg, x, y, w, h; if (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; { - int newx = x; - int newy = y; - int fw = w + - client->frame->size.left + client->frame->size.right; - int fh = h + - client->frame->size.top + client->frame->size.bottom; + gint newx = x; + gint newy = y; + gint fw = w + + client->frame->size.left + client->frame->size.right; + gint fh = h + + client->frame->size.top + client->frame->size.bottom; client_find_onscreen(client, &newx, &newy, fw, fh, client_normal(client)); if (e->xclient.data.l[0] & 1 << 8) diff --git a/openbox/extensions.c b/openbox/extensions.c index 2050239..3ee3928 100644 --- a/openbox/extensions.c +++ b/openbox/extensions.c @@ -22,19 +22,19 @@ See the COPYING file for a copy of the GNU General Public License. #include "screen.h" gboolean extensions_xkb = FALSE; -int extensions_xkb_event_basep; +gint extensions_xkb_event_basep; gboolean extensions_shape = FALSE; -int extensions_shape_event_basep; +gint extensions_shape_event_basep; gboolean extensions_xinerama = FALSE; -int extensions_xinerama_event_basep; +gint extensions_xinerama_event_basep; gboolean extensions_randr = FALSE; -int extensions_randr_event_basep; +gint extensions_randr_event_basep; gboolean extensions_vidmode = FALSE; -int extensions_vidmode_event_basep; +gint extensions_vidmode_event_basep; void extensions_query_all() { - int junk; + gint junk; (void)junk; #ifdef XKB diff --git a/openbox/extensions.h b/openbox/extensions.h index cc13ecb..f430e80 100644 --- a/openbox/extensions.h +++ b/openbox/extensions.h @@ -44,27 +44,27 @@ /*! Does the display have the XKB extension? */ extern gboolean extensions_xkb; /*! 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? */ extern gboolean extensions_shape; /*! 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? */ extern gboolean extensions_xinerama; /*! 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? */ extern gboolean extensions_randr; /*! 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? */ extern gboolean extensions_vidmode; /*! Base for events for the VidMode extension */ -extern int extensions_vidmode_event_basep; +extern gint extensions_vidmode_event_basep; void extensions_query_all(); diff --git a/openbox/focus.c b/openbox/focus.c index 04d4d31..ff1386b 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -60,7 +60,7 @@ static void focus_cycle_destructor(ObClient *client, gpointer data) focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE); } -static Window createWindow(Window parent, unsigned long mask, +static Window createWindow(Window parent, gulong mask, XSetWindowAttributes *attrib) { 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 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; ObClient *ret; @@ -332,7 +333,7 @@ static void popup_cycle(ObClient *c, gboolean show) } else { Rect *a; ObClient *p = c; - char *title; + gchar *title; a = screen_physical_area_monitor(0); 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, TRUE); */ - int x, y, w, h; - int wt, wl, wr, wb; + gint x, y, w, h; + gint wt, wl, wr, wb; wt = wl = wr = wb = MAX(3, ob_rr_theme->handle_height + diff --git a/openbox/frame.c b/openbox/frame.c index 40c15e0..5d7ec6c 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -46,7 +46,7 @@ static gboolean flash_timeout(gpointer data); static void set_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) { 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() { XSetWindowAttributes attrib; - unsigned long mask; + gulong mask; ObFrame *self; self = g_new0(ObFrame, 1); @@ -215,7 +215,7 @@ void frame_adjust_theme(ObFrame *self) void frame_adjust_shape(ObFrame *self) { #ifdef SHAPE - int num; + gint num; XRectangle xrect[2]; if (!self->client->shaped) { @@ -552,8 +552,8 @@ void frame_release_client(ObFrame *self, ObClient *client) static void layout_title(ObFrame *self) { - char *lc; - int x; + gchar *lc; + gint x; gboolean n, d, i, l, m, c, s; n = d = i = l = m = c = s = FALSE; @@ -755,7 +755,7 @@ ObFrameContext frame_context(ObClient *client, Window win) 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 */ 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 */ switch (self->client->gravity) { diff --git a/openbox/frame.h b/openbox/frame.h index f77ff35..d50a2b7 100644 --- a/openbox/frame.h +++ b/openbox/frame.h @@ -163,13 +163,13 @@ ObFrameContext frame_context(struct _ObClient *self, Window win); be positioned. @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 should be positioned. @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_stop(ObFrame *self); diff --git a/openbox/framerender.c b/openbox/framerender.c index a19b4ec..7356a38 100644 --- a/openbox/framerender.c +++ b/openbox/framerender.c @@ -34,7 +34,7 @@ static void framerender_close(ObFrame *self, RrAppearance *a); void framerender_frame(ObFrame *self) { { - unsigned long px; + gulong px; px = (self->focused ? RrColorPixel(ob_rr_theme->cb_focused_color) : diff --git a/openbox/grab.c b/openbox/grab.c index e2784a2..91f7915 100644 --- a/openbox/grab.c +++ b/openbox/grab.c @@ -31,7 +31,7 @@ #define MASK_LIST_SIZE 8 /*! 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 pgrabs = 0; @@ -158,7 +158,7 @@ void grab_shutdown(gboolean reconfig) } void grab_button_full(guint button, guint state, Window win, guint mask, - int pointer_mode, ObCursor cur) + gint pointer_mode, ObCursor cur) { guint i; @@ -185,7 +185,7 @@ void ungrab_button(guint button, guint state, Window 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; diff --git a/openbox/grab.h b/openbox/grab.h index a84f082..ca645ca 100644 --- a/openbox/grab.h +++ b/openbox/grab.h @@ -37,10 +37,10 @@ gboolean grab_on_pointer(); void grab_button(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 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); diff --git a/openbox/mainloop.c b/openbox/mainloop.c index 3f9381f..0dd3b6b 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -565,9 +565,9 @@ void ob_main_loop_fd_remove(ObMainLoop *loop, #define NEAREST_TIMEOUT(loop) \ (((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; return b->tv_usec - a->tv_usec; diff --git a/openbox/menuframe.c b/openbox/menuframe.c index fcdb47f..03e6162 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -42,7 +42,7 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self); static void menu_frame_render(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) { return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0, diff --git a/openbox/mouse.c b/openbox/mouse.c index 414be04..8456079 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -89,7 +89,7 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context, void mouse_grab_for_client(ObClient *client, gboolean grab) { - int i; + gint i; GSList *it; 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 */ ObMouseBinding *b = it->data; Window win; - int mode; - unsigned int mask; + gint mode; + guint mask; if (FRAME_CONTEXT(i, client)) { win = client->frame->window; @@ -130,13 +130,13 @@ static void grab_all_clients(gboolean grab) void mouse_unbind_all() { - int i; + gint i; GSList *it; for(i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) { for (it = bound_contexts[i]; it != NULL; it = it->next) { ObMouseBinding *b = it->data; - int j; + gint j; for (j = 0; j < OB_NUM_MOUSE_ACTIONS; ++j) { GSList *it; @@ -154,7 +154,7 @@ void mouse_unbind_all() static gboolean fire_binding(ObMouseAction a, ObFrameContext context, ObClient *c, guint state, - guint button, int x, int y) + guint button, gint x, gint y) { GSList *it; ObMouseBinding *b; @@ -176,7 +176,7 @@ void mouse_event(ObClient *client, XEvent *e) static Time ltime; static guint button = 0, state = 0, lbutton = 0; static Window lwindow = None; - static int px, py; + static gint px, py; ObFrameContext context; gboolean click = FALSE; @@ -210,7 +210,7 @@ void mouse_event(ObClient *client, XEvent *e) if (e->xbutton.button == button) { /* clicks are only valid if its released over the window */ - int junk1, junk2; + gint junk1, junk2; Window wjunk; guint ujunk, b, w, h; /* this can cause errors to occur when the window closes */ diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 9f0f41b..2344e86 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -38,8 +38,8 @@ ObClient *moveresize_client = NULL; static gboolean moving = FALSE; /* TRUE - moving, FALSE - resizing */ -static int start_x, start_y, start_cx, start_cy, start_cw, start_ch; -static int cur_x, cur_y; +static gint start_x, start_y, start_cx, start_cy, start_cw, start_ch; +static gint cur_x, cur_y; static guint button; static guint32 corner; static ObCorner lockcorner; @@ -72,9 +72,9 @@ void moveresize_shutdown(gboolean reconfig) 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); popup_position(popup, CenterGravity, @@ -86,7 +86,7 @@ static void popup_coords(ObClient *c, char *format, int a, int b) 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; @@ -297,7 +297,7 @@ void moveresize_event(XEvent *e) moveresize_end(FALSE); else { 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)) dx = MAX(4, moveresize_client->size_inc.width); @@ -329,8 +329,8 @@ void moveresize_event(XEvent *e) start_x += dx - (cur_x - ox); start_y += dy - (cur_y - oy); } else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) { - int dx = 0, dy = 0, ox = cur_x, oy = cur_y; - int opx, px, opy, py; + gint dx = 0, dy = 0, ox = cur_x, oy = cur_y; + gint opx, px, opy, py; if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT)) dx = 4; diff --git a/openbox/moveresize.h b/openbox/moveresize.h index 20980cf..67ab08c 100644 --- a/openbox/moveresize.h +++ b/openbox/moveresize.h @@ -30,7 +30,7 @@ void moveresize_startup(gboolean reconfig); void moveresize_shutdown(gboolean reconfig); 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_event(XEvent *e); diff --git a/openbox/openbox.c b/openbox/openbox.c index c0aa9a0..7c68e2a 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -76,15 +76,15 @@ static ObState state; static gboolean xsync; static gboolean reconfigure; static gboolean restart; -static char *restart_path; +static gchar *restart_path; static Cursor cursors[OB_NUM_CURSORS]; static KeyCode keys[OB_NUM_KEYS]; static gint exitcode = 0; -static void signal_handler(int signal, gpointer data); -static void parse_args(int argc, char **argv); +static void signal_handler(gint signal, gpointer data); +static void parse_args(gint argc, gchar **argv); -int main(int argc, char **argv) +gint main(gint argc, gchar **argv) { #ifdef DEBUG ob_debug_show_output(TRUE); @@ -300,8 +300,8 @@ int main(int argc, char **argv) if (restart) { if (restart_path != NULL) { - int argcp; - char **argvp; + gint argcp; + gchar **argvp; GError *err = NULL; /* run other shit */ @@ -322,7 +322,7 @@ int main(int argc, char **argv) return exitcode; } -static void signal_handler(int signal, gpointer data) +static void signal_handler(gint signal, gpointer data) { if (signal == SIGUSR1) { 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); } -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) { if (!strcmp(argv[i], "--version")) { diff --git a/openbox/place.c b/openbox/place.c index e563374..e440648 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -59,7 +59,7 @@ static Rect* pick_head(ObClient *c) static gboolean place_random(ObClient *client, gint *x, gint *y) { - int l, r, t, b; + gint l, r, t, b; Rect *area; area = pick_head(client); @@ -345,7 +345,7 @@ static gboolean place_transient(ObClient *client, gint *x, gint *y) } else { GSList *it; gboolean first = TRUE; - int l, r, t, b; + gint l, r, t, b; for (it = client->group->members; it; it = it->next) { ObClient *m = it->data; if (!(m == client || m->transient_for)) { diff --git a/openbox/prop.c b/openbox/prop.c index 25495ef..69fa4b8 100644 --- a/openbox/prop.c +++ b/openbox/prop.c @@ -158,16 +158,16 @@ void prop_startup() #include /* 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) { gboolean ret = FALSE; - int res; + gint res; guchar *xdata = NULL; Atom ret_type; - int ret_size; + gint ret_size; 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, 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) { gboolean ret = FALSE; - int res; + gint res; guchar *xdata = NULL; Atom ret_type; - int ret_size; + gint ret_size; 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, FALSE, type, &ret_type, &ret_size, @@ -221,14 +221,14 @@ static gboolean get_prealloc(Window win, Atom prop, Atom type, int size, 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) { gboolean ret = FALSE; - int res; + gint res; guchar *xdata = NULL; Atom ret_type; - int ret_size; + gint ret_size; gulong ret_items, bytes_left; 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; } -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; 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); } -gboolean prop_get_string_locale(Window win, Atom prop, char **ret) +gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret) { - char **list; - int nstr; - char *s; + gchar **list; + gint nstr; + gchar *s; if (get_stringlist(win, prop, &list, &nstr) && nstr) { 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; } -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; - char *raw, *p; + gchar *raw, *p; guint num, i, count = 0; 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 */ } - *ret = g_new0(char*, count + 1); + *ret = g_new0(gchar*, count + 1); (*ret)[count] = NULL; /* null terminated list */ 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; } -gboolean prop_get_string_utf8(Window win, Atom prop, char **ret) +gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret) { - char *raw; - char *str; + gchar *raw; + gchar *str; guint 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; } -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; - char *raw, *p; + gchar *raw, *p; guint num, i, count = 0; 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 */ } - *ret = g_new0(char*, count + 1); + *ret = g_new0(gchar*, count + 1); for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) { 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); } -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, 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; - char **s; + gchar **s; str = g_string_sized_new(0); for (s = strs; *s; ++s) { @@ -422,8 +422,8 @@ void prop_erase(Window win, Atom prop) XDeleteProperty(ob_display, win, prop); } -void prop_message(Window about, Atom messagetype, long data0, long data1, - long data2, long data3, long mask) +void prop_message(Window about, Atom messagetype, glong data0, glong data1, + glong data2, glong data3, glong mask) { XEvent ce; ce.xclient.type = ClientMessage; diff --git a/openbox/prop.h b/openbox/prop.h index cce3dd1..ca603d6 100644 --- a/openbox/prop.h +++ b/openbox/prop.h @@ -172,21 +172,21 @@ void prop_startup(); gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret); gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret, guint *nret); -gboolean prop_get_string_locale(Window win, Atom prop, char **ret); -gboolean prop_get_string_utf8(Window win, Atom prop, char **ret); -gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret); -gboolean prop_get_strings_utf8(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, gchar **ret); +gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***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_set_array32(Window win, Atom prop, Atom type, guint32 *val, guint num); -void prop_set_string_utf8(Window win, Atom prop, char *val); -void prop_set_strings_utf8(Window win, Atom prop, char **strs); +void prop_set_string_utf8(Window win, Atom prop, gchar *val); +void prop_set_strings_utf8(Window win, Atom prop, gchar **strs); void prop_erase(Window win, Atom prop); -void prop_message(Window about, Atom messagetype, long data0, long data1, - long data2, long data3, long mask); +void prop_message(Window about, Atom messagetype, glong data0, glong data1, + glong data2, glong data3, glong mask); #define PROP_GET32(win, prop, type, ret) \ (prop_get32(win, prop_atoms.prop, prop_atoms.type, ret)) diff --git a/openbox/resist.c b/openbox/resist.c index 5f3ab9b..f34877a 100644 --- a/openbox/resist.c +++ b/openbox/resist.c @@ -49,7 +49,7 @@ void resist_move_windows(ObClient *c, gint *x, gint *y) if (config_resist_win) for (it = stacking_list; it != NULL; it = it->next) { 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)) continue; diff --git a/openbox/screen.c b/openbox/screen.c index a9a4dd0..b0fc5c2 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -54,7 +54,7 @@ guint screen_last_desktop; Size screen_physical_size; gboolean screen_showing_desktop; DesktopLayout screen_desktop_layout; -char **screen_desktop_names; +gchar **screen_desktop_names; Window screen_support_win; static Rect **area; /* array of desktop holding array of xinerama areas */ @@ -64,7 +64,7 @@ static ObPagerPopup *desktop_cycle_popup; static gboolean replace_wm() { - char *wm_sn; + gchar *wm_sn; Atom wm_sn_atom; Window current_wm_sn_owner; Time timestamp; @@ -281,7 +281,7 @@ void screen_startup(gboolean reconfig) screen_resize(); /* set the names */ - screen_desktop_names = g_new(char*, + screen_desktop_names = g_new(gchar*, g_slist_length(config_desktops_names) + 1); for (i = 0, it = config_desktops_names; it; ++i, it = it->next) screen_desktop_names[i] = it->data; /* dont strdup */ @@ -336,8 +336,8 @@ void screen_shutdown(gboolean reconfig) void screen_resize() { - static int oldw = 0, oldh = 0; - int w, h; + static gint oldw = 0, oldh = 0; + gint w, h; GList *it; guint32 geometry[2]; @@ -850,7 +850,7 @@ void screen_update_desktop_names() else i = 0; 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_desktop_names[screen_num_desktops] = NULL; for (; i < screen_num_desktops; ++i) @@ -1190,10 +1190,10 @@ void screen_set_root_cursor() ob_cursor(OB_CURSOR_POINTER)); } -gboolean screen_pointer_pos(int *x, int *y) +gboolean screen_pointer_pos(gint *x, gint *y) { Window w; - int i; + gint i; guint u; return !!XQueryPointer(ob_display, RootWindow(ob_display, ob_screen), diff --git a/openbox/screen.h b/openbox/screen.h index 151ecb9..5e9b567 100644 --- a/openbox/screen.h +++ b/openbox/screen.h @@ -48,7 +48,7 @@ typedef struct DesktopLayout { extern DesktopLayout screen_desktop_layout; /*! 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 */ 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. */ void screen_set_root_cursor(); -gboolean screen_pointer_pos(int *x, int *y); +gboolean screen_pointer_pos(gint *x, gint *y); #endif diff --git a/openbox/session.c b/openbox/session.c index 9b94065..8be44e3 100644 --- a/openbox/session.c +++ b/openbox/session.c @@ -25,7 +25,7 @@ GList *session_saved_state; -void session_startup(int *argc, char ***argv) {} +void session_startup(gint *argc, gchar ***argv) {} void session_shutdown() {} GList* session_state_find(ObClient *c) { return NULL; } 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_sessions_path; -static void session_load(char *path); +static void session_load(gchar *path); static gboolean session_save(); -static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type, - Bool shutdown, int interact_style, Bool fast); +static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type, + Bool shutdown, gint interact_style, Bool fast); static void sm_die(SmcConn conn, SmPointer data); static void sm_save_complete(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); } -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) (*argv)[i] = (*argv)[i+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) { 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 SmcCallbacks cb; - char sm_err[SM_ERR_LEN]; + gchar sm_err[SM_ERR_LEN]; parse_args(argc, argv); @@ -217,7 +217,7 @@ void session_startup(int *argc, char ***argv) val_hint.value = &hint; val_hint.length = 1; - sprintf(pid, "%ld", (long)getpid()); + sprintf(pid, "%ld", (glong)getpid()); val_pid.value = pid; val_pid.length = strlen(pid); @@ -289,8 +289,8 @@ static void sm_save_yourself_phase2(SmcConn conn, SmPointer data) SmcSaveYourselfDone(conn, success); } -static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type, - Bool shutdown, int interact_style, Bool fast) +static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type, + Bool shutdown, gint interact_style, Bool fast) { if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_phase2, data)) { ob_debug("SAVE YOURSELF PHASE 2 failed\n"); @@ -320,8 +320,8 @@ static gboolean session_save() /* this algo is from metacity */ filename = g_strdup_printf("%d-%d-%u.obs", - (int) time(NULL), - (int) getpid(), + (gint) time(NULL), + (gint) getpid(), g_random_int()); save_file = g_build_filename(sm_sessions_path, filename, NULL); g_free(filename); @@ -468,7 +468,7 @@ static gint stack_sort(const ObSessionState *s1, const ObSessionState *s2) return s1->stacking - s2->stacking; } -static void session_load(char *path) +static void session_load(gchar *path) { xmlDocPtr doc; xmlNodePtr node, n; diff --git a/openbox/session.h b/openbox/session.h index 41ba67b..680f45f 100644 --- a/openbox/session.h +++ b/openbox/session.h @@ -38,7 +38,7 @@ struct _ObSessionState { extern GList *session_saved_state; -void session_startup(int *argc, char ***argv); +void session_startup(gint *argc, gchar ***argv); void session_shutdown(); GList* session_state_find(struct _ObClient *c); diff --git a/openbox/stacking.c b/openbox/stacking.c index 287de4f..279ea2e 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -58,7 +58,7 @@ static void do_restack(GList *wins, GList *before) { GList *it, *next; Window *win; - int i; + gint i; #ifdef DEBUG /* pls only restack stuff in the same layer at a time */ @@ -106,7 +106,7 @@ static void do_raise(GList *wins) { GList *it; GList *layer[OB_NUM_STACKING_LAYERS] = {NULL}; - int i; + gint i; for (it = wins; it; it = g_list_next(it)) { ObStackingLayer l; @@ -133,7 +133,7 @@ static void do_lower(GList *wins) { GList *it; GList *layer[OB_NUM_STACKING_LAYERS] = {NULL}; - int i; + gint i; for (it = wins; it; it = g_list_next(it)) { ObStackingLayer l; @@ -161,7 +161,7 @@ static GList *pick_windows(ObClient *top, ObClient *selected, gboolean raise) GList *ret = NULL; GList *it, *next, *prev; GSList *sit; - int i, n; + gint i, n; GList *modals = NULL; GList *trans = NULL; 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 *it, *next, *prev; GSList *sit; - int i, n; + gint i, n; /* add group members in their stacking order */ if (top->group) { diff --git a/openbox/translate.c b/openbox/translate.c index 11a88f6..312d329 100644 --- a/openbox/translate.c +++ b/openbox/translate.c @@ -22,7 +22,7 @@ #include #include -static guint translate_modifier(char *str) +static guint translate_modifier(gchar *str) { if (!g_ascii_strcasecmp("Mod1", str) || !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) { - char **parsed; - char *l; - int i; + gchar **parsed; + gchar *l; + gint i; gboolean ret = FALSE; parsed = g_strsplit(str, "-", -1); @@ -84,9 +84,9 @@ translation_fail: gboolean translate_key(const gchar *str, guint *state, guint *keycode) { - char **parsed; - char *l; - int i; + gchar **parsed; + gchar *l; + gint i; gboolean ret = FALSE; KeySym sym; diff --git a/openbox/xerror.c b/openbox/xerror.c index 3f11250..12a66af 100644 --- a/openbox/xerror.c +++ b/openbox/xerror.c @@ -23,12 +23,12 @@ static gboolean xerror_ignore = FALSE; gboolean xerror_occured = FALSE; -int xerror_handler(Display *d, XErrorEvent *e) +gint xerror_handler(Display *d, XErrorEvent *e) { xerror_occured = TRUE; #ifdef DEBUG if (!xerror_ignore) { - char errtxt[128]; + gchar errtxt[128]; /*if (e->error_code != BadWindow) */ { diff --git a/openbox/xerror.h b/openbox/xerror.h index c9c902c..29573b0 100644 --- a/openbox/xerror.h +++ b/openbox/xerror.h @@ -25,7 +25,7 @@ /* can be used to track errors */ extern gboolean xerror_occured; -int xerror_handler(Display *, XErrorEvent *); +gint xerror_handler(Display *, XErrorEvent *); void xerror_set_ignore(gboolean ignore); diff --git a/parser/parse.c b/parser/parse.c index de7bba6..2076bad 100644 --- a/parser/parse.c +++ b/parser/parse.c @@ -29,7 +29,7 @@ static GSList *xdg_config_dir_paths; static GSList *xdg_data_dir_paths; struct Callback { - char *tag; + gchar *tag; ParseCallback func; 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) { struct Callback *c; @@ -113,7 +113,7 @@ gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root) return r; } -gboolean parse_load(const char *path, const char *rootname, +gboolean parse_load(const gchar *path, const gchar *rootname, xmlDocPtr *doc, xmlNodePtr *root) { if ((*doc = xmlParseFile(path))) { @@ -136,7 +136,7 @@ gboolean parse_load(const char *path, const char *rootname, 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) { 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); - char *s = g_strdup(c ? (char*)c : ""); + gchar *s = g_strdup(c ? (gchar*)c : ""); xmlFree(c); return s; } -int parse_int(xmlDocPtr doc, xmlNodePtr node) +gint parse_int(xmlDocPtr doc, xmlNodePtr node) { xmlChar *c = xmlNodeListGetString(doc, node->children, TRUE); - int i = atoi((char*)c); + gint i = atoi((gchar*)c); xmlFree(c); return i; } @@ -206,7 +206,7 @@ gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node) 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); gboolean r; @@ -215,7 +215,7 @@ gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node) return r; } -xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node) +xmlNodePtr parse_find_node(const gchar *tag, xmlNodePtr node) { while (node) { if (!xmlStrcasecmp(node->name, (const xmlChar*) tag)) @@ -225,32 +225,32 @@ xmlNodePtr parse_find_node(const char *tag, xmlNodePtr node) 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); gboolean r = FALSE; if (c) { - *value = atoi((char*)c); + *value = atoi((gchar*)c); r = TRUE; } xmlFree(c); 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); gboolean r = FALSE; if (c) { - *value = g_strdup((char*)c); + *value = g_strdup((gchar*)c); r = TRUE; } xmlFree(c); return r; } -gboolean parse_attr_contains(const char *val, xmlNodePtr node, - const char *name) +gboolean parse_attr_contains(const gchar *val, xmlNodePtr node, + const gchar *name) { xmlChar *c = xmlGetProp(node, (const xmlChar*) name); gboolean r; diff --git a/parser/parse.h b/parser/parse.h index 6717deb..886b867 100644 --- a/parser/parse.h +++ b/parser/parse.h @@ -37,34 +37,34 @@ gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root); /* Loads an Openbox menu, from the normal paths */ 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); void parse_tree(ObParseInst *inst, xmlDocPtr doc, xmlNodePtr node); /* open/close */ -gboolean parse_load(const char *path, const char *rootname, +gboolean parse_load(const gchar *path, const gchar *rootname, 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); void parse_close(xmlDocPtr doc); /* 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); -int parse_int(xmlDocPtr doc, xmlNodePtr node); +gchar *parse_string(xmlDocPtr doc, xmlNodePtr node); +gint parse_int(xmlDocPtr doc, xmlNodePtr node); gboolean parse_bool(xmlDocPtr doc, xmlNodePtr node); -gboolean parse_contains(const char *val, xmlDocPtr doc, xmlNodePtr node); -gboolean parse_attr_contains(const char *val, xmlNodePtr node, - const char *name); +gboolean parse_contains(const gchar *val, xmlDocPtr doc, xmlNodePtr node); +gboolean parse_attr_contains(const gchar *val, xmlNodePtr node, + const gchar *name); -gboolean parse_attr_string(const char *name, xmlNodePtr node, char **value); -gboolean parse_attr_int(const char *name, xmlNodePtr node, int *value); +gboolean parse_attr_string(const gchar *name, xmlNodePtr node, gchar **value); +gboolean parse_attr_int(const gchar *name, xmlNodePtr node, gint *value); /* paths */ diff --git a/render/color.c b/render/color.c index 485b3d6..491dc47 100644 --- a/render/color.c +++ b/render/color.c @@ -114,11 +114,11 @@ void RrColorFree(RrColor *c) void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) { - int r, g, b; - int x,y; + gint r, g, b; + gint x,y; RrPixel32 *p32 = (RrPixel32 *) im->data; RrPixel16 *p16 = (RrPixel16 *) im->data; - unsigned char *p8 = (unsigned char *)im->data; + guchar *p8 = (guchar *)im->data; switch (im->bits_per_pixel) { case 32: if ((RrRedOffset(inst) != RrDefaultRedOffset) || @@ -136,7 +136,7 @@ void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) data += im->width; p32 += im->width; } - } else im->data = (char*) data; + } else im->data = (gchar*) data; break; case 16: 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) { - int x, y, di; + gint x, y, di; di = 0; for (y = 0; y < im->height; ++y) { for (x = 0; x < im->height; ++x) { - char *c = &im->data[di + x * im->bits_per_pixel / 8]; - char t; + gchar *c = &im->data[di + x * im->bits_per_pixel / 8]; + gchar t; switch (im->bits_per_pixel) { case 32: @@ -220,11 +220,11 @@ static void swap_byte_order(XImage *im) void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) { - int r, g, b; - int x,y; + gint r, g, b; + gint x,y; RrPixel32 *p32 = (RrPixel32 *) im->data; RrPixel16 *p16 = (RrPixel16 *) im->data; - unsigned char *p8 = (unsigned char *)im->data; + guchar *p8 = (guchar *)im->data; if (im->byte_order != LSBFirst) 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; } -int RrColorGreen(const RrColor *c) +gint RrColorGreen(const RrColor *c) { return c->g; } -int RrColorBlue(const RrColor *c) +gint RrColorBlue(const RrColor *c) { return c->b; } diff --git a/render/color.h b/render/color.h index d620f8a..703fc3e 100644 --- a/render/color.h +++ b/render/color.h @@ -29,10 +29,10 @@ struct _RrColor { const RrInstance *inst; - int r; - int g; - int b; - unsigned long pixel; + gint r; + gint g; + gint b; + gulong pixel; GC gc; gint key; diff --git a/render/font.c b/render/font.c index 155b373..ce74cad 100644 --- a/render/font.c +++ b/render/font.c @@ -63,7 +63,7 @@ static void measure_font(RrFont *f) f->elipses_length = (signed) info.xOff; } -static RrFont *openfont(const RrInstance *inst, char *fontstring) +static RrFont *openfont(const RrInstance *inst, gchar *fontstring) { RrFont *out; FcPattern *pat, *match; @@ -108,7 +108,7 @@ static RrFont *openfont(const RrInstance *inst, char *fontstring) return out; } -RrFont *RrFontOpen(const RrInstance *inst, char *fontstring) +RrFont *RrFontOpen(const RrInstance *inst, gchar *fontstring) { 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); } -int RrFontMeasureString(const RrFont *f, const gchar *str) +gint RrFontMeasureString(const RrFont *f, const gchar *str) { gint x, y; font_measure_full (f, str, &x, &y); return x + 4; } -int RrFontHeight(const RrFont *f) +gint RrFontHeight(const RrFont *f) { return f->xftfont->ascent + f->xftfont->descent + (f->shadow ? f->offset : 0); } -int RrFontMaxCharWidth(const RrFont *f) +gint RrFontMaxCharWidth(const RrFont *f) { return (signed) f->xftfont->max_advance_width; } diff --git a/render/font.h b/render/font.h index ab52b45..6f8d511 100644 --- a/render/font.h +++ b/render/font.h @@ -31,7 +31,7 @@ struct _RrFont { gint offset; }; -RrFont *RrFontOpen(const RrInstance *inst, char *fontstring); +RrFont *RrFontOpen(const RrInstance *inst, gchar *fontstring); void RrFontClose(RrFont *f); void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *position); #endif /* __font_h */ diff --git a/render/gradient.c b/render/gradient.c index fa54fbb..53f7e25 100644 --- a/render/gradient.c +++ b/render/gradient.c @@ -23,19 +23,19 @@ #include static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised); -static void gradient_solid(RrAppearance *l, int w, int h); -static void gradient_vertical(RrSurface *sf, int w, int h); -static void gradient_horizontal(RrSurface *sf, int w, int h); -static void gradient_diagonal(RrSurface *sf, int w, int h); -static void gradient_crossdiagonal(RrSurface *sf, int w, int h); -static void gradient_pyramid(RrSurface *sf, int inw, int inh); - -void RrRender(RrAppearance *a, int w, int h) +static void gradient_solid(RrAppearance *l, gint w, gint h); +static void gradient_vertical(RrSurface *sf, gint w, gint h); +static void gradient_horizontal(RrSurface *sf, gint w, gint h); +static void gradient_diagonal(RrSurface *sf, gint w, gint h); +static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h); +static void gradient_pyramid(RrSurface *sf, gint inw, gint inh); + +void RrRender(RrAppearance *a, gint w, gint h) { RrPixel32 *data = a->surface.pixel_data; RrPixel32 current; - unsigned int r,g,b; - int off, x; + guint r,g,b; + gint off, x; switch (a->surface.grad) { case RR_SURFACE_SOLID: @@ -62,7 +62,7 @@ void RrRender(RrAppearance *a, int w, int h) } if (a->surface.interlaced) { - int i; + gint i; RrPixel32 *p; 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) { - int r, g, b; + gint r, g, b; RrPixel32 *up, *down; if (raised) { @@ -155,7 +155,7 @@ static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised) static void create_bevel_colors(RrAppearance *l) { - int r, g, b; + gint r, g, b; /* light color */ 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); } -static void gradient_solid(RrAppearance *l, int w, int h) +static void gradient_solid(RrAppearance *l, gint w, gint h) { RrPixel32 pix; - int i, a, b; + gint i, a, b; 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) + (sp->primary->g << RrDefaultGreenOffset) @@ -285,8 +285,8 @@ static void gradient_solid(RrAppearance *l, int w, int h) /* * * * * * * * * * * * * * GRADIENT MAGIC WOOT * * * * * * * * * * * * * * */ #define VARS(x) \ - unsigned int color##x[3]; \ - int len##x, cdelta##x[3], error##x[3] = { 0, 0, 0 }, inc##x[3]; \ + guint color##x[3]; \ + gint len##x, cdelta##x[3], error##x[3] = { 0, 0, 0 }, inc##x[3]; \ gboolean bigslope##x[3] /* color slope > 1 */ #define SETUP(x, from, to, w) \ @@ -334,7 +334,7 @@ static void gradient_solid(RrAppearance *l, int w, int h) #define NEXT(x) \ { \ - int i; \ + gint i; \ for (i = 2; i >= 0; --i) { \ 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 current; @@ -384,9 +384,9 @@ static void gradient_horizontal(RrSurface *sf, int w, int h) *(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 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; RrColor left, right; RrColor extracorner; @@ -453,9 +453,9 @@ static void gradient_diagonal(RrSurface *sf, int w, int h) *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; RrColor left, right; RrColor extracorner; @@ -500,9 +500,9 @@ static void gradient_crossdiagonal(RrSurface *sf, int w, int h) *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 *end = data + inw*inh - 1; RrPixel32 current; diff --git a/render/gradient.h b/render/gradient.h index 875f5e1..50a22c5 100644 --- a/render/gradient.h +++ b/render/gradient.h @@ -22,6 +22,6 @@ #include "render.h" -void RrRender(RrAppearance *a, int w, int h); +void RrRender(RrAppearance *a, gint w, gint h); #endif /* __gradient_h */ diff --git a/render/image.c b/render/image.c index 09d94f1..10aa9b1 100644 --- a/render/image.c +++ b/render/image.c @@ -133,10 +133,10 @@ void RrImageDraw(RrPixel32 *target, RrTextureRGBA *rgba, /* keep the ratio */ dw = area->width; - dh = (int)(dw * ((double)sh / sw)); + dh = (gint)(dw * ((gdouble)sh / sw)); if (dh > area->height) { dh = area->height; - dw = (int)(dh * ((double)sw / sh)); + dw = (gint)(dh * ((gdouble)sw / sh)); } if (sw != dw || sh != dh) { diff --git a/render/instance.c b/render/instance.c index f4a2441..ca58451 100644 --- a/render/instance.c +++ b/render/instance.c @@ -44,11 +44,11 @@ dest(gpointer data) static void f(gpointer key, gpointer value, gpointer n) { RrColor *c = value; - if (c->id == *(int*)n) + if (c->id == *(gint*)n) 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); } @@ -89,7 +89,7 @@ RrInstance* RrInstanceNew (Display *display, gint screen) void RrTrueColorSetup (RrInstance *inst) { - unsigned long red_mask, green_mask, blue_mask; + gulong red_mask, green_mask, blue_mask; XImage *timage = NULL; timage = XCreateImage(inst->display, inst->visual, inst->depth, @@ -120,9 +120,9 @@ void RrTrueColorSetup (RrInstance *inst) void RrPseudoColorSetup (RrInstance *inst) { XColor icolors[256]; - int tr, tg, tb, n, r, g, b, i, incolors, ii; - unsigned long dev; - int cpc, _ncolors; + gint tr, tg, tb, n, r, g, b, i, incolors, ii; + gulong dev; + gint cpc, _ncolors; /* determine the number of colors and the bits-per-color */ 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 (g = 0; g < cpc; g++) for (b = 0; b < cpc; b++, n++) { - tr = (int)(((float)(r)/(float)(cpc-1)) * 0xFF); - tg = (int)(((float)(g)/(float)(cpc-1)) * 0xFF); - tb = (int)(((float)(b)/(float)(cpc-1)) * 0xFF); + tr = (gint)(((gfloat)(r)/(gfloat)(cpc-1)) * 0xFF); + tg = (gint)(((gfloat)(g)/(gfloat)(cpc-1)) * 0xFF); + tb = (gint)(((gfloat)(b)/(gfloat)(cpc-1)) * 0xFF); inst->pseudo_colors[n].red = tr | tr << 8; inst->pseudo_colors[n].green = tg | tg << 8; inst->pseudo_colors[n].blue = tb | tb << 8; @@ -171,7 +171,7 @@ void RrPseudoColorSetup (RrInstance *inst) /* try match unallocated ones */ for (i = 0; i < _ncolors; i++) { 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++) { /* find deviations */ r = (inst->pseudo_colors[i].red - icolors[ii].red) & 0xff; diff --git a/render/mask.c b/render/mask.c index 3144aff..11e589b 100644 --- a/render/mask.c +++ b/render/mask.c @@ -46,7 +46,7 @@ void RrPixmapMaskFree(RrPixmapMask *m) void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const RrRect *area) { - int x, y; + gint x, y; if (m->mask == None) return; /* no mask given */ /* set the clip region */ diff --git a/render/render.c b/render/render.c index 3fb4965..cb29165 100644 --- a/render/render.c +++ b/render/render.c @@ -39,7 +39,7 @@ static void pixel_data_to_pixmap(RrAppearance *l, void RrPaint(RrAppearance *a, Window win, gint w, gint h) { - int i, transferred = 0, sw; + gint i, transferred = 0, sw; RrPixel32 *source, *dest; Pixmap oldp; 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 */ scratch = g_new(RrPixel32, im->width * im->height); - im->data = (char*) scratch; + im->data = (gchar*) scratch; RrReduceDepth(l->inst, in, im); XPutImage(RrDisplay(l->inst), out, DefaultGC(RrDisplay(l->inst), RrScreen(l->inst)), diff --git a/render/render.h b/render/render.h index df81daf..3e76ed8 100644 --- a/render/render.h +++ b/render/render.h @@ -200,9 +200,9 @@ RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex); RrAppearance *RrAppearanceCopy (RrAppearance *a); void RrAppearanceFree (RrAppearance *a); -int RrFontMeasureString (const RrFont *f, const gchar *str); -int RrFontHeight (const RrFont *f); -int RrFontMaxCharWidth (const RrFont *f); +gint RrFontMeasureString (const RrFont *f, const gchar *str); +gint RrFontHeight (const RrFont *f); +gint RrFontMaxCharWidth (const RrFont *f); void RrPaint (RrAppearance *a, Window win, gint w, gint h); void RrMinsize (RrAppearance *a, gint *w, gint *h); diff --git a/render/test.c b/render/test.c index 2c5d75e..b50053c 100644 --- a/render/test.c +++ b/render/test.c @@ -26,19 +26,19 @@ #include "render.h" #include -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); printf("%s\n", buf); return 0; } Display *ob_display; -int ob_screen; +gint ob_screen; Window ob_root; -int main() +gint main() { Window win; RrInstance *inst; @@ -46,7 +46,7 @@ int main() Window root; XEvent report; - int h = 500, w = 500; + gint h = 500, w = 500; ob_display = XOpenDisplay(NULL); XSetErrorHandler(x_error_handler); diff --git a/render/theme.c b/render/theme.c index 8ad64a7..bb6a123 100644 --- a/render/theme.c +++ b/render/theme.c @@ -30,9 +30,9 @@ #include #include -static XrmDatabase loaddb(RrTheme *theme, char *name); -static gboolean read_int(XrmDatabase db, char *rname, int *value); -static gboolean read_string(XrmDatabase db, char *rname, char **value); +static XrmDatabase loaddb(RrTheme *theme, gchar *name); +static gboolean read_int(XrmDatabase db, gchar *rname, gint *value); +static gboolean read_string(XrmDatabase db, gchar *rname, gchar **value); static gboolean read_color(XrmDatabase db, const RrInstance *inst, gchar *rname, RrColor **value); static gboolean read_mask(const RrInstance *inst, @@ -303,11 +303,11 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) } else { { 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 }; - 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_disabled_mask = RrPixmapMaskCopy(theme->max_mask); @@ -332,7 +332,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) } else { { 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_disabled_mask = RrPixmapMaskCopy(theme->iconify_mask); @@ -364,12 +364,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) } else { { 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 }; theme->desk_toggled_mask = RrPixmapMaskNew(inst, 7, 7, - (char*)data); + (gchar*)data); } theme->desk_pressed_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 { { 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 }; theme->shade_toggled_mask = RrPixmapMaskNew(inst, 7, 7, - (char*)data); + (gchar*)data); } theme->shade_pressed_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 { { 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_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)) { 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 */ @@ -1045,7 +1045,7 @@ void RrThemeFree(RrTheme *theme) } } -static XrmDatabase loaddb(RrTheme *theme, char *name) +static XrmDatabase loaddb(RrTheme *theme, gchar *name) { GSList *it; XrmDatabase db = NULL; @@ -1085,10 +1085,10 @@ static XrmDatabase loaddb(RrTheme *theme, char *name) return db; } -static char *create_class_name(char *rname) +static gchar *create_class_name(gchar *rname) { - char *rclass = g_strdup(rname); - char *p = rclass; + gchar *rclass = g_strdup(rname); + gchar *p = rclass; while (TRUE) { *p = toupper(*p); @@ -1100,16 +1100,16 @@ static char *create_class_name(char *rname) 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; - char *rclass = create_class_name(rname); - char *rettype, *end; + gchar *rclass = create_class_name(rname); + gchar *rettype, *end; XrmValue retvalue; if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { - *value = (int)strtol(retvalue.addr, &end, 10); + *value = (gint)strtol(retvalue.addr, &end, 10); if (end != retvalue.addr) ret = TRUE; } @@ -1118,11 +1118,11 @@ static gboolean read_int(XrmDatabase db, char *rname, int *value) 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; - char *rclass = create_class_name(rname); - char *rettype; + gchar *rclass = create_class_name(rname); + gchar *rettype; XrmValue 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) { gboolean ret = FALSE; - char *rclass = create_class_name(rname); - char *rettype; + gchar *rclass = create_class_name(rname); + gchar *rettype; XrmValue retvalue; if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && @@ -1161,15 +1161,15 @@ static gboolean read_mask(const RrInstance *inst, RrPixmapMask **value) { gboolean ret = FALSE; - char *s; - int hx, hy; /* ignored */ - unsigned int w, h; - unsigned char *b; + gchar *s; + gint hx, hy; /* ignored */ + guint w, h; + guchar *b; s = g_build_filename(theme->path, maskname, NULL); if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess) { ret = TRUE; - *value = RrPixmapMaskNew(inst, w, h, (char*)b); + *value = RrPixmapMaskNew(inst, w, h, (gchar*)b); XFree(b); } g_free(s); @@ -1182,7 +1182,7 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad, gboolean *interlaced, gboolean *border, gboolean allow_trans) { - char *t; + gchar *t; /* convert to all lowercase */ for (t = tex; *t != '\0'; ++t) @@ -1237,9 +1237,9 @@ static gboolean read_appearance(XrmDatabase db, const RrInstance *inst, gboolean allow_trans) { gboolean ret = FALSE; - char *rclass = create_class_name(rname); - char *cname, *ctoname, *bcname, *icname; - char *rettype; + gchar *rclass = create_class_name(rname); + gchar *cname, *ctoname, *bcname, *icname; + gchar *rettype; XrmValue retvalue; cname = g_strconcat(rname, ".color", NULL);