[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117547: * frame.c (frame_unspecified_color): New fu
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117547: * frame.c (frame_unspecified_color): New function |
Date: |
Fri, 18 Jul 2014 06:03:43 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117547
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2014-07-18 10:02:19 +0400
message:
* frame.c (frame_unspecified_color): New function
refactored out from ...
(Fframe_parameters, Fframe_parameter): ... adjusted users.
(x_fullscreen_adjust, set_frame_param): Move Windows-specific
function to ...
* w32term.c (x_fullscreen_adjust, set_frame_param): ... static here.
* frame.h (x_fullscreen_adjust) [HAVE_NTGUI]:
* lisp.h (set_frame_param): Remove prototype.
* xterm.c (x_display_pixel_width, x_display_pixel_height): Now ...
* xterm.h (x_display_pixel_width, x_display_pixel_height): ...
inlined from here.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/frame.c frame.c-20091113204419-o5vbwnq5f7feedwu-243
src/frame.h frame.h-20091113204419-o5vbwnq5f7feedwu-229
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
src/w32term.c w32term.c-20091113204419-o5vbwnq5f7feedwu-950
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
src/xterm.h xterm.h-20091113204419-o5vbwnq5f7feedwu-228
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-17 10:18:19 +0000
+++ b/src/ChangeLog 2014-07-18 06:02:19 +0000
@@ -1,3 +1,17 @@
+2014-07-18 Dmitry Antipov <address@hidden>
+
+ * frame.c (frame_unspecified_color): New function
+ refactored out from ...
+ (Fframe_parameters, Fframe_parameter): ... adjusted users.
+ (x_fullscreen_adjust, set_frame_param): Move Windows-specific
+ function to ...
+ * w32term.c (x_fullscreen_adjust, set_frame_param): ... static here.
+ * frame.h (x_fullscreen_adjust) [HAVE_NTGUI]:
+ * lisp.h (set_frame_param): Remove prototype.
+ * xterm.c (x_display_pixel_width, x_display_pixel_height): Now ...
+ * xterm.h (x_display_pixel_width, x_display_pixel_height): ...
+ inlined from here.
+
2014-07-17 Dmitry Antipov <address@hidden>
* print.c (print_preprocess): Adjust to match changed
=== modified file 'src/frame.c'
--- a/src/frame.c 2014-07-17 10:18:19 +0000
+++ b/src/frame.c 2014-07-18 06:02:19 +0000
@@ -2081,20 +2081,6 @@
update_mode_lines = 16;
}
-#ifdef HAVE_NTGUI
-void
-set_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
-{
- register Lisp_Object old_alist_elt;
-
- old_alist_elt = Fassq (prop, f->param_alist);
- if (EQ (old_alist_elt, Qnil))
- fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist));
- else
- Fsetcdr (old_alist_elt, val);
-}
-#endif
-
void
store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
{
@@ -2186,6 +2172,18 @@
}
}
+/* Return color matches UNSPEC on frame F or nil if UNSPEC
+ is not an unspecified foreground or background color. */
+
+static Lisp_Object
+frame_unspecified_color (struct frame *f, Lisp_Object unspec)
+{
+ return (!strncmp (SSDATA (unspec), unspecified_bg, SBYTES (unspec))
+ ? tty_color_name (f, FRAME_BACKGROUND_PIXEL (f))
+ : (!strncmp (SSDATA (unspec), unspecified_fg, SBYTES (unspec))
+ ? tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)) : Qnil));
+}
+
DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0,
doc: /* Return the parameters-alist of frame FRAME.
It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
@@ -2206,8 +2204,6 @@
if (!FRAME_WINDOW_P (f))
{
- int fg = FRAME_FOREGROUND_PIXEL (f);
- int bg = FRAME_BACKGROUND_PIXEL (f);
Lisp_Object elt;
/* If the frame's parameter alist says the colors are
@@ -2216,31 +2212,23 @@
elt = Fassq (Qforeground_color, alist);
if (CONSP (elt) && STRINGP (XCDR (elt)))
{
- if (strncmp (SSDATA (XCDR (elt)),
- unspecified_bg,
- SCHARS (XCDR (elt))) == 0)
- store_in_alist (&alist, Qforeground_color, tty_color_name (f, bg));
- else if (strncmp (SSDATA (XCDR (elt)),
- unspecified_fg,
- SCHARS (XCDR (elt))) == 0)
- store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg));
+ elt = frame_unspecified_color (f, XCDR (elt));
+ if (!NILP (elt))
+ store_in_alist (&alist, Qforeground_color, elt);
}
else
- store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg));
+ store_in_alist (&alist, Qforeground_color,
+ tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)));
elt = Fassq (Qbackground_color, alist);
if (CONSP (elt) && STRINGP (XCDR (elt)))
{
- if (strncmp (SSDATA (XCDR (elt)),
- unspecified_fg,
- SCHARS (XCDR (elt))) == 0)
- store_in_alist (&alist, Qbackground_color, tty_color_name (f, fg));
- else if (strncmp (SSDATA (XCDR (elt)),
- unspecified_bg,
- SCHARS (XCDR (elt))) == 0)
- store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg));
+ elt = frame_unspecified_color (f, XCDR (elt));
+ if (!NILP (elt))
+ store_in_alist (&alist, Qbackground_color, elt);
}
else
- store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg));
+ store_in_alist (&alist, Qbackground_color,
+ tty_color_name (f, FRAME_BACKGROUND_PIXEL (f)));
store_in_alist (&alist, intern ("font"),
build_string (FRAME_MSDOS_P (f)
? "ms-dos"
@@ -2320,29 +2308,7 @@
important when param_alist's notion of colors is
"unspecified". We need to do the same here. */
if (STRINGP (value) && !FRAME_WINDOW_P (f))
- {
- const char *color_name;
- ptrdiff_t csz;
-
- if (EQ (parameter, Qbackground_color))
- {
- color_name = SSDATA (value);
- csz = SCHARS (value);
- if (strncmp (color_name, unspecified_bg, csz) == 0)
- value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
- else if (strncmp (color_name, unspecified_fg, csz) == 0)
- value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
- }
- else if (EQ (parameter, Qforeground_color))
- {
- color_name = SSDATA (value);
- csz = SCHARS (value);
- if (strncmp (color_name, unspecified_fg, csz) == 0)
- value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
- else if (strncmp (color_name, unspecified_bg, csz) == 0)
- value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
- }
- }
+ value = frame_unspecified_color (f, value);
}
else
value = Fcdr (Fassq (parameter, Fframe_parameters (frame)));
@@ -2786,52 +2752,6 @@
{"tool-bar-position", &Qtool_bar_position},
};
-#ifdef HAVE_NTGUI
-
-/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
- wanted positions of the WM window (not Emacs window).
- Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
- window (FRAME_X_WINDOW).
- */
-
-void
-x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos,
int *left_pos)
-{
- int newwidth = FRAME_COLS (f);
- int newheight = FRAME_LINES (f);
- Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
-
- *top_pos = f->top_pos;
- *left_pos = f->left_pos;
-
- if (f->want_fullscreen & FULLSCREEN_HEIGHT)
- {
- int ph;
-
- ph = x_display_pixel_height (dpyinfo);
- newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph);
- ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, newheight) - f->y_pixels_diff;
- newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph);
- *top_pos = 0;
- }
-
- if (f->want_fullscreen & FULLSCREEN_WIDTH)
- {
- int pw;
-
- pw = x_display_pixel_width (dpyinfo);
- newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw);
- pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, newwidth) - f->x_pixels_diff;
- newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw);
- *left_pos = 0;
- }
-
- *width = newwidth;
- *height = newheight;
-}
-
-#endif /* HAVE_NTGUI */
-
#ifdef HAVE_WINDOW_SYSTEM
/* Change the parameters of frame F as specified by ALIST.
=== modified file 'src/frame.h'
--- a/src/frame.h 2014-07-17 10:18:19 +0000
+++ b/src/frame.h 2014-07-18 06:02:19 +0000
@@ -1317,11 +1317,6 @@
extern Lisp_Object Qface_set_after_frame_default;
-#ifdef HAVE_NTGUI
-extern void x_fullscreen_adjust (struct frame *f, int *, int *,
- int *, int *);
-#endif
-
extern void x_set_frame_parameters (struct frame *, Lisp_Object);
extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object);
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2014-07-17 10:18:19 +0000
+++ b/src/lisp.h 2014-07-18 06:02:19 +0000
@@ -4122,7 +4122,6 @@
/* Defined in frame.c. */
extern Lisp_Object Qonly, Qnone;
-extern void set_frame_param (struct frame *, Lisp_Object, Lisp_Object);
extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2014-06-10 04:55:03 +0000
+++ b/src/w32term.c 2014-07-18 06:02:19 +0000
@@ -4135,7 +4135,18 @@
}
}
-
+static void
+set_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
+{
+ register Lisp_Object old_alist_elt;
+
+ old_alist_elt = Fassq (prop, f->param_alist);
+ if (EQ (old_alist_elt, Qnil))
+ fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist));
+ else
+ Fsetcdr (old_alist_elt, val);
+}
+
/* The main W32 event-reading loop - w32_read_socket. */
/* Record the last 100 characters stored
@@ -5561,6 +5572,47 @@
unblock_input ();
}
+/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
+ wanted positions of the WM window (not Emacs window).
+ Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
+ window (FRAME_X_WINDOW).
+ */
+
+static void
+x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos,
int *left_pos)
+{
+ int newwidth = FRAME_COLS (f);
+ int newheight = FRAME_LINES (f);
+ Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
+
+ *top_pos = f->top_pos;
+ *left_pos = f->left_pos;
+
+ if (f->want_fullscreen & FULLSCREEN_HEIGHT)
+ {
+ int ph;
+
+ ph = x_display_pixel_height (dpyinfo);
+ newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph);
+ ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, newheight) - f->y_pixels_diff;
+ newheight = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, ph);
+ *top_pos = 0;
+ }
+
+ if (f->want_fullscreen & FULLSCREEN_WIDTH)
+ {
+ int pw;
+
+ pw = x_display_pixel_width (dpyinfo);
+ newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw);
+ pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, newwidth) - f->x_pixels_diff;
+ newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw);
+ *left_pos = 0;
+ }
+
+ *width = newwidth;
+ *height = newheight;
+}
/* Check if we need to resize the frame due to a fullscreen request.
If so needed, resize the frame. */
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2014-07-07 23:33:05 +0000
+++ b/src/xterm.c 2014-07-18 06:02:19 +0000
@@ -442,19 +442,6 @@
x_uncatch_errors ();
}
-int
-x_display_pixel_height (struct x_display_info *dpyinfo)
-{
- return HeightOfScreen (dpyinfo->screen);
-}
-
-int
-x_display_pixel_width (struct x_display_info *dpyinfo)
-{
- return WidthOfScreen (dpyinfo->screen);
-}
-
-
/***********************************************************************
Starting and ending an update
***********************************************************************/
=== modified file 'src/xterm.h'
--- a/src/xterm.h 2014-07-16 05:44:05 +0000
+++ b/src/xterm.h 2014-07-18 06:02:19 +0000
@@ -77,6 +77,8 @@
#include "dispextern.h"
#include "termhooks.h"
+INLINE_HEADER_BEGIN
+
/* Black and white pixel values for the screen which frame F is on. */
#define BLACK_PIX_DEFAULT(f) \
BlackPixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))
@@ -953,8 +955,18 @@
extern int x_dispatch_event (XEvent *, Display *);
#endif
extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
-extern int x_display_pixel_height (struct x_display_info *);
-extern int x_display_pixel_width (struct x_display_info *);
+
+INLINE int
+x_display_pixel_height (struct x_display_info *dpyinfo)
+{
+ return HeightOfScreen (dpyinfo->screen);
+}
+
+INLINE int
+x_display_pixel_width (struct x_display_info *dpyinfo)
+{
+ return WidthOfScreen (dpyinfo->screen);
+}
extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
extern void x_wait_for_event (struct frame *, int);
@@ -1062,4 +1074,6 @@
(nr).width = (rwidth), \
(nr).height = (rheight))
+INLINE_HEADER_END
+
#endif /* XTERM_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117547: * frame.c (frame_unspecified_color): New function,
Dmitry Antipov <=