summaryrefslogtreecommitdiff
path: root/src/gtkutil.c
Commit message (Collapse)AuthorAgeFilesLines
* * gtkutil.c (xg_make_tool_item): Add callbacks of one of wimage orJan Djärv2011-11-041-5/+5
| | | | | | | | label is not null. (xg_tool_item_stale_p): Handle the fact that wimage and/or wlbl may be NULL. Fixes: debbugs:9951
* * gtkutil.c (xg_win_to_widget, xg_event_is_for_menubar): InitializeJan Djärv2011-10-301-0/+2
| | | | | | type to GDK_NOTHING so valgrind does not complain. Fixes: debbugs:9901
* Whitespace changes.Juanma Barranquero2011-09-091-1/+1
|
* (xg_make_tool_item): Insert comment about eventbox.Jan Djärv2011-09-071-0/+1
|
* * font.c, gtkutil.c: Include <float.h>.Paul Eggert2011-08-291-0/+1
|
* * gtkutil.c (xg_check_special_colors, xg_set_geometry):Paul Eggert2011-08-291-2/+2
| | | | Make sprintf buffers a bit bigger, to avoid potential buffer overrun.
* Merge from trunk.Paul Eggert2011-08-041-6/+6
|\
| * Check for pthread and use it if found.Jan Djärv2011-08-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | * configure.in (HAVE_PTHREAD): Add check for -lpthread. (HAVE_GTK_AND_PTHREAD): Remove. * src/Makefile.in (LIB_PTHREAD): New variable. (LIBES): Add LIB_PTHREAD (Bug#9216). * src/alloc.c, src/emacs.c, src/gmalloc.c, src/gtkutil.c, src/keyboard.c, src/syssignal.h: Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216).
* | Adjust in response to jan.h.d's comments.Paul Eggert2011-08-041-5/+3
| | | | | | | | See, for example <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#26>.
* | * gtkutil.c: Integer overflow fixes.Paul Eggert2011-07-281-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (get_utf8_string, xg_store_widget_in_map): Check for size-calculation overflow. (get_utf8_string): Use ptrdiff_t, not size_t, where either will do, as we prefer signed integers. (id_to_widget.max_size, id_to_widget.used) (xg_store_widget_in_map, xg_remove_widget_from_map) (xg_get_widget_from_map, xg_get_scroll_id_for_window) (xg_remove_scroll_bar, xg_update_scrollbar_pos): Use and return ptrdiff_t, not int. (xg_gtk_scroll_destroy): Don't assume ptrdiff_t fits in int. * gtkutil.h: Change prototypes to match the above.
* | Overflow, signedness and related fixes for images.Paul Eggert2011-07-161-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dispextern.h (struct it.stack[0].u.image.image_id) (struct_it.image_id, struct image.id, struct image_cache.size) (struct image_cache.used, struct image_cache.ref_count): * gtkutil.c (update_frame_tool_bar): * image.c (x_reference_bitmap, Fimage_size, Fimage_mask_p) (Fimage_metadata, free_image_cache, clear_image_cache, lookup_image) (cache_image, mark_image_cache, x_kill_gs_process, Flookup_image): * nsmenu.m (update_frame_tool_bar): * xdisp.c (calc_pixel_width_or_height): * xfns.c (image_cache_refcount): Image IDs are now ptrdiff_t, not int, to avoid arbitrary limits on typical 64-bit hosts. * image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros. (x_bitmap_pixmap, x_create_x_image_and_pixmap): Omit unnecessary casts to int. (parse_image_spec): Check that integers fall into 'int' range when the callers expect that. (image_ascent): Redo ascent calculation to avoid int overflow. (clear_image_cache): Avoid overflow when sqrt (INT_MAX) < nimages. (lookup_image): Remove unnecessary tests. (xbm_image_p): Locals are now of int, not EMACS_INT, since parse_image_check makes sure they fit into int. (png_load, gif_load, svg_load_image): Prefer int to unsigned where either will do. (tiff_handler): New function, combining the cores of the old tiff_error_handler and tiff_warning_handler. This function is rewritten to use vsnprintf and thereby avoid stack buffer overflows. It uses only the features of vsnprintf that are common to both POSIX and native Microsoft. (tiff_error_handler, tiff_warning_handler): Use it. (tiff_load, gif_load, imagemagick_load_image): Don't assume :index value fits in 'int'. (gif_load): Omit unnecessary cast to double, and avoid double-rounding. (imagemagick_load_image): Check that crop parameters fit into the integer types that MagickCropImage accepts. Don't assume Vimagemagick_render_type has a nonnegative value. Don't assume size_t fits in 'long'. (gs_load): Use printmax_t to print the widest integers possible. Check for integer overflow when computing image height and width.
* * gtkutil.c: Omit integer casts.Paul Eggert2011-07-131-3/+3
| | | | | (xg_get_pixbuf_from_pixmap): Remove unnecessary cast. (xg_set_toolkit_scroll_bar_thumb): Rewrite to avoid need for cast.
* Fix minor problems found by static checking.Paul Eggert2011-07-081-1/+0
| | | | | | | | * chartab.c (char_table_set_range, map_sub_char_table) (uniprop_table_uncompress): Remove unused locals. (uniprop_table): Now static. * composite.c (_work_char): Remove unused static var. * gtkutil.c (qttip_cb): Remove stray no-effect statement.
* Better fix that keeps corret margins in tooltip.Jan Djärv2011-07-081-3/+17
| | | | | | | | * gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget. (xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was wrong. Fixes: debbugs:8591
* Don't let Gtk+ linewrap tooltips.Jan Djärv2011-07-081-5/+6
| | | | | | | | * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment. Put text in x->ttip_lbl instead of gtk_tooltip_set_text. (xg_hide_tooltip): Fix comment. Fixes: debbugs:8591
* Fix wm_size-hints race between KDE/KWin and Gtk+ 3.Jan Djärv2011-06-261-14/+2
| | | | | | | | | | | | | | | | | | | | | | | * emacsgtkfixed.c: State that this is only used with Gtk+3. (_EmacsFixedPrivate): Remove minwidth/height. Add struct frame *f. (emacs_fixed_init): Initialize priv->f. (get_parent_class, emacs_fixed_set_min_size): Remove. (emacs_fixed_new): Set priv->f to argument. (emacs_fixed_get_preferred_width) (emacs_fixed_get_preferred_height): Use min_width/height from frames size_hint to set minimum and natural. (XSetWMSizeHints, XSetWMNormalHints): Override these functions and use min_width/height from frames size_hint to set min_width/height (Bug#8919). * emacsgtkfixed.h: State that this is only used with Gtk+3. (emacs_fixed_set_min_size): Remove. (emacs_fixed_new): Take frame as argument. * gtkutil.c (xg_create_frame_widgets): Pass f to emacs_fixed_new. (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size. Fix indentation.
* * gtkutil.c (style_changed_cb): Avoid need for strlen.Paul Eggert2011-06-191-2/+2
|
* Fix resize and change of scroll bar width for Gtk3.Jan Djärv2011-06-141-10/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | * configure.in: Add emacsgtkfixed.o to GTK_OBJ if HAVE_GTK3. * src/emacsgtkfixed.c, src/emacsgtkfixed.h: New files. * src/gtkutil.c: Include src/emacsgtkfixed.h if HAVE_GTK3. (int_gtk_range_get_value): Move to the scroll bar part of the file. (style_changed_cb): Call update_theme_scrollbar_width and call x_set_scroll_bar_default_width and xg_frame_set_char_size for all frames. (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505). Call gtk_window_set_resizable if HAVE_GTK3. (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width and height if HAVE_GTK3 (Bug#8505). (scroll_bar_width_for_theme): New variable. (update_theme_scrollbar_width): New function. (xg_get_default_scrollbar_width): Move code to update_theme_scrollbar_width, just return scroll_bar_width_for_theme. (xg_initialize): Call update_theme_scrollbar_width. * src/gtkutil.h (xg_get_default_scrollbar_width): Remove argument. * src/xfns.c (x_set_scroll_bar_default_width): Remove argument to xg_get_default_scrollbar_width.
* * src/gtkutil.c (xg_get_default_scrollbar_width): Avoid warning.Andreas Schwab2011-06-061-4/+8
|
* Handle scroll bar width larger than 16 for GTK3.Jan Djärv2011-06-051-0/+15
| | | | | | | | | | | * gtkutil.c (xg_get_default_scrollbar_width): New function. * gtkutil.h: Declare xg_get_default_scrollbar_width. * xfns.c (x_set_scroll_bar_default_width): If USE_GTK, get min width by calling x_set_scroll_bar_default_width. Fixes: debbugs:8505
* * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.Paul Eggert2011-04-291-7/+7
| | | | (EMACS_UINTPTR): Likewise, with uintptr_t.
* Prefer intptr_t/uintptr_t for integers the same widths as pointers.Paul Eggert2011-04-291-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes an assumption that EMACS_INT and long are the same width as pointers. The assumption is true for Emacs porting targets now, but we want to make other targets possible. * lisp.h: Include <inttypes.h>, for INTPTR_MAX, UINTPTR_MAX. (EMACS_INTPTR, EMACS_UINTPTR): New macros. In the rest of the code, change types of integers that hold casted pointers to EMACS_INTPTR and EMACS_UINTPTR, systematically replacing EMACS_INT, long, EMACS_UINT, and unsigned long. (XTYPE): Don't cast arg to EMACS_UINT; normally is not needed. (XSET): Cast type of XTYPE arg to EMACS_INTPTR; it is needed here. No need to cast type when ORing. (XPNTR): Return a value of type EMACS_INTPTR or EMACS_UINTPTR. * alloc.c (lisp_align_malloc): Remove a no-longer-needed cast. * doc.c (store_function_docstring): Use EMACS_INTPTR, so as not to assume EMACS_INT is the same width as char *. * gtkutil.c (xg_gtk_scroll_destroy, xg_tool_bar_button_cb): (xg_tool_bar_callback, xg_tool_bar_help_callback, xg_make_tool_item): Remove no-longer-needed casts. (xg_create_scroll_bar, xg_tool_bar_button_cb, xg_tool_bar_callback): (xg_tool_bar_help_callback, xg_make_tool_item): Use EMACS_INTPTR to hold an integer that will be cast to void *; this can avoid a GCC warning if EMACS_INT is not the same width as void *. * menu.c (find_and_call_menu_selection): Remove no-longer-needed cast. * xdisp.c (display_echo_area_1, resize_mini_window_1): (current_message_1, set_message_1): Use a local to convert to proper width without a cast. * xmenu.c (dialog_selection_callback): Likewise.
* * gtkutil.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.Paul Eggert2011-04-191-10/+17
| | | | | | (GDK_KEY_g): Don't define if already defined. (xg_prepare_tooltip): Avoid pointer signedness problem. (xg_set_toolkit_scroll_bar_thumb): Redo to avoid two casts.
* * gtkutil.c (xg_get_file_with_chooser): Mark var as initialized.Paul Eggert2011-04-011-1/+1
|
* src/*.h: Remove unused parameters and functions.Juanma Barranquero2011-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * keyboard.h (timer_check, show_help_echo): Remove unused parameters. * keyboard.c (timer_check): Remove parameter `do_it_now', unused since 1996-04-12T06:01:29Z!rms@gnu.org. (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo', unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca. * keyboard.c (read_char): * w32menu.c (w32_menu_display_help): * xmenu.c (show_help_event, menu_help_callback): Adjust calls to `show_help_echo'. * gtkutil.c (xg_maybe_add_timer): * keyboard.c (readable_events): * process.c (wait_reading_process_output): * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'. * insdel.c (adjust_markers_gap_motion): Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org. (gap_left, gap_right): Don't call it.
* * gtkutil.c (gdk_window_get_screen): Make it clear that this macro is neededPaul Eggert2011-03-131-0/+2
| | | | only if USE_GTK_TOOLTIP.
* * gtkutil.c: (get_utf8_string, xg_get_file_with_chooser):Paul Eggert2011-03-131-24/+22
| | | | | Rename locals to avoid shadowing. (create_dialog): Move locals to avoid shadowing.
* * gtkutil.c (int_gtk_range_get_value): New function, which avoids a diagnosticPaul Eggert2011-03-131-7/+14
| | | | | | | from gcc -Wbad-function-cast. (xg_set_toolkit_scroll_bar_thumb): Use it. (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid diagnostic from gcc -Wbad-function-cast.
* * gtkutil.c (xg_free_frame_widgets): Make it clear that a local variable isPaul Eggert2011-03-131-0/+2
| | | | needed only if USE_GTK_TOOLTIP.
* * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char *Paul Eggert2011-03-131-4/+4
| | | | to unsigned char * to avoid compiler diagnostic.
* Updates for compiling with Gtk+ 3.0 (--with-x-toolkit=gtk3).Jan D2011-03-081-90/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.in: Require 3.0 for --with-gtk3. Add HAVE_GTK3. * doc/emacs/xresources.texi (GTK resources): ~/.emacs.d/gtkrc does not work for Gtk+ 3. * src/gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define gdk_window_get_screen, gdk_window_get_geometry, gdk_x11_window_lookup_for_display and GDK_KEY_g. (xg_set_screen): Use DEFAULT_GDK_DISPLAY. (xg_get_pixbuf_from_pixmap): New function. (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap to Pixmap, take frame as parameter, remove GdkColormap parameter. Call xg_get_pixbuf_from_pixmap instead of gdk_pixbuf_get_from_drawable. (xg_get_image_for_pixmap): Do not make GdkPixmaps, call xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead. (xg_check_special_colors): Use GtkStyleContext and its functions for HAVE_GTK3. (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. (xg_prepare_tooltip, create_dialog, menubar_map_cb) (xg_update_frame_menubar, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call gtk_widget_get_preferred_size. (xg_frame_resized): gdk_window_get_geometry only takes 5 parameters. (xg_win_to_widget, xg_event_is_for_menubar): Call gdk_x11_window_lookup_for_display. (xg_set_widget_bg): New function. (delete_cb): New function. (xg_create_frame_widgets): connect delete-event to delete_cb. Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3 (xg_set_background_color): Call xg_set_widget_bg. (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask. (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3. Only call gtk_range_set_update_policy if ! HAVE_GTK3. (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback if ! HAVE_GTK3. (update_frame_tool_bar): Call gtk_widget_hide. (xg_initialize): Use GDK_KEY_g. * src/xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size. * src/xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id if ! HAVE_GTK3 (x_session_initialize): Call gdk_x11_set_sm_client_id. * src/xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3. (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS. Load ~/emacs.d/gtkrc only for ! HAVE_GTK3. * src/xterm.h (DEFAULT_GDK_DISPLAY): New define. (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines for ! HAVE_GTK3. (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID.
* * gtkutil.c (xg_tool_bar_menu_proxy): Handle case when tool bar label is null.Jan Djärv2011-02-141-1/+1
|
* Refill some long/short copyright headers.Glenn Morris2011-01-261-2/+2
|
* Convert consecutive FSF copyright years to ranges.Glenn Morris2011-01-241-1/+1
|
* Promote SSDATA macro from gtkutil.c and xsmfns.c to lisp.h.Paul Eggert2011-01-221-4/+0
|
* Declare some DEFVARs globally, not locallyTom Tromey2011-01-181-7/+0
| | | | | | | | | * gtkutil.h (x_gtk_use_old_file_dialog, x_gtk_show_hidden_files) (x_gtk_file_dialog_help_text, x_gtk_whole_detached_tool_bar): Declare. * gtkutil.c (xg_uses_old_file_dialog): (xg_get_file_with_chooser): (xg_tool_bar_detach_callback): Don't redeclare globals.
* Nuke arch-tags.Glenn Morris2011-01-151-2/+0
|
* Merge from emacs-23Stefan Monnier2011-01-141-1/+1
|\
| * Add 2011 to FSF/AIST copyright years.Glenn Morris2011-01-021-1/+1
| |
* | Minor fix to GTK tool-bar button refresh code.Chong Yidong2011-01-081-1/+1
| | | | | | | | | | * gtkutil.c (update_frame_tool_bar): Don't advance tool-bar index when removing extra buttons.
* | Reduce GTK tool-bar switching delay by avoiding selective show/hide of widgets.Chong Yidong2011-01-011-156/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/gtkutil.c (xg_get_tool_bar_widgets): Use NULL for a missing image or label in the container. (xg_make_tool_item): Replace VERT_ONLY arg with HORIZ, TEXT_IMAGE. (xg_show_toolbar_item): Function deleted. (xg_tool_item_stale_p): New function. (update_frame_tool_bar): Calculate tool-bar style once per call. Instead of hiding text labels, omit them. Don't use xg_show_toolbar_item; create new GtkToolItems from scratch if necessary, instead of trying to re-use them. This avoids an annoying animation when changing tool-bars.
* | Support for menu separators in the GTK tool-bar.Chong Yidong2010-12-171-74/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gtkutil.c (XG_BIN_CHILD): New macro. (xg_get_menu_item_label, xg_update_menubar) (xg_update_menu_item, xg_tool_bar_menu_proxy) (xg_show_toolbar_item, update_frame_tool_bar): Use it. (separator_names, xg_separator_p): Move to keyboard.c. (create_menus, xg_update_submenu, update_frame_tool_bar): Use menu_separator_name_p. * src/keyboard.c (parse_tool_bar_item): Allow menu separators in tool-bar maps. (menu_separator_name_p): New function, from gtkutil.c. (separator_names): Move from gtkutil.c. * src/keyboard.h (menu_separator_name_p): Add prototype. * src/nsmenu.m (name_is_separator): Function deleted. (addItemWithWidgetValue): Use menu_separator_name_p. * src/w32menu.c (name_is_separator): Function deleted. (add_menu_item): Use menu_separator_name_p.
* | Fix error in last merge.Chong Yidong2010-11-301-26/+26
| | | | | | | | src/gtkutil.c (menubar_map_cb): Use xg_height_or_width_changed.
* | Merge changes from emacs-23 branchChong Yidong2010-11-271-2/+29
|\|
| * Fix bug 7425.Jan Djärv2010-11-201-2/+28
| | | | | | | | | | | | | | | | | | NOTE: When merging to trunk: xg_height_changed is xg_height_or_width_changed in trunk. * src/gtkutil.c (menubar_map_cb): New function. (xg_update_frame_menubar): Connect signal map to menubar_map_cb. Use 23 as menubar height if 0. (Bug#7425).
* | Add keyword :vert-only for tool bar items with labels not shown horizontally.Jan Djärv2010-11-201-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/info.el (info-tool-bar-map): Add some :vert-only keywords. * lisp/tool-bar.el (tool-bar-setup): Add some :vert-only keywords. * src/dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY. * src/gtkutil.c (xg_make_tool_item): Take vert_only as argument. Set important to ! vert_only. (xg_show_toolbar_item): Don't show label horizontally if tool item isn't important. (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to xg_make_tool_item, or update important on existing tool item. * src/keyboard.c (QCvert_only): New variable. (parse_tool_bar_item): Check for QCvert_only. (syms_of_keyboard): Initialize QCvert_only.
* | * gtkutil.c (qttip_cb): Set title to empty for ATK (Bug#7278).Jan D2010-10-261-0/+2
| |
* | Do not include stdlib.h and string.h, config.h does it.Dan Nicolaescu2010-10-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xfont.c: * src/w32term.c: * src/w32reg.c: * src/w32inevt.c: * src/w32heap.c: * src/w32console.c: * src/w16select.c: * src/unexsol.c: * src/term.c: * src/sound.c: * src/scroll.c (m): * src/gtkutil.c: * src/font.c: * src/filelock.c: * src/fileio.c: * src/dosfns.c: * src/dbusbind.c: * src/bidi.c: * src/callproc.c: * src/process.c: * src/msdos.c: * src/charset.c: Do not include stdlib.h and string.h, config.h does it. * configure.in: Include stdlib.h and string.h unconditionally.
* | Merge changes from emacs-23 branchChong Yidong2010-09-231-0/+2
|\|
| * Make sure detached tool bar menu isn't blank.Jan D2010-09-171-0/+2
| | | | | | | | * gtkutil.c (xg_tool_bar_menu_proxy): Set gtk-menu-items to TRUE.