* frame.c: Qmaximized is new.
(x_set_frame_parameters): Do not handle fullscreen specially.
Only set width and height if explicitly set.
(x_set_fullscreen): Handle Qmaximized.
(x_set_font, x_figure_window_size): Do not handle fullscreen specially.
(syms_of_frame): Initialize Qmaximized.
* frame.h (fullscreen_type): Add FULLSCREEN_MAXIMIZED. Declare
Qfullwidth, Qfullheight, Qfullboth, Qmaximized.
* xterm.c (handle_one_xevent): Remove call to x_check_fullscreen
for Expose event. Add call to x_check_fullscreen for MapNotify event.
Remove all code w.r.t. fullscreen from ConfigureNotify event. Do not
set gravity to NorthWestGravity when USE_GTK.
(set_wm_state): New function.
(do_ewmh_fullscreen): Use set_wm_state. Also handle FULLSCREEN_MAXIMIZED.
(x_handle_net_wm_state): Handle FULLSCREEN_MAXIMIZED.
(x_check_fullscreen): Simplify so we only handle EMWH type of fullscreen
or the case when no window manager is running. That means remove calls
to x_real_positions and x_fullscreen_adjust.
* gtkutil.c (flush_and_sync, x_wm_size_hint_off): Remove.
(xg_frame_set_char_size): Remove calls to x_wm_size_hint_off and
flush_and_sync.
(xg_height_changed): New function.
(xg_create_frame_widgets): Remove call to gtk_widget_set_size_request
and gtk_window_set_policy. Set frame gravity after parsing the geometry
string.
(xg_update_frame_menubar, free_frame_menubar)
(xg_tool_bar_detach_callback, xg_tool_bar_attach_callback)
(update_frame_tool_bar, free_frame_tool_bar): Call xg_height_changed.
Remove calls to xg_frame_set_char_size.
* startup.el (command-line-x-option-alist): Add -mm and --maximized.
* NEWS: Mention maximized.
* frames.texi (Size Parameters): Mention maximized for fullscreen.
* xresources.texi (Table of Resources): Mention maximized for
fullscreen.
* cmdargs.texi (Window Size X): -mm/--maximized is new.
+2009-07-01 Jan Djärv <jan.h.d@swipnet.se>
+
+ * xresources.texi (Table of Resources): Mention maximized for
+ fullscreen.
+
+ * cmdargs.texi (Window Size X): -mm/--maximized is new.
+
2009-07-01 Chong Yidong <cyd@stupidchicken.com>
* anti.texi (Antinews): Correct the list of removed platforms.
@itemx --fullscreen
@opindex --fullscreen
@cindex fullscreen, command-line argument
-Specify that width and height shall be the size of the screen.
+Specify that width and height shall be the size of the screen. Normally
+no window manager decorations are shown.
+
+@item -mm
+@opindex -mm
+@itemx --maximized
+@opindex --maximized
+@cindex maximized, command-line argument
+Specify that the Emacs frame shall be maximized. This normally
+means that the frame has window manager decorations.
@item -fh
@opindex -fh
(@pxref{Table of Resources}); then Emacs will already know there's no
tool bar when it processes the specified geometry.
- When using one of @samp{--fullscreen}, @samp{--fullwidth} or
-@samp{--fullheight} there may be some space around the frame
+ When using one of @samp{--fullscreen}, @samp{--maximized}, @samp{--fullwidth}
+or @samp{--fullheight} there may be some space around the frame
anyway. That is because Emacs rounds the sizes so they are an
even number of character heights and widths.
@ifnottex
@item @code{fullscreen} (class @code{Fullscreen})
The desired fullscreen size. The value can be one of @code{fullboth},
-@code{fullwidth} or @code{fullheight}, which correspond to
-the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
+@code{maximized}, @code{fullwidth} or @code{fullheight}, which correspond to
+the command-line options @samp{-fs}, @samp{-mm}, @samp{-fw}, and @samp{-fh}
(@pxref{Window Size X}).
Note that this applies to the initial frame only.
+2009-07-01 Jan Djärv <jan.h.d@swipnet.se>
+
+ * frames.texi (Size Parameters): Mention maximized for fullscreen.
+
2009-06-24 Chong Yidong <cyd@stupidchicken.com>
* display.texi (Window Systems): Add ns to the list.
parameters @code{top} and @code{left}.
@item fullscreen
-Specify that width, height or both shall be set to the size of the screen.
-The value @code{fullwidth} specifies that width shall be the size of the
-screen. The value @code{fullheight} specifies that height shall be the
-size of the screen. The value @code{fullboth} specifies that both the
+Specify that width, height or both shall be maximized.
+The value @code{fullwidth} specifies that width shall as wide as possible.
+The value @code{fullheight} specifies that height shall be as tall as
+possible. The value @code{fullboth} specifies that both the
width and the height shall be set to the size of the screen.
+The value @code{maximized} specifies that the frame shall be maximized.
+The difference between @code{maximized} and @code{fullboth} is that
+the first does have window manager decorations but the second does not
+and thus really covers the whole screen.
@end table
@node Layout Parameters
+2009-07-01 Jan Djärv <jan.h.d@swipnet.se>
+
+ * NEWS: Mention maximized.
+
2009-06-30 Michael Albinus <michael.albinus@gmx.de>
* NEWS: Add "synce" connection method of Tramp.
KDE, and XFCE desktops. (This change has no effect on Windows, which
uses `system-move-file-to-trash' for trashing.)
++++
+** Emacs frames can be maximized.
+The command line arguments -mm/--maximized and the value maximized to the
+frame parameter fullscreen makes the Emacs frame maximized.
+
\f
* Changes in Specialized Modes and Packages in Emacs 23.2
+2009-07-01 Jan Djärv <jan.h.d@swipnet.se>
+
+ * startup.el (command-line-x-option-alist): Add -mm and --maximized.
+
2009-07-01 Eduard Wiebe <usenet@pusto.de> (tiny change)
* language/korean.el (set-language-info-alist): Add korean-cp949,
("-fs" 0 x-handle-initial-switch fullscreen fullboth)
("-fw" 0 x-handle-initial-switch fullscreen fullwidth)
("-fh" 0 x-handle-initial-switch fullscreen fullheight)
+ ("-mm" 0 x-handle-initial-switch fullscreen maximized)
("-ib" 1 x-handle-numeric-switch internal-border-width)
("-g" 1 x-handle-geometry)
("-lsp" 1 x-handle-numeric-switch line-spacing)
("--fullscreen" 0 x-handle-initial-switch fullscreen fullboth)
("--fullwidth" 0 x-handle-initial-switch fullscreen fullwidth)
("--fullheight" 0 x-handle-initial-switch fullscreen fullheight)
+ ("--maximized" 0 x-handle-initial-switch fullscreen maximized)
("--internal-border" 1 x-handle-numeric-switch internal-border-width)
("--geometry" 1 x-handle-geometry)
("--foreground-color" 1 x-handle-switch foreground-color)
+2009-07-01 Jan Djärv <jan.h.d@swipnet.se>
+
+ * emacs.c (USAGE3, standard_args): Add -mm and --maximized.
+
+ * frame.c: Qmaximized is new.
+ (x_set_frame_parameters): Do not handle fullscreen specially.
+ Only set width and height if explicitly set.
+ (x_set_fullscreen): Handle Qmaximized.
+ (x_set_font, x_figure_window_size): Do not handle fullscreen specially.
+ (syms_of_frame): Initialize Qmaximized.
+
+ * frame.h (fullscreen_type): Add FULLSCREEN_MAXIMIZED. Declare
+ Qfullwidth, Qfullheight, Qfullboth, Qmaximized.
+
+ * xterm.c (handle_one_xevent): Remove call to x_check_fullscreen
+ for Expose event. Add call to x_check_fullscreen for MapNotify event.
+ Remove all code w.r.t. fullscreen from ConfigureNotify event. Do not
+ set gravity to NorthWestGravity when USE_GTK.
+ (set_wm_state): New function.
+ (do_ewmh_fullscreen): Use set_wm_state. Also handle FULLSCREEN_MAXIMIZED.
+ (x_handle_net_wm_state): Handle FULLSCREEN_MAXIMIZED.
+ (x_check_fullscreen): Simplify so we only handle EMWH type of fullscreen
+ or the case when no window manager is running. That means remove calls
+ to x_real_positions and x_fullscreen_adjust.
+
+ * gtkutil.c (flush_and_sync, x_wm_size_hint_off): Remove.
+ (xg_frame_set_char_size): Remove calls to x_wm_size_hint_off and
+ flush_and_sync.
+ (xg_height_changed): New function.
+ (xg_create_frame_widgets): Remove call to gtk_widget_set_size_request
+ and gtk_window_set_policy. Set frame gravity after parsing the geometry
+ string.
+ (xg_update_frame_menubar, free_frame_menubar)
+ (xg_tool_bar_detach_callback, xg_tool_bar_attach_callback)
+ (update_frame_tool_bar, free_frame_tool_bar): Call xg_height_changed.
+ Remove calls to xg_frame_set_char_size.
+
2009-07-01 Kenichi Handa <handa@m17n.org>
* keyboard.c (decode_keyboard_code): New function.
--fullheight, -fh make the first frame high as the screen\n\
--fullscreen, -fs make first frame fullscreen\n\
--fullwidth, -fw make the first frame wide as the screen\n\
+--maximized, -mm make the first frame maximized\n\
--geometry, -g GEOMETRY window geometry\n\
--no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\
--iconic start Emacs in iconified state\n\
{ "-fs", "--fullscreen", 10, 0 },
{ "-fw", "--fullwidth", 10, 0 },
{ "-fh", "--fullheight", 10, 0 },
+ { "-mm", "--maximized", 10, 0 },
{ "-g", "--geometry", 10, 1 },
{ "-geometry", 0, 10, 1 },
{ "-T", "--title", 10, 1 },
Lisp_Object Qtty_color_mode;
Lisp_Object Qtty, Qtty_type;
-Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth, Qmaximized;
Lisp_Object Qfont_backend;
Lisp_Object Qalpha;
int i, p;
int left_no_change = 0, top_no_change = 0;
int icon_left_no_change = 0, icon_top_no_change = 0;
- int fullscreen_is_being_set = 0;
- int height_for_full_width = 0;
- int width_for_full_height = 0;
- enum fullscreen_type fullscreen_wanted = FULLSCREEN_NONE;
-
+ int size_changed = 0;
struct gcpro gcpro1, gcpro2;
i = 0;
They are independent of other properties, but other properties (e.g.,
cursor_color) are dependent upon them. */
/* Process default font as well, since fringe widths depends on it. */
- /* Also, process fullscreen, width and height depend upon that. */
for (p = 0; p < i; p++)
{
Lisp_Object prop, val;
val = values[p];
if (EQ (prop, Qforeground_color)
|| EQ (prop, Qbackground_color)
- || EQ (prop, Qfont)
- || EQ (prop, Qfullscreen))
+ || EQ (prop, Qfont))
{
register Lisp_Object param_index, old_value;
- if (EQ (prop, Qfullscreen))
- {
- /* The parameter handler can reset f->want_fullscreen to
- FULLSCREEN_NONE. But we need the requested value later
- to decide whether a height or width parameter shall be
- applied. Therefore, we remember the requested value in
- fullscreen_wanted for the following two cases. */
- if (EQ (val, Qfullheight))
- fullscreen_wanted = FULLSCREEN_HEIGHT;
- else if (EQ (val, Qfullwidth))
- fullscreen_wanted = FULLSCREEN_WIDTH;
- }
-
old_value = get_frame_param (f, prop);
- fullscreen_is_being_set |= EQ (prop, Qfullscreen);
if (NILP (Fequal (val, old_value)))
{
store_frame_param (f, prop, val);
val = values[i];
if (EQ (prop, Qwidth) && NATNUMP (val))
- width_for_full_height = width = XFASTINT (val);
+ {
+ size_changed = 1;
+ width = XFASTINT (val);
+ }
else if (EQ (prop, Qheight) && NATNUMP (val))
- height_for_full_width = height = XFASTINT (val);
+ {
+ size_changed = 1;
+ height = XFASTINT (val);
+ }
else if (EQ (prop, Qtop))
top = val;
else if (EQ (prop, Qleft))
icon_left = val;
else if (EQ (prop, Qforeground_color)
|| EQ (prop, Qbackground_color)
- || EQ (prop, Qfont)
- || EQ (prop, Qfullscreen))
+ || EQ (prop, Qfont))
/* Processed above. */
continue;
else
XSETINT (icon_top, 0);
}
- if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set)
- {
- /* If the frame is visible already and the fullscreen parameter is
- being set, it is too late to set WM manager hints to specify
- size and position.
- Here we first get the width, height and position that applies to
- fullscreen. We then move the frame to the appropriate
- position. Resize of the frame is taken care of in the code after
- this if-statement. */
- int new_left, new_top;
-
- x_fullscreen_adjust (f, &width, &height, &new_top, &new_left);
- if (new_top != f->top_pos || new_left != f->left_pos)
- x_set_offset (f, new_left, new_top, 1);
-
- /* When both height and fullwidth were requested, make sure the
- requested value for height gets applied. */
- if (height_for_full_width && fullscreen_wanted == FULLSCREEN_WIDTH)
- height = height_for_full_width;
- /* When both width and fullheight were requested, make sure the
- requested value for width gets applied. */
- if (width_for_full_height && fullscreen_wanted == FULLSCREEN_HEIGHT)
- width = width_for_full_height;
- }
-
/* Don't set these parameters unless they've been explicitly
specified. The window might be mapped or resized while we're in
this function, and we don't want to override that unless the lisp
XSETFRAME (frame, f);
- if (width != FRAME_COLS (f)
- || height != FRAME_LINES (f)
- || f->new_text_lines || f->new_text_cols)
- Fset_frame_size (frame, make_number (width), make_number (height));
+ if (size_changed
+ && (width != FRAME_COLS (f)
+ || height != FRAME_LINES (f)
+ || f->new_text_lines || f->new_text_cols))
+ Fset_frame_size (frame, make_number (width), make_number (height));
if ((!NILP (left) || !NILP (top))
&& ! (left_no_change && top_no_change)
{
if (NILP (new_value))
f->want_fullscreen = FULLSCREEN_NONE;
- else if (EQ (new_value, Qfullboth))
+ else if (EQ (new_value, Qfullboth) || EQ (new_value, Qfullscreen))
f->want_fullscreen = FULLSCREEN_BOTH;
else if (EQ (new_value, Qfullwidth))
f->want_fullscreen = FULLSCREEN_WIDTH;
else if (EQ (new_value, Qfullheight))
f->want_fullscreen = FULLSCREEN_HEIGHT;
+ else if (EQ (new_value, Qmaximized))
+ f->want_fullscreen = FULLSCREEN_MAXIMIZED;
if (FRAME_TERMINAL (f)->fullscreen_hook != NULL)
FRAME_TERMINAL (f)->fullscreen_hook (f);
if (CONSP (lval)) lval = CDR (lval);
x_new_font (f, font_object, fontset);
- /* If the fullscreen property is non-nil, adjust lines and columns so we
- keep the same pixel height and width. */
- if (! NILP (lval))
- {
- int height = FRAME_LINES (f), width = FRAME_COLS (f);
- if (EQ (lval, Qfullboth) || EQ (lval, Qfullwidth))
- width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, FRAME_PIXEL_WIDTH (f));
- if (EQ (lval, Qfullboth) || EQ (lval, Qfullheight))
- height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, FRAME_PIXEL_HEIGHT (f));
-
- change_frame_size (f, height, width, 0, 0, 1);
- }
-
store_frame_param (f, Qfont, arg);
/* Recalculate toolbar height. */
f->n_tool_bar_rows = 0;
window_prompting |= PPosition;
}
- if (f->want_fullscreen != FULLSCREEN_NONE)
- {
- int left, top;
- int width, height;
-
- /* It takes both for some WM:s to place it where we want */
- window_prompting |= USPosition | PPosition;
- x_fullscreen_adjust (f, &width, &height, &top, &left);
- FRAME_COLS (f) = width;
- FRAME_LINES (f) = height;
- FRAME_PIXEL_WIDTH (f) = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width);
- FRAME_PIXEL_HEIGHT (f) = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height);
- f->left_pos = left;
- f->top_pos = top;
- }
-
if (window_prompting & XNegative)
{
if (window_prompting & YNegative)
staticpro (&Qfullheight);
Qfullboth = intern ("fullboth");
staticpro (&Qfullboth);
+ Qmaximized = intern ("maximized");
+ staticpro (&Qmaximized);
Qx_resource_name = intern ("x-resource-name");
staticpro (&Qx_resource_name);
enum fullscreen_type
{
- /* Values used as a bit mask, BOTH == WIDTH | HEIGHT. */
- FULLSCREEN_NONE = 0,
- FULLSCREEN_WIDTH = 1,
- FULLSCREEN_HEIGHT = 2,
- FULLSCREEN_BOTH = 3,
- FULLSCREEN_WAIT = 4
+ FULLSCREEN_NONE,
+ FULLSCREEN_WIDTH = 0x001,
+ FULLSCREEN_HEIGHT = 0x002,
+ FULLSCREEN_BOTH = 0x003,
+ FULLSCREEN_MAXIMIZED = 0x013,
+ FULLSCREEN_WAIT = 0x100
};
extern Lisp_Object Qline_spacing;
extern Lisp_Object Qwait_for_wm;
extern Lisp_Object Qfullscreen;
+extern Lisp_Object Qfullwidth, Qfullheight, Qfullboth, Qmaximized;
extern Lisp_Object Qfont_backend;
extern Lisp_Object Qalpha;
}
static Lisp_Object
-file_for_image(image)
+file_for_image (image)
Lisp_Object image;
{
Lisp_Object specified_file = Qnil;
}
}
-/* Process all pending events on the display for frame F. */
-
-static void
-flush_and_sync (f)
- FRAME_PTR f;
-{
- gdk_window_process_all_updates ();
- x_sync (f);
- while (gtk_events_pending ())
- {
- gtk_main_iteration ();
- gdk_window_process_all_updates ();
- x_sync (f);
- }
-}
-
-/* Turn wm hints for resize off on frame F */
-
-static void
-x_wm_size_hint_off (f)
- FRAME_PTR f;
-{
- GdkGeometry size_hints;
- gint hint_flags = 0;
- memset (&size_hints, 0, sizeof (size_hints));
- hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE;
- size_hints.width_inc = 1;
- size_hints.height_inc = 1;
- hint_flags |= GDK_HINT_BASE_SIZE;
- size_hints.base_width = 1;
- size_hints.base_height = 1;
- size_hints.min_width = 1;
- size_hints.min_height = 1;
- gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- NULL,
- &size_hints,
- hint_flags);
- /* Make sure these get set again in next call to x_wm_set_size_hint. */
- f->output_data.x->hint_flags &= ~hint_flags;
- flush_and_sync (f);
-}
-
/* Resize the outer window of frame F after chainging the height.
This happend when the menu bar or the tool bar is added or removed.
COLUMNS/ROWS is the size the edit area shall have after the resize. */
pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
/* Must resize our top level widget. Font size may have changed,
- but not rows/cols.
- Turn wm hints (min/max size and size increments) of temporarly.
- It interferes too much, when for example adding or removing the
- menu/tool bar. */
- x_wm_size_hint_off (f);
+ but not rows/cols. */
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
pixelwidth, pixelheight);
+ x_wm_set_size_hint (f, 0, 0);
/* Now, strictly speaking, we can't be sure that this is accurate,
but the window manager will get around to dealing with the size
for, then the event won't cause the screen to become garbaged, so
we have to make sure to do it here. */
SET_FRAME_GARBAGED (f);
- flush_and_sync (f);
+}
+
+/* Handle height changes (i.e. add/remove menu/toolbar).
+ The policy is to keep the number of editable lines. */
+
+static void
+xg_height_changed (f)
+ FRAME_PTR f;
+{
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ FRAME_PIXEL_WIDTH (f), FRAME_TOTAL_PIXEL_HEIGHT (f));
+ f->output_data.x->hint_flags = 0;
x_wm_set_size_hint (f, 0, 0);
}
gtk_fixed_set_has_window (GTK_FIXED (wfixed), TRUE);
- gtk_widget_set_size_request (wfixed, FRAME_PIXEL_WIDTH (f),
- FRAME_PIXEL_HEIGHT (f));
-
gtk_container_add (GTK_CONTAINER (wtop), wvbox);
gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
a lot, so we turn off double buffering. */
gtk_widget_set_double_buffered (wfixed, FALSE);
- /* GTK documents says use gtk_window_set_resizable. But then a user
- can't shrink the window from its starting size. */
- gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE);
gtk_window_set_wmclass (GTK_WINDOW (wtop),
SSDATA (Vx_resource_name),
SSDATA (Vx_resource_class));
and specify it.
GTK will itself handle calculating the real position this way. */
xg_set_geometry (f);
+ int grav = gtk_window_get_gravity (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+ f->win_gravity = grav;
gtk_widget_add_events (wfixed,
GDK_POINTER_MOTION_MASK
gtk_widget_show_all (x->menubar_widget);
gtk_widget_size_request (x->menubar_widget, &req);
-
FRAME_MENUBAR_HEIGHT (f) = req.height;
-
- /* The height has changed, resize outer widget and set columns
- rows to what we had before adding the menu bar. */
- xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
-
- SET_FRAME_GARBAGED (f);
+ xg_height_changed (f);
UNBLOCK_INPUT;
return 1;
the container. */
x->menubar_widget = 0;
FRAME_MENUBAR_HEIGHT (f) = 0;
-
- /* The height has changed, resize outer widget and set columns
- rows to what we had before removing the menu bar. */
- xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
-
- SET_FRAME_GARBAGED (f);
+ xg_height_changed (f);
UNBLOCK_INPUT;
}
}
/* When detaching a tool bar, not everything dissapear. There are
a few pixels left that are used to drop the tool bar back into
place. */
- FRAME_TOOLBAR_HEIGHT (f) = 2;
-
- /* The height has changed, resize outer widget and set columns
- rows to what we had before detaching the tool bar. */
- xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
+ FRAME_TOOLBAR_HEIGHT (f) = 4;
+ xg_height_changed (f);
}
}
gtk_widget_size_request (w, &req);
FRAME_TOOLBAR_HEIGHT (f) = req.height;
-
- /* The height has changed, resize outer widget and set columns
- rows to what we had before attaching the tool bar. */
- xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
+ xg_height_changed (f);
}
}
} while (ti != NULL);
new_req.height = 0;
- gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req);
-
if (pack_tool_bar && f->n_tool_bar_items != 0)
- xg_pack_tool_bar (f);
+ xg_pack_tool_bar (f);
+
- if (new_req.height != 0
- && f->n_tool_bar_items != 0
- && old_req.height != new_req.height
+ gtk_widget_size_request (GTK_WIDGET (x->toolbar_widget), &new_req);
+ if (old_req.height != new_req.height
&& ! FRAME_X_OUTPUT (f)->toolbar_detached)
{
FRAME_TOOLBAR_HEIGHT (f) = new_req.height;
- xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
+ xg_height_changed (f);
}
-
UNBLOCK_INPUT;
}
x->toolbar_widget = 0;
x->handlebox_widget = 0;
FRAME_TOOLBAR_HEIGHT (f) = 0;
+ xg_height_changed (f);
- /* The height has changed, resize outer widget and set columns
- rows to what we had before removing the tool bar. */
- xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
UNBLOCK_INPUT;
}
}
f = x_window_to_frame (dpyinfo, event.xexpose.window);
if (f)
{
- x_check_fullscreen (f);
-
#ifdef USE_GTK
/* This seems to be needed for GTK 2.6. */
x_clear_area (event.xexpose.display,
to update the frame titles
in case this is the second frame. */
record_asynch_buffer_change ();
+
+ /* Check if fullscreen was specified before we where mapped. */
+ x_check_fullscreen (f);
}
goto OTHER;
{
#ifndef USE_X_TOOLKIT
#ifndef USE_GTK
- /* If there is a pending resize for fullscreen, don't
- do this one, the right one will come later.
- The toolkit version doesn't seem to need this, but we
- need to reset it below. */
- int dont_resize
- = ((f->want_fullscreen & FULLSCREEN_WAIT)
- && f->new_text_cols != 0);
int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height);
int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width);
- if (dont_resize)
- goto OTHER;
-
/* In the toolkit version, change_frame_size
is called by the code that handles resizing
of the EmacsFrame widget. */
#endif
{
x_real_positions (f, &f->left_pos, &f->top_pos);
-
- if (f->want_fullscreen & FULLSCREEN_WAIT)
- f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
}
#ifdef HAVE_X_I18N
xic_set_statusarea (f);
#endif
+#ifndef USE_GTK
if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
{
/* Since the WM decorations come below top_pos now,
f->win_gravity = NorthWestGravity;
x_wm_set_size_hint (f, (long) 0, 0);
}
+#endif
}
goto OTHER;
return rc;
}
+static void
+set_wm_state (frame, add, what, what2)
+ Lisp_Object frame;
+ int add;
+ const char *what;
+ const char *what2;
+{
+ const char *atom = "_NET_WM_STATE";
+ Fx_send_client_event (frame, make_number (0), frame,
+ make_unibyte_string (atom, strlen (atom)),
+ make_number (32),
+ /* 1 = add, 0 = remove */
+ Fcons
+ (make_number (add ? 1 : 0),
+ Fcons
+ (make_unibyte_string (what, strlen (what)),
+ what2 != 0
+ ? Fcons (make_unibyte_string (what2, strlen (what2)),
+ Qnil)
+ : Qnil)));
+}
+
/* Do fullscreen as specified in extended window manager hints */
static int
if (have_net_atom)
{
Lisp_Object frame;
- const char *atom = "_NET_WM_STATE";
const char *fs = "_NET_WM_STATE_FULLSCREEN";
const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
- const char *what = NULL;
XSETFRAME (frame, f);
+ set_wm_state (frame, 0, fs, NULL);
+ set_wm_state (frame, 0, fh, NULL);
+ set_wm_state (frame, 0, fw, NULL);
+
/* If there are _NET_ atoms we assume we have extended window manager
hints. */
switch (f->want_fullscreen)
{
case FULLSCREEN_BOTH:
- what = fs;
+ set_wm_state (frame, 1, fs, NULL);
break;
case FULLSCREEN_WIDTH:
- what = fw;
+ set_wm_state (frame, 1, fw, NULL);
break;
case FULLSCREEN_HEIGHT:
- what = fh;
+ set_wm_state (frame, 1, fh, NULL);
+ break;
+ case FULLSCREEN_MAXIMIZED:
+ set_wm_state (frame, 1, fw, fh);
break;
}
- if (what != NULL && !wm_supports (f, what)) return 0;
-
-
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- Fcons (make_number (0), /* Remove */
- Fcons
- (make_unibyte_string (fs,
- strlen (fs)),
- Qnil)));
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- Fcons (make_number (0), /* Remove */
- Fcons
- (make_unibyte_string (fh,
- strlen (fh)),
- Qnil)));
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- Fcons (make_number (0), /* Remove */
- Fcons
- (make_unibyte_string (fw,
- strlen (fw)),
- Qnil)));
f->want_fullscreen = FULLSCREEN_NONE;
- if (what != NULL)
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- Fcons (make_number (1), /* Add */
- Fcons
- (make_unibyte_string (what,
- strlen (what)),
- Qnil)));
+
}
return have_net_atom;
if (f->async_visible)
{
BLOCK_INPUT;
- do_ewmh_fullscreen (f);
+ x_check_fullscreen (f);
x_sync (f);
UNBLOCK_INPUT;
}
}
-extern Lisp_Object Qfullwidth, Qfullheight, Qfullboth;
static void
x_handle_net_wm_state (f, event)
struct frame *f;
{
Atom actual_type;
unsigned long actual_size, bytes_remaining;
- int i, rc, actual_format, value = 0;
+ int i, rc, actual_format, value = FULLSCREEN_NONE;
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
long max_len = 65536;
Display *dpy = FRAME_X_DISPLAY (f);
for (i = 0; i < actual_size; ++i)
{
Atom a = ((Atom*)tmp_data)[i];
- if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
- value |= FULLSCREEN_WIDTH;
+ if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
+ {
+ if (value == FULLSCREEN_HEIGHT)
+ value = FULLSCREEN_MAXIMIZED;
+ else
+ value = FULLSCREEN_WIDTH;
+ }
else if (a == dpyinfo->Xatom_net_wm_state_maximized_vert)
- value |= FULLSCREEN_HEIGHT;
+ {
+ if (value == FULLSCREEN_WIDTH)
+ value = FULLSCREEN_MAXIMIZED;
+ else
+ value = FULLSCREEN_HEIGHT;
+ }
else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom)
- value |= FULLSCREEN_BOTH;
+ value = FULLSCREEN_BOTH;
}
lval = Qnil;
case FULLSCREEN_BOTH:
lval = Qfullboth;
break;
+ case FULLSCREEN_MAXIMIZED:
+ lval = Qmaximized;
+ break;
}
store_frame_param (f, Qfullscreen, lval);
x_check_fullscreen (f)
struct frame *f;
{
- if (f->want_fullscreen & FULLSCREEN_BOTH)
- {
- int width, height, ign;
-
- if (do_ewmh_fullscreen (f))
- return;
+ if (do_ewmh_fullscreen (f))
+ return;
- x_real_positions (f, &f->left_pos, &f->top_pos);
+ if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
+ return; // Only fullscreen without WM or with EWM hints (above).
- x_fullscreen_adjust (f, &width, &height, &ign, &ign);
+ if (f->want_fullscreen != FULLSCREEN_NONE)
+ {
+ int width = FRAME_COLS (f), height = FRAME_LINES (f);
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
- /* We do not need to move the window, it shall be taken care of
- when setting WM manager hints.
- If the frame is visible already, the position is checked by
- x_check_expected_move. */
+ switch (f->want_fullscreen)
+ {
+ /* No difference between these two when there is no WM */
+ case FULLSCREEN_BOTH:
+ case FULLSCREEN_MAXIMIZED:
+ width = x_display_pixel_width (dpyinfo);
+ height = x_display_pixel_height (dpyinfo);
+ break;
+ case FULLSCREEN_WIDTH:
+ width = x_display_pixel_width (dpyinfo);
+ break;
+ case FULLSCREEN_HEIGHT:
+ height = x_display_pixel_height (dpyinfo);
+ }
+
if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
{
change_frame_size (f, height, width, 0, 1, 0);
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
-
- /* Wait for the change of frame size to occur */
- f->want_fullscreen |= FULLSCREEN_WAIT;
}
}
}
x_real_positions (f, ¤t_left, ¤t_top);
if (current_left != expected_left || current_top != expected_top)
- {
+ {
/* It's a "Type A" window manager. */
int adjusted_left;
adjusted_left, adjusted_top);
x_sync_with_move (f, expected_left, expected_top, 0);
- }
+ }
else
/* It's a "Type B" window manager. We don't have to adjust the
frame's position. */