aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2014-07-16 19:39:15 +0400
committerDmitry Antipov2014-07-16 19:39:15 +0400
commit70f8097ea2b81fc6624453cf21720f1a1f617862 (patch)
tree0c451497af411aaaef0bc9cb8fe3d8ecd44c3683 /src
parente0b07ec3416d1ee7c77234e9dd0a7408b50da83c (diff)
downloademacs-70f8097ea2b81fc6624453cf21720f1a1f617862.tar.gz
emacs-70f8097ea2b81fc6624453cf21720f1a1f617862.zip
* frame.h (enum fullscreen_type) [HAVE_WINDOW_SYSTEM]: Use more natural
values. Add comment. (struct frame): Re-arrange layout to avoid extra padding and use bit fields for output_method, want_fullscreen and vertical_scroll_bar_type. (FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS) (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT) (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT) [!HAVE_WINDOW_SYSTEM]: Define as no-ops because there are no scroll bars anyway. * frame.c (make_frame, make_terminal_frame, make_initial_frame): Adjust users. * font.c (fset_font_data) [HAVE_XFT || HAVE_FREETYPE]: Add convenient setter. (font_put_frame_data, font_get_frame_data): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/font.c12
-rw-r--r--src/frame.c11
-rw-r--r--src/frame.h181
4 files changed, 136 insertions, 83 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3561cca4ac3..000ddf2d877 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -18,6 +18,21 @@
18 (store_symval_forwarding): Handle special properties of buffer-local 18 (store_symval_forwarding): Handle special properties of buffer-local
19 variables and use functions from the above to signal error, if any. 19 variables and use functions from the above to signal error, if any.
20 20
21 * frame.h (enum fullscreen_type) [HAVE_WINDOW_SYSTEM]: Use more natural
22 values. Add comment.
23 (struct frame): Re-arrange layout to avoid extra padding and use bit
24 fields for output_method, want_fullscreen and vertical_scroll_bar_type.
25 (FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS)
26 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT)
27 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT) [!HAVE_WINDOW_SYSTEM]:
28 Define as no-ops because there are no scroll bars anyway.
29 * frame.c (make_frame, make_terminal_frame, make_initial_frame):
30 Adjust users.
31
32 * font.c (fset_font_data) [HAVE_XFT || HAVE_FREETYPE]:
33 Add convenient setter.
34 (font_put_frame_data, font_get_frame_data): Use it.
35
212014-07-15 Daiki Ueno <ueno@gnu.org> 362014-07-15 Daiki Ueno <ueno@gnu.org>
22 37
23 * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around 38 * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around
diff --git a/src/font.c b/src/font.c
index b3afee09864..ef8b5e40eeb 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3574,18 +3574,24 @@ font_update_drivers (struct frame *f, Lisp_Object new_drivers)
3574 3574
3575#if defined (HAVE_XFT) || defined (HAVE_FREETYPE) 3575#if defined (HAVE_XFT) || defined (HAVE_FREETYPE)
3576 3576
3577static void
3578fset_font_data (struct frame *f, Lisp_Object val)
3579{
3580 f->font_data = val;
3581}
3582
3577void 3583void
3578font_put_frame_data (struct frame *f, Lisp_Object driver, void *data) 3584font_put_frame_data (struct frame *f, Lisp_Object driver, void *data)
3579{ 3585{
3580 Lisp_Object val = assq_no_quit (driver, f->font_data); 3586 Lisp_Object val = assq_no_quit (driver, f->font_data);
3581 3587
3582 if (!data) 3588 if (!data)
3583 f->font_data = Fdelq (val, f->font_data); 3589 fset_font_data (f, Fdelq (val, f->font_data));
3584 else 3590 else
3585 { 3591 {
3586 if (NILP (val)) 3592 if (NILP (val))
3587 f->font_data = Fcons (Fcons (driver, make_save_ptr (data)), 3593 fset_font_data (f, Fcons (Fcons (driver, make_save_ptr (data)),
3588 f->font_data); 3594 f->font_data));
3589 else 3595 else
3590 XSETCDR (val, make_save_ptr (data)); 3596 XSETCDR (val, make_save_ptr (data));
3591 } 3597 }
diff --git a/src/frame.c b/src/frame.c
index 57270437d9f..61544c245f3 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -347,10 +347,10 @@ make_frame (bool mini_p)
347 f->wants_modeline = true; 347 f->wants_modeline = true;
348 f->redisplay = true; 348 f->redisplay = true;
349 f->garbaged = true; 349 f->garbaged = true;
350 f->vertical_scroll_bar_type = vertical_scroll_bar_none;
351 f->column_width = 1; /* !FRAME_WINDOW_P value. */ 350 f->column_width = 1; /* !FRAME_WINDOW_P value. */
352 f->line_height = 1; /* !FRAME_WINDOW_P value. */ 351 f->line_height = 1; /* !FRAME_WINDOW_P value. */
353#ifdef HAVE_WINDOW_SYSTEM 352#ifdef HAVE_WINDOW_SYSTEM
353 f->vertical_scroll_bar_type = vertical_scroll_bar_none;
354 f->want_fullscreen = FULLSCREEN_NONE; 354 f->want_fullscreen = FULLSCREEN_NONE;
355#if ! defined (USE_GTK) && ! defined (HAVE_NS) 355#if ! defined (USE_GTK) && ! defined (HAVE_NS)
356 f->last_tool_bar_item = -1; 356 f->last_tool_bar_item = -1;
@@ -569,7 +569,9 @@ make_initial_frame (void)
569 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR; 569 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
570 FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; 570 FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR;
571 571
572 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 572#ifdef HAVE_WINDOW_SYSTEM
573 f->vertical_scroll_bar_type = vertical_scroll_bar_none;
574#endif
573 575
574 /* The default value of menu-bar-mode is t. */ 576 /* The default value of menu-bar-mode is t. */
575 set_menu_bar_lines (f, make_number (1), Qnil); 577 set_menu_bar_lines (f, make_number (1), Qnil);
@@ -619,7 +621,10 @@ make_terminal_frame (struct terminal *terminal)
619 FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR; 621 FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR;
620#endif /* not MSDOS */ 622#endif /* not MSDOS */
621 623
622 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 624#ifdef HAVE_WINDOW_SYSTEM
625 f->vertical_scroll_bar_type = vertical_scroll_bar_none;
626#endif
627
623 FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; 628 FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1;
624 FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); 629 FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
625 630
diff --git a/src/frame.h b/src/frame.h
index 6841143f8da..b0a7f29c252 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -36,16 +36,22 @@ enum vertical_scroll_bar_type
36 vertical_scroll_bar_right 36 vertical_scroll_bar_right
37}; 37};
38 38
39#ifdef HAVE_WINDOW_SYSTEM
40
39enum fullscreen_type 41enum fullscreen_type
40{ 42{
41 FULLSCREEN_NONE, 43 FULLSCREEN_NONE,
42 FULLSCREEN_WIDTH = 0x001, 44 FULLSCREEN_WIDTH = 0x1,
43 FULLSCREEN_HEIGHT = 0x002, 45 FULLSCREEN_HEIGHT = 0x2,
44 FULLSCREEN_BOTH = 0x003, 46 FULLSCREEN_BOTH = 0x3, /* Not a typo but means "width and height". */
45 FULLSCREEN_MAXIMIZED = 0x013, 47 FULLSCREEN_MAXIMIZED = 0x4,
46 FULLSCREEN_WAIT = 0x100 48#ifdef HAVE_NTGUI
49 FULLSCREEN_WAIT = 0x8
50#endif
47}; 51};
48 52
53#endif /* HAVE_WINDOW_SYSTEM */
54
49/* The structure representing a frame. */ 55/* The structure representing a frame. */
50 56
51struct frame 57struct frame
@@ -187,6 +193,8 @@ struct frame
187 struct glyph_matrix *desired_matrix; 193 struct glyph_matrix *desired_matrix;
188 struct glyph_matrix *current_matrix; 194 struct glyph_matrix *current_matrix;
189 195
196 /* Bitfield area begins here. Keep them together to avoid extra padding. */
197
190 /* True means that glyphs on this frame have been initialized so it can 198 /* True means that glyphs on this frame have been initialized so it can
191 be used for output. */ 199 be used for output. */
192 bool_bf glyphs_initialized_p : 1; 200 bool_bf glyphs_initialized_p : 1;
@@ -228,6 +236,85 @@ struct frame
228 /* True if it needs to be redisplayed. */ 236 /* True if it needs to be redisplayed. */
229 bool_bf redisplay : 1; 237 bool_bf redisplay : 1;
230 238
239#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
240 || defined (HAVE_NS) || defined (USE_GTK)
241 /* True means using a menu bar that comes from the X toolkit. */
242 bool_bf external_menu_bar : 1;
243#endif
244
245 /* Next two bitfields are mutually exclusive. They might both be
246 zero if the frame has been made invisible without an icon. */
247
248 /* Nonzero if the frame is currently displayed; we check
249 it to see if we should bother updating the frame's contents.
250
251 On ttys and on Windows NT/9X, to avoid wasting effort updating
252 visible frames that are actually completely obscured by other
253 windows on the display, we bend the meaning of visible slightly:
254 if equal to 2, then the frame is obscured - we still consider
255 it to be "visible" as seen from lisp, but we don't bother
256 updating it. */
257 unsigned visible : 2;
258
259 /* True if the frame is currently iconified. Do not
260 set this directly, use SET_FRAME_ICONIFIED instead. */
261 bool_bf iconified : 1;
262
263 /* True if this frame should be fully redisplayed. Disables all
264 optimizations while rebuilding matrices and redrawing. */
265 bool_bf garbaged : 1;
266
267 /* False means, if this frame has just one window,
268 show no modeline for that window. */
269 bool_bf wants_modeline : 1;
270
271 /* True means raise this frame to the top of the heap when selected. */
272 bool_bf auto_raise : 1;
273
274 /* True means lower this frame to the bottom of the stack when left. */
275 bool_bf auto_lower : 1;
276
277 /* True if frame's root window can't be split. */
278 bool_bf no_split : 1;
279
280 /* If this is set, then Emacs won't change the frame name to indicate
281 the current buffer, etcetera. If the user explicitly sets the frame
282 name, this gets set. If the user sets the name to Qnil, this is
283 cleared. */
284 bool_bf explicit_name : 1;
285
286 /* True if size of some window on this frame has changed. */
287 bool_bf window_sizes_changed : 1;
288
289 /* True if the mouse has moved on this display device
290 since the last time we checked. */
291 bool_bf mouse_moved : 1;
292
293 /* True means that the pointer is invisible. */
294 bool_bf pointer_invisible : 1;
295
296 /* True means that all windows except mini-window and
297 selected window on this frame have frozen window starts. */
298 bool_bf frozen_window_starts : 1;
299
300 /* The output method says how the contents of this frame are
301 displayed. It could be using termcap, or using an X window.
302 This must be the same as the terminal->type. */
303 ENUM_BF (output_method) output_method : 3;
304
305#ifdef HAVE_WINDOW_SYSTEM
306
307 /* See FULLSCREEN_ enum on top. */
308 ENUM_BF (fullscreen_type) want_fullscreen : 4;
309
310 /* If not vertical_scroll_bar_none, we should actually
311 display the scroll bars of this type on this frame. */
312 ENUM_BF (vertical_scroll_bar_type) vertical_scroll_bar_type : 2;
313
314#endif /* HAVE_WINDOW_SYSTEM */
315
316 /* Bitfield area ends here. */
317
231 /* Margin at the top of the frame. Used to display the tool-bar. */ 318 /* Margin at the top of the frame. Used to display the tool-bar. */
232 int tool_bar_lines; 319 int tool_bar_lines;
233 320
@@ -309,11 +396,6 @@ struct frame
309 /* Canonical Y unit. Height of a line, in pixels. */ 396 /* Canonical Y unit. Height of a line, in pixels. */
310 int line_height; 397 int line_height;
311 398
312 /* The output method says how the contents of this frame are
313 displayed. It could be using termcap, or using an X window.
314 This must be the same as the terminal->type. */
315 enum output_method output_method;
316
317 /* The terminal device that this frame uses. If this is NULL, then 399 /* The terminal device that this frame uses. If this is NULL, then
318 the frame has been deleted. */ 400 the frame has been deleted. */
319 struct terminal *terminal; 401 struct terminal *terminal;
@@ -344,9 +426,6 @@ struct frame
344 /* The extra width (in pixels) currently allotted for fringes. */ 426 /* The extra width (in pixels) currently allotted for fringes. */
345 int left_fringe_width, right_fringe_width; 427 int left_fringe_width, right_fringe_width;
346 428
347 /* See FULLSCREEN_ enum below. */
348 enum fullscreen_type want_fullscreen;
349
350 /* Number of lines of menu bar. */ 429 /* Number of lines of menu bar. */
351 int menu_bar_lines; 430 int menu_bar_lines;
352 431
@@ -358,70 +437,6 @@ struct frame
358 int wait_event_type; 437 int wait_event_type;
359#endif 438#endif
360 439
361#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
362 || defined (HAVE_NS) || defined (USE_GTK)
363 /* True means using a menu bar that comes from the X toolkit. */
364 bool_bf external_menu_bar : 1;
365#endif
366
367 /* Next two bitfields are mutually exclusive. They might both be
368 zero if the frame has been made invisible without an icon. */
369
370 /* Nonzero if the frame is currently displayed; we check
371 it to see if we should bother updating the frame's contents.
372
373 On ttys and on Windows NT/9X, to avoid wasting effort updating
374 visible frames that are actually completely obscured by other
375 windows on the display, we bend the meaning of visible slightly:
376 if equal to 2, then the frame is obscured - we still consider
377 it to be "visible" as seen from lisp, but we don't bother
378 updating it. */
379 unsigned visible : 2;
380
381 /* True if the frame is currently iconified. Do not
382 set this directly, use SET_FRAME_ICONIFIED instead. */
383 bool_bf iconified : 1;
384
385 /* True if this frame should be fully redisplayed. Disables all
386 optimizations while rebuilding matrices and redrawing. */
387 bool_bf garbaged : 1;
388
389 /* False means, if this frame has just one window,
390 show no modeline for that window. */
391 bool_bf wants_modeline : 1;
392
393 /* True means raise this frame to the top of the heap when selected. */
394 bool_bf auto_raise : 1;
395
396 /* True means lower this frame to the bottom of the stack when left. */
397 bool_bf auto_lower : 1;
398
399 /* True if frame's root window can't be split. */
400 bool_bf no_split : 1;
401
402 /* If this is set, then Emacs won't change the frame name to indicate
403 the current buffer, etcetera. If the user explicitly sets the frame
404 name, this gets set. If the user sets the name to Qnil, this is
405 cleared. */
406 bool_bf explicit_name : 1;
407
408 /* True if size of some window on this frame has changed. */
409 bool_bf window_sizes_changed : 1;
410
411 /* True if the mouse has moved on this display device
412 since the last time we checked. */
413 bool_bf mouse_moved : 1;
414
415 /* True means that the pointer is invisible. */
416 bool_bf pointer_invisible : 1;
417
418 /* True means that all windows except mini-window and
419 selected window on this frame have frozen window starts. */
420 bool_bf frozen_window_starts : 1;
421
422 /* Nonzero if we should actually display the scroll bars on this frame. */
423 enum vertical_scroll_bar_type vertical_scroll_bar_type;
424
425 /* What kind of text cursor should we draw in the future? 440 /* What kind of text cursor should we draw in the future?
426 This should always be filled_box_cursor or bar_cursor. */ 441 This should always be filled_box_cursor or bar_cursor. */
427 enum text_cursor_kinds desired_cursor; 442 enum text_cursor_kinds desired_cursor;
@@ -793,6 +808,8 @@ default_pixels_per_inch_y (void)
793#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost 808#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
794#define FRAME_FOCUS_FRAME(f) f->focus_frame 809#define FRAME_FOCUS_FRAME(f) f->focus_frame
795 810
811#ifdef HAVE_WINDOW_SYSTEM
812
796/* This frame slot says whether scroll bars are currently enabled for frame F, 813/* This frame slot says whether scroll bars are currently enabled for frame F,
797 and which side they are on. */ 814 and which side they are on. */
798#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type) 815#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
@@ -803,6 +820,16 @@ default_pixels_per_inch_y (void)
803#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \ 820#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
804 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right) 821 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
805 822
823#else /* not HAVE_WINDOW_SYSTEM */
824
825/* If there is no window system, there are no scroll bars. */
826#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((void) f, vertical_scroll_bar_none)
827#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) f, 0)
828#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0)
829#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0)
830
831#endif /* HAVE_WINDOW_SYSTEM */
832
806/* Width that a scroll bar in frame F should have, if there is one. 833/* Width that a scroll bar in frame F should have, if there is one.
807 Measured in pixels. 834 Measured in pixels.
808 If scroll bars are turned off, this is still nonzero. */ 835 If scroll bars are turned off, this is still nonzero. */