diff options
| author | Jan Djärv | 2009-07-01 14:02:27 +0000 |
|---|---|---|
| committer | Jan Djärv | 2009-07-01 14:02:27 +0000 |
| commit | 3f1c666608f7ca4aeacbcbe5102c2c2c63e345e9 (patch) | |
| tree | 3249bf002f7557d4bd697d94f61e61042f0aad1f /src/frame.c | |
| parent | 62aadce704ec87289bf7a666ad29ccc33e19f07d (diff) | |
| download | emacs-3f1c666608f7ca4aeacbcbe5102c2c2c63e345e9.tar.gz emacs-3f1c666608f7ca4aeacbcbe5102c2c2c63e345e9.zip | |
* 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.
* 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.
Diffstat (limited to 'src/frame.c')
| -rw-r--r-- | src/frame.c | 108 |
1 files changed, 22 insertions, 86 deletions
diff --git a/src/frame.c b/src/frame.c index 9e05b1b8456..fa2807c150a 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -120,7 +120,7 @@ Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; | |||
| 120 | Lisp_Object Qtty_color_mode; | 120 | Lisp_Object Qtty_color_mode; |
| 121 | Lisp_Object Qtty, Qtty_type; | 121 | Lisp_Object Qtty, Qtty_type; |
| 122 | 122 | ||
| 123 | Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; | 123 | Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth, Qmaximized; |
| 124 | Lisp_Object Qfont_backend; | 124 | Lisp_Object Qfont_backend; |
| 125 | Lisp_Object Qalpha; | 125 | Lisp_Object Qalpha; |
| 126 | 126 | ||
| @@ -2930,11 +2930,7 @@ x_set_frame_parameters (f, alist) | |||
| 2930 | int i, p; | 2930 | int i, p; |
| 2931 | int left_no_change = 0, top_no_change = 0; | 2931 | int left_no_change = 0, top_no_change = 0; |
| 2932 | int icon_left_no_change = 0, icon_top_no_change = 0; | 2932 | int icon_left_no_change = 0, icon_top_no_change = 0; |
| 2933 | int fullscreen_is_being_set = 0; | 2933 | int size_changed = 0; |
| 2934 | int height_for_full_width = 0; | ||
| 2935 | int width_for_full_height = 0; | ||
| 2936 | enum fullscreen_type fullscreen_wanted = FULLSCREEN_NONE; | ||
| 2937 | |||
| 2938 | struct gcpro gcpro1, gcpro2; | 2934 | struct gcpro gcpro1, gcpro2; |
| 2939 | 2935 | ||
| 2940 | i = 0; | 2936 | i = 0; |
| @@ -2976,7 +2972,6 @@ x_set_frame_parameters (f, alist) | |||
| 2976 | They are independent of other properties, but other properties (e.g., | 2972 | They are independent of other properties, but other properties (e.g., |
| 2977 | cursor_color) are dependent upon them. */ | 2973 | cursor_color) are dependent upon them. */ |
| 2978 | /* Process default font as well, since fringe widths depends on it. */ | 2974 | /* Process default font as well, since fringe widths depends on it. */ |
| 2979 | /* Also, process fullscreen, width and height depend upon that. */ | ||
| 2980 | for (p = 0; p < i; p++) | 2975 | for (p = 0; p < i; p++) |
| 2981 | { | 2976 | { |
| 2982 | Lisp_Object prop, val; | 2977 | Lisp_Object prop, val; |
| @@ -2985,26 +2980,11 @@ x_set_frame_parameters (f, alist) | |||
| 2985 | val = values[p]; | 2980 | val = values[p]; |
| 2986 | if (EQ (prop, Qforeground_color) | 2981 | if (EQ (prop, Qforeground_color) |
| 2987 | || EQ (prop, Qbackground_color) | 2982 | || EQ (prop, Qbackground_color) |
| 2988 | || EQ (prop, Qfont) | 2983 | || EQ (prop, Qfont)) |
| 2989 | || EQ (prop, Qfullscreen)) | ||
| 2990 | { | 2984 | { |
| 2991 | register Lisp_Object param_index, old_value; | 2985 | register Lisp_Object param_index, old_value; |
| 2992 | 2986 | ||
| 2993 | if (EQ (prop, Qfullscreen)) | ||
| 2994 | { | ||
| 2995 | /* The parameter handler can reset f->want_fullscreen to | ||
| 2996 | FULLSCREEN_NONE. But we need the requested value later | ||
| 2997 | to decide whether a height or width parameter shall be | ||
| 2998 | applied. Therefore, we remember the requested value in | ||
| 2999 | fullscreen_wanted for the following two cases. */ | ||
| 3000 | if (EQ (val, Qfullheight)) | ||
| 3001 | fullscreen_wanted = FULLSCREEN_HEIGHT; | ||
| 3002 | else if (EQ (val, Qfullwidth)) | ||
| 3003 | fullscreen_wanted = FULLSCREEN_WIDTH; | ||
| 3004 | } | ||
| 3005 | |||
| 3006 | old_value = get_frame_param (f, prop); | 2987 | old_value = get_frame_param (f, prop); |
| 3007 | fullscreen_is_being_set |= EQ (prop, Qfullscreen); | ||
| 3008 | if (NILP (Fequal (val, old_value))) | 2988 | if (NILP (Fequal (val, old_value))) |
| 3009 | { | 2989 | { |
| 3010 | store_frame_param (f, prop, val); | 2990 | store_frame_param (f, prop, val); |
| @@ -3028,9 +3008,15 @@ x_set_frame_parameters (f, alist) | |||
| 3028 | val = values[i]; | 3008 | val = values[i]; |
| 3029 | 3009 | ||
| 3030 | if (EQ (prop, Qwidth) && NATNUMP (val)) | 3010 | if (EQ (prop, Qwidth) && NATNUMP (val)) |
| 3031 | width_for_full_height = width = XFASTINT (val); | 3011 | { |
| 3012 | size_changed = 1; | ||
| 3013 | width = XFASTINT (val); | ||
| 3014 | } | ||
| 3032 | else if (EQ (prop, Qheight) && NATNUMP (val)) | 3015 | else if (EQ (prop, Qheight) && NATNUMP (val)) |
| 3033 | height_for_full_width = height = XFASTINT (val); | 3016 | { |
| 3017 | size_changed = 1; | ||
| 3018 | height = XFASTINT (val); | ||
| 3019 | } | ||
| 3034 | else if (EQ (prop, Qtop)) | 3020 | else if (EQ (prop, Qtop)) |
| 3035 | top = val; | 3021 | top = val; |
| 3036 | else if (EQ (prop, Qleft)) | 3022 | else if (EQ (prop, Qleft)) |
| @@ -3041,8 +3027,7 @@ x_set_frame_parameters (f, alist) | |||
| 3041 | icon_left = val; | 3027 | icon_left = val; |
| 3042 | else if (EQ (prop, Qforeground_color) | 3028 | else if (EQ (prop, Qforeground_color) |
| 3043 | || EQ (prop, Qbackground_color) | 3029 | || EQ (prop, Qbackground_color) |
| 3044 | || EQ (prop, Qfont) | 3030 | || EQ (prop, Qfont)) |
| 3045 | || EQ (prop, Qfullscreen)) | ||
| 3046 | /* Processed above. */ | 3031 | /* Processed above. */ |
| 3047 | continue; | 3032 | continue; |
| 3048 | else | 3033 | else |
| @@ -3096,31 +3081,6 @@ x_set_frame_parameters (f, alist) | |||
| 3096 | XSETINT (icon_top, 0); | 3081 | XSETINT (icon_top, 0); |
| 3097 | } | 3082 | } |
| 3098 | 3083 | ||
| 3099 | if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) | ||
| 3100 | { | ||
| 3101 | /* If the frame is visible already and the fullscreen parameter is | ||
| 3102 | being set, it is too late to set WM manager hints to specify | ||
| 3103 | size and position. | ||
| 3104 | Here we first get the width, height and position that applies to | ||
| 3105 | fullscreen. We then move the frame to the appropriate | ||
| 3106 | position. Resize of the frame is taken care of in the code after | ||
| 3107 | this if-statement. */ | ||
| 3108 | int new_left, new_top; | ||
| 3109 | |||
| 3110 | x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); | ||
| 3111 | if (new_top != f->top_pos || new_left != f->left_pos) | ||
| 3112 | x_set_offset (f, new_left, new_top, 1); | ||
| 3113 | |||
| 3114 | /* When both height and fullwidth were requested, make sure the | ||
| 3115 | requested value for height gets applied. */ | ||
| 3116 | if (height_for_full_width && fullscreen_wanted == FULLSCREEN_WIDTH) | ||
| 3117 | height = height_for_full_width; | ||
| 3118 | /* When both width and fullheight were requested, make sure the | ||
| 3119 | requested value for width gets applied. */ | ||
| 3120 | if (width_for_full_height && fullscreen_wanted == FULLSCREEN_HEIGHT) | ||
| 3121 | width = width_for_full_height; | ||
| 3122 | } | ||
| 3123 | |||
| 3124 | /* Don't set these parameters unless they've been explicitly | 3084 | /* Don't set these parameters unless they've been explicitly |
| 3125 | specified. The window might be mapped or resized while we're in | 3085 | specified. The window might be mapped or resized while we're in |
| 3126 | this function, and we don't want to override that unless the lisp | 3086 | this function, and we don't want to override that unless the lisp |
| @@ -3136,10 +3096,11 @@ x_set_frame_parameters (f, alist) | |||
| 3136 | 3096 | ||
| 3137 | XSETFRAME (frame, f); | 3097 | XSETFRAME (frame, f); |
| 3138 | 3098 | ||
| 3139 | if (width != FRAME_COLS (f) | 3099 | if (size_changed |
| 3140 | || height != FRAME_LINES (f) | 3100 | && (width != FRAME_COLS (f) |
| 3141 | || f->new_text_lines || f->new_text_cols) | 3101 | || height != FRAME_LINES (f) |
| 3142 | Fset_frame_size (frame, make_number (width), make_number (height)); | 3102 | || f->new_text_lines || f->new_text_cols)) |
| 3103 | Fset_frame_size (frame, make_number (width), make_number (height)); | ||
| 3143 | 3104 | ||
| 3144 | if ((!NILP (left) || !NILP (top)) | 3105 | if ((!NILP (left) || !NILP (top)) |
| 3145 | && ! (left_no_change && top_no_change) | 3106 | && ! (left_no_change && top_no_change) |
| @@ -3299,12 +3260,14 @@ x_set_fullscreen (f, new_value, old_value) | |||
| 3299 | { | 3260 | { |
| 3300 | if (NILP (new_value)) | 3261 | if (NILP (new_value)) |
| 3301 | f->want_fullscreen = FULLSCREEN_NONE; | 3262 | f->want_fullscreen = FULLSCREEN_NONE; |
| 3302 | else if (EQ (new_value, Qfullboth)) | 3263 | else if (EQ (new_value, Qfullboth) || EQ (new_value, Qfullscreen)) |
| 3303 | f->want_fullscreen = FULLSCREEN_BOTH; | 3264 | f->want_fullscreen = FULLSCREEN_BOTH; |
| 3304 | else if (EQ (new_value, Qfullwidth)) | 3265 | else if (EQ (new_value, Qfullwidth)) |
| 3305 | f->want_fullscreen = FULLSCREEN_WIDTH; | 3266 | f->want_fullscreen = FULLSCREEN_WIDTH; |
| 3306 | else if (EQ (new_value, Qfullheight)) | 3267 | else if (EQ (new_value, Qfullheight)) |
| 3307 | f->want_fullscreen = FULLSCREEN_HEIGHT; | 3268 | f->want_fullscreen = FULLSCREEN_HEIGHT; |
| 3269 | else if (EQ (new_value, Qmaximized)) | ||
| 3270 | f->want_fullscreen = FULLSCREEN_MAXIMIZED; | ||
| 3308 | 3271 | ||
| 3309 | if (FRAME_TERMINAL (f)->fullscreen_hook != NULL) | 3272 | if (FRAME_TERMINAL (f)->fullscreen_hook != NULL) |
| 3310 | FRAME_TERMINAL (f)->fullscreen_hook (f); | 3273 | FRAME_TERMINAL (f)->fullscreen_hook (f); |
| @@ -3443,19 +3406,6 @@ x_set_font (f, arg, oldval) | |||
| 3443 | if (CONSP (lval)) lval = CDR (lval); | 3406 | if (CONSP (lval)) lval = CDR (lval); |
| 3444 | 3407 | ||
| 3445 | x_new_font (f, font_object, fontset); | 3408 | x_new_font (f, font_object, fontset); |
| 3446 | /* If the fullscreen property is non-nil, adjust lines and columns so we | ||
| 3447 | keep the same pixel height and width. */ | ||
| 3448 | if (! NILP (lval)) | ||
| 3449 | { | ||
| 3450 | int height = FRAME_LINES (f), width = FRAME_COLS (f); | ||
| 3451 | if (EQ (lval, Qfullboth) || EQ (lval, Qfullwidth)) | ||
| 3452 | width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, FRAME_PIXEL_WIDTH (f)); | ||
| 3453 | if (EQ (lval, Qfullboth) || EQ (lval, Qfullheight)) | ||
| 3454 | height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, FRAME_PIXEL_HEIGHT (f)); | ||
| 3455 | |||
| 3456 | change_frame_size (f, height, width, 0, 0, 1); | ||
| 3457 | } | ||
| 3458 | |||
| 3459 | store_frame_param (f, Qfont, arg); | 3409 | store_frame_param (f, Qfont, arg); |
| 3460 | /* Recalculate toolbar height. */ | 3410 | /* Recalculate toolbar height. */ |
| 3461 | f->n_tool_bar_rows = 0; | 3411 | f->n_tool_bar_rows = 0; |
| @@ -4374,22 +4324,6 @@ x_figure_window_size (f, parms, toolbar_p) | |||
| 4374 | window_prompting |= PPosition; | 4324 | window_prompting |= PPosition; |
| 4375 | } | 4325 | } |
| 4376 | 4326 | ||
| 4377 | if (f->want_fullscreen != FULLSCREEN_NONE) | ||
| 4378 | { | ||
| 4379 | int left, top; | ||
| 4380 | int width, height; | ||
| 4381 | |||
| 4382 | /* It takes both for some WM:s to place it where we want */ | ||
| 4383 | window_prompting |= USPosition | PPosition; | ||
| 4384 | x_fullscreen_adjust (f, &width, &height, &top, &left); | ||
| 4385 | FRAME_COLS (f) = width; | ||
| 4386 | FRAME_LINES (f) = height; | ||
| 4387 | FRAME_PIXEL_WIDTH (f) = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width); | ||
| 4388 | FRAME_PIXEL_HEIGHT (f) = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); | ||
| 4389 | f->left_pos = left; | ||
| 4390 | f->top_pos = top; | ||
| 4391 | } | ||
| 4392 | |||
| 4393 | if (window_prompting & XNegative) | 4327 | if (window_prompting & XNegative) |
| 4394 | { | 4328 | { |
| 4395 | if (window_prompting & YNegative) | 4329 | if (window_prompting & YNegative) |
| @@ -4503,6 +4437,8 @@ syms_of_frame () | |||
| 4503 | staticpro (&Qfullheight); | 4437 | staticpro (&Qfullheight); |
| 4504 | Qfullboth = intern ("fullboth"); | 4438 | Qfullboth = intern ("fullboth"); |
| 4505 | staticpro (&Qfullboth); | 4439 | staticpro (&Qfullboth); |
| 4440 | Qmaximized = intern ("maximized"); | ||
| 4441 | staticpro (&Qmaximized); | ||
| 4506 | Qx_resource_name = intern ("x-resource-name"); | 4442 | Qx_resource_name = intern ("x-resource-name"); |
| 4507 | staticpro (&Qx_resource_name); | 4443 | staticpro (&Qx_resource_name); |
| 4508 | 4444 | ||