#include <c-ctype.h>
#include "lisp.h"
+#include "dispextern.h"
+#include "frame.h"
+#include "systime.h"
#include "xterm.h"
#include "blockinput.h"
-#include "syssignal.h"
#include "window.h"
-#include "buffer.h"
#include "gtkutil.h"
#include "termhooks.h"
#include "keyboard.h"
-#include "charset.h"
#include "coding.h"
-#include "font.h"
#include <gdk/gdkkeysyms.h>
-#include "xsettings.h"
#ifdef HAVE_XFT
#include <X11/Xft/Xft.h>
if (STRINGP (specified_file)
&& STRINGP (file = x_find_image_file (specified_file)))
{
+ char *encoded_file = SSDATA (ENCODE_FILE (file));
if (! old_widget)
- old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
+ old_widget = GTK_IMAGE (gtk_image_new_from_file (encoded_file));
else
- gtk_image_set_from_file (old_widget, SSDATA (file));
+ gtk_image_set_from_file (old_widget, encoded_file);
return GTK_WIDGET (old_widget);
}
if (cp) g_free (cp);
len = strlen (str);
- if ((min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4 < nr_bad)
+ ptrdiff_t alloc;
+ if (INT_MULTIPLY_WRAPV (nr_bad, 4, &alloc)
+ || INT_ADD_WRAPV (len + 1, alloc, &alloc)
+ || SIZE_MAX < alloc)
memory_full (SIZE_MAX);
- up = utf8_str = xmalloc (len + nr_bad * 4 + 1);
+ up = utf8_str = xmalloc (alloc);
p = (unsigned char *)str;
while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read,
(unsigned) (col.red * 65535),
(unsigned) (col.green * 65535),
(unsigned) (col.blue * 65535));
- success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
- buf, color)
- != 0);
+ success_p = x_parse_color (f, buf, color) != 0;
#else
GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
GdkColor *grgb = get_bg
change_frame_size (f, width, height, 0, 1, 0, 1);
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
-
- do_pending_window_change (0);
}
}
totalwidth /= scale;
}
+ x_wm_set_size_hint (f, 0, 0);
+
/* Resize the top level widget so rows and columns remain constant.
When the frame is fullheight and we only want to change the width
{
frame_size_history_add
(f, Qxg_frame_set_char_size_1, width, height,
- list2 (make_number (gheight),
- make_number (totalheight)));
+ list2 (make_number (gheight), make_number (totalheight)));
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- gwidth,
- totalheight);
+ gwidth, totalheight);
}
else if (EQ (fullscreen, Qfullheight) && height == FRAME_TEXT_HEIGHT (f))
{
frame_size_history_add
(f, Qxg_frame_set_char_size_2, width, height,
- list2 (make_number (gwidth),
- make_number (totalwidth)));
+ list2 (make_number (gwidth), make_number (totalwidth)));
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- totalwidth,
- gheight);
+ totalwidth, gheight);
}
else
{
frame_size_history_add
(f, Qxg_frame_set_char_size_3, width, height,
- list2 (make_number (totalwidth),
- make_number (totalheight)));
+ list2 (make_number (totalwidth), make_number (totalheight)));
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- totalwidth,
- totalheight);
+ totalwidth, totalheight);
fullscreen = Qnil;
}
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
- x_wm_set_size_hint (f, 0, 0);
/* We can not call change_frame_size for a mapped frame,
we can not set pixel width/height either. The window manager may
override our resize request, XMonad does this all the time.
XSETFRAME (frame, f);
fs_state = Fframe_parameter (frame, Qfullscreen);
- if (EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth))
+ if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) &&
+ (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) ||
+ x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state_fullscreen)))
{
/* Don't set hints when maximized or fullscreen. Apparently KWin and
Gtk3 don't get along and the frame shrinks (!).
hint_flags |= GDK_HINT_BASE_SIZE;
/* Use one row/col here so base_height/width does not become zero.
- Gtk+ and/or Unity on Ubuntu 12.04 can't handle it. */
+ Gtk+ and/or Unity on Ubuntu 12.04 can't handle it.
+ Obviously this makes the row/col value displayed off by 1. */
base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 1) + FRAME_TOOLBAR_WIDTH (f);
base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 1)
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
if (default_filename)
{
Lisp_Object file;
- struct gcpro gcpro1;
char *utf8_filename;
- GCPRO1 (file);
file = build_string (default_filename);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filewin), cp);
}
}
-
- UNGCPRO;
}
*func = xg_get_file_name_from_chooser;
{
int i;
Lisp_Object file, rtl_name;
- struct gcpro gcpro1, gcpro2;
- GCPRO2 (file, rtl_name);
rtl_name = Ffile_name_nondirectory (rtl);
gtk_widget_show_all (x->toolbar_widget);
if (xg_update_tool_bar_sizes (f))
{
+ int inhibit
+ = ((f->after_make_frame
+ && !f->tool_bar_resized
+ && (EQ (frame_inhibit_implied_resize, Qt)
+ || (CONSP (frame_inhibit_implied_resize)
+ && !NILP (Fmemq (Qtool_bar_lines,
+ frame_inhibit_implied_resize))))
+ /* This will probably fail to DTRT in the
+ fullheight/-width cases. */
+ && NILP (get_frame_param (f, Qfullscreen)))
+ ? 0
+ : 2);
+
frame_size_history_add (f, Qupdate_frame_tool_bar, 0, 0, Qnil);
- adjust_frame_size (f, -1, -1, 2, 0, Qtool_bar_lines);
+ adjust_frame_size (f, -1, -1, inhibit, 0, Qtool_bar_lines);
}
+ f->tool_bar_resized = f->tool_bar_redisplayed;
}
unblock_input ();