* lwlib/lwlib-Xaw.c: Include <ctype.h> for isdigit.
(fill_xft_data, set_text): Remove unused variable screen.
(draw_text): Cast bp to FcChar8*.
(find_xft_data): Return 0 if inst or xft_data is not set.
(wm_delete_window): Correct prototype. Initialize widget to 0
and return if widget is still 0 after loop.
* lwlib/xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
(display_menu_item): Remove unused variable gi.
(make_windows_if_needed): Remove unused variable screen.
(XlwMenuRedisplay): Remove unused variable i.
* src/gtkutil.c (xg_get_pixbuf_from_pix_and_mask)
(xg_get_image_for_pixmap, create_dialog)
(xg_get_file_with_selection, xg_get_file_name, update_cl_data)
(menuitem_highlight_callback, make_menu_item)
(xg_create_one_menuitem, create_menus, xg_update_menu_item)
(xg_create_scroll_bar, xg_update_scrollbar_pos)
(xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb)
(xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback)
(xg_tool_bar_attach_callback, xg_tool_bar_help_callback)
(xg_tool_bar_item_expose_callback): Reformat prototype.
(xg_update_menubar): GList *group => GSList *group.
(xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0
before use.
(update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed
to GTK_IMAGE (wimage).
* src/xsettings.c (something_changedCB, parse_settings)
(apply_xft_settings): Reformat prototype.
(something_changedCB, init_gconf): Remove unused variable i.
(read_settings): Remove unused variable long_len.
* src/xsmfns.c (SSDATA): New macro.
(smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings
passed to strlen/strcpy/strcat.
(create_client_leader_window): Surround with #ifndef USE_GTK. Cast
7:th arg to XChangeProperty to (unsigned char *)
+2010-07-05 Jan Djärv <jan.h.d@swipnet.se>
+
+ * xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
+ (display_menu_item): Remove unused variable gi.
+ (make_windows_if_needed): Remove unused variable screen.
+ (XlwMenuRedisplay): Remove unused variable i.
+
+ * lwlib-Xaw.c: Include <ctype.h> for isdigit.
+ (fill_xft_data, set_text): Remove unused variable screen.
+ (draw_text): Cast bp to FcChar8*.
+ (find_xft_data): Return 0 if inst or xft_data is not set.
+ (wm_delete_window): Correct prototype. Initialize widget to 0
+ and return if widget is still 0 after loop.
+
2010-07-04 Dan Nicolaescu <dann@ics.uci.edu>
* lwlib-Xaw.c: Convert function definitions to standard C.
#include <stdio.h>
#include <setjmp.h>
+#include <ctype.h>
#include "../src/lisp.h"
{
Pixel bg, fg;
XColor colors[2];
- int screen = XScreenNumberOfScreen (XtScreen (widget));
data->widget = widget;
data->xft_font = font;
char *cp = strchr (bp, '\n');
XftDrawStringUtf8 (data->xft_draw,
inverse ? &data->xft_bg : &data->xft_fg,
- data->xft_font, x, y, bp, cp ? cp - bp : strlen (bp));
+ data->xft_font, x, y,
+ (FcChar8 *) bp,
+ cp ? cp - bp : strlen (bp));
bp = cp ? cp + 1 : NULL;
/* 1.2 gives reasonable line spacing. */
y += data->xft_font->height * 1.2;
static void
set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin)
{
- int screen = XScreenNumberOfScreen (XtScreen (data->widget));
int width, height;
width = get_text_width_and_height (data->widget, lbl, data->xft_font,
inst = lw_get_widget_instance (parent);
parent = XtParent (parent);
}
- if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return;
+ if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0;
for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr)
{
/* Dialogs pop down on any key press */
static char dialogOverride[] =
"<KeyPress>Escape: lwlib_delete_dialog()";
-static void wm_delete_window(Widget w, XtPointer closure, XtPointer call_data);
+static void wm_delete_window (Widget w,
+ XEvent *event,
+ String *params,
+ Cardinal *num_params);
static XtActionsRec xaw_actions [] = {
{"lwlib_delete_dialog", wm_delete_window}
};
}
static void
-wm_delete_window (Widget w, XtPointer closure, XtPointer call_data)
+wm_delete_window (Widget w,
+ XEvent *event,
+ String *params,
+ Cardinal *num_params)
{
LWLIB_ID id;
Cardinal nkids;
int i;
Widget *kids = 0;
- Widget widget, shell;
+ Widget widget = 0, shell;
if (XtIsSubclass (w, dialogWidgetClass))
shell = XtParent (w);
if (XtIsSubclass (widget, dialogWidgetClass))
break;
}
+ if (! widget) return;
+
id = lw_get_widget_id (widget);
if (! id) abort ();
};
#undef offset
-static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new);
+static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new,
+ ArgList args, Cardinal *num_args);
static void XlwMenuRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes);
static void XlwMenuResize(Widget w);
-static void XlwMenuInitialize(Widget request, XlwMenuWidget mw, ArgList args, Cardinal *num_args);
+static void XlwMenuInitialize(Widget request, Widget mw, ArgList args, Cardinal *num_args);
static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region);
static void XlwMenuDestroy(Widget w);
static void XlwMenuClassInitialize(void);
#ifdef HAVE_XFT
if (ws->xft_draw)
{
- XGlyphInfo gi;
int draw_x = ws->width - ws->max_rest_width
+ mw->menu.arrow_spacing;
int draw_y = y + v_spacing + shadow + font_ascent;
int i;
int start_at;
window_state* windows;
-#ifdef HAVE_XFT
- int screen = XScreenNumberOfScreen (mw->core.screen);
-#endif
if (mw->menu.windows_length >= n)
return;
#endif
static void
-XlwMenuInitialize (Widget request, XlwMenuWidget mw, ArgList args, Cardinal *num_args)
+XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
{
/* Get the GCs and the widget size */
-
+ XlwMenuWidget mw = (XlwMenuWidget) w;
Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
Display* display = XtDisplay (mw);
XlwMenuRedisplay (Widget w, XEvent *ev, Region region)
{
XlwMenuWidget mw = (XlwMenuWidget)w;
- int i;
/* If we have a depth beyond 1, it's because a submenu was displayed.
If the submenu has been destroyed, set the depth back to 1. */
#endif
static Boolean
-XlwMenuSetValues (Widget current, Widget request, Widget new)
+XlwMenuSetValues (Widget current, Widget request, Widget new,
+ ArgList args, Cardinal *num_args)
{
XlwMenuWidget oldmw = (XlwMenuWidget)current;
XlwMenuWidget newmw = (XlwMenuWidget)new;
+2010-07-05 Jan Djärv <jan.h.d@swipnet.se>
+
+ * xsmfns.c (SSDATA): New macro.
+ (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings
+ passed to strlen/strcpy/strcat.
+ (create_client_leader_window): Surround with #ifndef USE_GTK. Cast
+ 7:th arg to XChangeProperty to (unsigned char *)
+
+ * xsettings.c (something_changedCB, parse_settings)
+ (apply_xft_settings): Reformat prototype.
+ (something_changedCB, init_gconf): Remove unused variable i.
+ (read_settings): Remove unused variable long_len.
+
+ * gtkutil.c (xg_get_pixbuf_from_pix_and_mask)
+ (xg_get_image_for_pixmap, create_dialog)
+ (xg_get_file_with_selection, xg_get_file_name, update_cl_data)
+ (menuitem_highlight_callback, make_menu_item)
+ (xg_create_one_menuitem, create_menus, xg_update_menu_item)
+ (xg_create_scroll_bar, xg_update_scrollbar_pos)
+ (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb)
+ (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback)
+ (xg_tool_bar_attach_callback, xg_tool_bar_help_callback)
+ (xg_tool_bar_item_expose_callback): Reformat prototype.
+ (xg_update_menubar): GList *group => GSList *group.
+ (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0
+ before use.
+ (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed
+ to GTK_IMAGE (wimage).
+
2010-07-05 Dan Nicolaescu <dann@ics.uci.edu>
* atimer.c: Use "" instead of <> for local includes for
/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
static GdkPixbuf *
-xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, GdkPixmap *gmask, GdkColormap *cmap)
+xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix,
+ GdkPixmap *gmask,
+ GdkColormap *cmap)
{
int width, height;
GdkPixbuf *icon_buf, *tmp_buf;
If OLD_WIDGET is not NULL, that widget is modified. */
static GtkWidget *
-xg_get_image_for_pixmap (FRAME_PTR f, struct image *img, GtkWidget *widget, GtkImage *old_widget)
+xg_get_image_for_pixmap (FRAME_PTR f,
+ struct image *img,
+ GtkWidget *widget,
+ GtkImage *old_widget)
{
GdkPixmap *gpix;
GdkPixmap *gmask;
Returns the GTK dialog widget. */
static GtkWidget *
-create_dialog (widget_value *wv, GCallback select_cb, GCallback deactivate_cb)
+create_dialog (widget_value *wv,
+ GCallback select_cb,
+ GCallback deactivate_cb)
{
char *title = get_dialog_title (wv->name[0]);
int total_buttons = wv->name[1] - '0';
Returns the created widget. */
static GtkWidget *
-xg_get_file_with_selection (
- FRAME_PTR f,
- char *prompt,
- char *default_filename,
- int mustmatch_p, int only_dir_p,
- xg_get_file_func *func)
+xg_get_file_with_selection (FRAME_PTR f,
+ char *prompt,
+ char *default_filename,
+ int mustmatch_p, int only_dir_p,
+ xg_get_file_func *func)
{
GtkWidget *filewin;
GtkFileSelection *filesel;
The returned string must be freed by the caller. */
char *
-xg_get_file_name (FRAME_PTR f, char *prompt, char *default_filename, int mustmatch_p, int only_dir_p)
+xg_get_file_name (FRAME_PTR f,
+ char *prompt,
+ char *default_filename,
+ int mustmatch_p,
+ int only_dir_p)
{
GtkWidget *w = 0;
char *fn = 0;
creating the menu bar. */
static void
-update_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
+update_cl_data (xg_menu_cb_data *cl_data,
+ FRAME_PTR f,
+ GCallback highlight_cb)
{
if (cl_data)
{
Returns FALSE to tell GTK to keep processing this event. */
static gboolean
-menuitem_highlight_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data)
+menuitem_highlight_callback (GtkWidget *w,
+ GdkEventCrossing *event,
+ gpointer client_data)
{
GdkEvent ev;
GtkWidget *subwidget;
but the MacOS X version doesn't either, so I guess that is OK. */
static GtkWidget *
-make_menu_item (char *utf8_label, char *utf8_key, widget_value *item, GSList **group)
+make_menu_item (char *utf8_label,
+ char *utf8_key,
+ widget_value *item,
+ GSList **group)
{
GtkWidget *w;
GtkWidget *wtoadd = 0;
Returns the created GtkWidget. */
static GtkWidget *
-xg_create_one_menuitem (widget_value *item, FRAME_PTR f, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data, GSList **group)
+xg_create_one_menuitem (widget_value *item,
+ FRAME_PTR f,
+ GCallback select_cb,
+ GCallback highlight_cb,
+ xg_menu_cb_data *cl_data,
+ GSList **group)
{
char *utf8_label;
char *utf8_key;
return w;
}
-static GtkWidget *create_menus (widget_value *, FRAME_PTR, GCallback,
- GCallback, GCallback, int, int, int,
- GtkWidget *, xg_menu_cb_data *, char *);
-
/* Create a full menu tree specified by DATA.
F is the frame the created menu belongs to.
SELECT_CB is the callback to use when a menu item is selected.
This function calls itself to create submenus. */
static GtkWidget *
-create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
- pop_up_p, menu_bar_p, add_tearoff_p, topmenu, cl_data, name)
- widget_value *data;
- FRAME_PTR f;
- GCallback select_cb;
- GCallback deactivate_cb;
- GCallback highlight_cb;
- int pop_up_p;
- int menu_bar_p;
- int add_tearoff_p;
- GtkWidget *topmenu;
- xg_menu_cb_data *cl_data;
- char *name;
+create_menus (widget_value *data,
+ FRAME_PTR f,
+ GCallback select_cb,
+ GCallback deactivate_cb,
+ GCallback highlight_cb,
+ int pop_up_p,
+ int menu_bar_p,
+ int add_tearoff_p,
+ GtkWidget *topmenu,
+ xg_menu_cb_data *cl_data,
+ char *name)
{
widget_value *item;
GtkWidget *wmenu = topmenu;
Insert X. */
int nr = pos;
- GList *group = 0;
+ GSList *group = 0;
GtkWidget *w = xg_create_one_menuitem (val,
f,
select_cb,
CL_DATA is the data to set in the widget for menu invocation. */
static void
-xg_update_menu_item (widget_value *val, GtkWidget *w, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data)
+xg_update_menu_item (widget_value *val,
+ GtkWidget *w,
+ GCallback select_cb,
+ GCallback highlight_cb,
+ xg_menu_cb_data *cl_data)
{
GtkWidget *wchild;
GtkLabel *wlbl = 0;
GList *iter;
GtkWidget *sub = 0;
GtkWidget *newsub;
- GtkMenuItem *witem;
+ GtkMenuItem *witem = 0;
/* Find sub menu that corresponds to val and update it. */
for (iter = list ; iter; iter = g_list_next (iter))
/* sub may still be NULL. If we just updated non deep and added
a new menu bar item, it has no sub menu yet. So we set the
newly created sub menu under witem. */
- if (newsub != sub)
+ if (newsub != sub && witem != 0)
{
xg_set_screen (newsub, f);
gtk_menu_item_set_submenu (witem, newsub);
to set resources for the widget. */
void
-xg_create_scroll_bar (FRAME_PTR f, struct scroll_bar *bar, GCallback scroll_callback, GCallback end_callback, char *scroll_bar_name)
+xg_create_scroll_bar (FRAME_PTR f,
+ struct scroll_bar *bar,
+ GCallback scroll_callback,
+ GCallback end_callback,
+ char *scroll_bar_name)
{
GtkWidget *wscroll;
GtkWidget *webox;
WIDTH, HEIGHT is the size in pixels the bar shall have. */
void
-xg_update_scrollbar_pos (FRAME_PTR f, int scrollbar_id, int top, int left, int width, int height)
+xg_update_scrollbar_pos (FRAME_PTR f,
+ int scrollbar_id,
+ int top,
+ int left,
+ int width,
+ int height)
{
GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
displaying PORTION out of a whole WHOLE, and our position POSITION. */
void
-xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole)
+xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
+ int portion,
+ int position,
+ int whole)
{
GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
tool bar. 0 is the first button. */
static gboolean
-xg_tool_bar_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+xg_tool_bar_button_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
{
/* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */
gpointer ptr = (gpointer) (EMACS_INT) event->state;
the detached tool bar when the detached tool bar it is not expanded. */
static gboolean
-xg_tool_bar_proxy_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data)
+xg_tool_bar_proxy_help_callback (GtkWidget *w,
+ GdkEventCrossing *event,
+ gpointer client_data)
{
GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
XG_TOOL_BAR_PROXY_BUTTON));
CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
static void
-xg_tool_bar_detach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data)
+xg_tool_bar_detach_callback (GtkHandleBox *wbox,
+ GtkWidget *w,
+ gpointer client_data)
{
FRAME_PTR f = (FRAME_PTR) client_data;
extern int x_gtk_whole_detached_tool_bar;
CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
static void
-xg_tool_bar_attach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data)
+xg_tool_bar_attach_callback (GtkHandleBox *wbox,
+ GtkWidget *w,
+ gpointer client_data)
{
FRAME_PTR f = (FRAME_PTR) client_data;
g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
Returns FALSE to tell GTK to keep processing this event. */
static gboolean
-xg_tool_bar_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data)
+xg_tool_bar_help_callback (GtkWidget *w,
+ GdkEventCrossing *event,
+ gpointer client_data)
{
/* The EMACS_INT cast avoids a warning. */
int idx = (int) (EMACS_INT) client_data;
Returns FALSE to tell GTK to keep processing this event. */
static gboolean
-xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, gpointer client_data)
+xg_tool_bar_item_expose_callback (GtkWidget *w,
+ GdkEventExpose *event,
+ gpointer client_data)
{
gint width, height;
GtkWidget *wbutton = NULL;
GtkWidget *weventbox;
Lisp_Object specified_file;
- Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL);
char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL));
ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
}
else if (img && old_img != img->pixmap)
{
- (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
+ (void) xg_get_image_for_pixmap (f, img, x->widget,
+ GTK_IMAGE (wimage));
g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
(gpointer)img->pixmap);
that is SYSTEM_MONO_FONT. */
static void
-something_changedCB (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+something_changedCB (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
GConfValue *v = gconf_entry_get_value (entry);
if (v->type == GCONF_VALUE_STRING)
{
const char *value = gconf_value_get_string (v);
- int i;
if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0)
return; /* No change. */
*/
static int
-parse_settings (unsigned char *prop, long unsigned int bytes, struct xsettings *settings)
+parse_settings (unsigned char *prop,
+ long unsigned int bytes,
+ struct xsettings *settings)
{
Lisp_Object byteorder = Fbyteorder ();
int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst;
static int
read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
{
- long long_len;
Atom act_type;
int act_form;
unsigned long nitems, bytes_after;
static void
-apply_xft_settings (struct x_display_info *dpyinfo, int send_event_p, struct xsettings *settings)
+apply_xft_settings (struct x_display_info *dpyinfo,
+ int send_event_p,
+ struct xsettings *settings)
{
#ifdef HAVE_XFT
FcPattern *pat;
init_gconf (void)
{
#if defined (HAVE_GCONF) && defined (HAVE_XFT)
- int i;
char *s;
g_type_init ();
#include "termopts.h"
#include "xterm.h"
+/* Avoid "differ in sign" warnings */
+#define SSDATA(x) ((char *) SDATA (x))
+
/* The user login name. */
extern Lisp_Object Vuser_login_name;
props[props_idx]->type = SmARRAY8;
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
- props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name));
+ props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
++props_idx;
props[props_idx]->type = SmARRAY8;
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
- props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name));
+ props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
++props_idx;
/* Create the client leader window. */
+#ifndef USE_GTK
static void
create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
{
sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False);
XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace,
- client_id, strlen (client_id));
+ (unsigned char *)client_id, strlen (client_id));
dpyinfo->client_leader_window = w;
}
+#endif /* ! USE_GTK */
+
/* Try to open a connection to the session manager. */
/* Check if we where started by the session manager. If so, we will
have a previous id. */
if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
- previous_id = SDATA (Vx_session_previous_id);
+ previous_id = SSDATA (Vx_session_previous_id);
/* Construct the path to the Emacs program. */
if (! EQ (Vinvocation_directory, Qnil))
- name_len += strlen (SDATA (Vinvocation_directory));
- name_len += strlen (SDATA (Vinvocation_name));
+ name_len += strlen (SSDATA (Vinvocation_directory));
+ name_len += strlen (SSDATA (Vinvocation_name));
/* This malloc will not be freed, but it is only done once, and hopefully
not very large */
emacs_program[0] = '\0';
if (! EQ (Vinvocation_directory, Qnil))
- strcpy (emacs_program, SDATA (Vinvocation_directory));
- strcat (emacs_program, SDATA (Vinvocation_name));
+ strcpy (emacs_program, SSDATA (Vinvocation_directory));
+ strcat (emacs_program, SSDATA (Vinvocation_name));
/* The SM protocol says all callbacks are mandatory, so set up all
here and in the mask passed to SmcOpenConnection. */