From 17a2cbbd76385d0be8a4b28974e64f4debf459c1 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Fri, 31 Aug 2012 22:38:52 -0800 Subject: [PATCH] Refactor window-system configuration This change streamlines the window system selection code in configure.in and moves many common function declarations from window-specific headers to frame.h. It introduces a new TERM_HEADER macro in config.h: we set this macro to the right header to use for the window system for which we're compiling Emacs and have source files include it indirectly. This way, we don't have to teach every file about every window system. --- ChangeLog | 8 ++++++ configure.ac | 51 ++++++++++++++++++++++++++--------- nt/ChangeLog | 4 +++ nt/inc/ms-w32.h | 3 +++ src/ChangeLog | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.in | 11 +++++--- src/ccl.h | 2 ++ src/dispnew.c | 14 +++------- src/emacs.c | 12 +++------ src/font.c | 14 +++------- src/frame.c | 19 ++++--------- src/frame.h | 30 +++++++++++++++++++++ src/gtkutil.h | 1 + src/image.c | 31 +++++++++------------ src/keyboard.c | 19 ++++--------- src/keyboard.h | 2 +- src/menu.c | 17 +++--------- src/nsterm.h | 27 ++----------------- src/process.c | 7 ++--- src/w32font.h | 4 +++ src/w32term.h | 2 +- src/w32xfns.c | 2 +- src/xfaces.c | 20 ++++++-------- src/xterm.h | 26 ++++++------------ 24 files changed, 228 insertions(+), 169 deletions(-) diff --git a/ChangeLog b/ChangeLog index 228cf1d74d..6e93b8313e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-09-01 Daniel Colascione + + * configure.ac: Introduce term_header variable, which holds the + value which will become TERM_HEADER in code. We effect our choice + of window system by setting term_header and WINDOW_SYSTEM_OBJ + instead of using ad-hoc variables and flags for each window + system. + 2012-08-26 Paul Eggert * configure.ac (CFLAGS): Prefer -g3 to -g if -g3 works diff --git a/configure.ac b/configure.ac index 71ec98390a..d16113bf91 100644 --- a/configure.ac +++ b/configure.ac @@ -1386,10 +1386,14 @@ AC_SYS_LONG_FILE_NAMES #### Choose a window system. +## We leave window_system equal to none if +## we end up building without one. Any new window system should +## set window_system to an appropriate value and add objects to +## window-system-specific substs. + +window_system=none AC_PATH_X -if test "$no_x" = yes; then - window_system=none -else +if test "$no_x" != yes; then window_system=x11 fi @@ -1528,7 +1532,6 @@ if test "${HAVE_NS}" = yes; then fi window_system=nextstep - with_xft=no # set up packaging dirs if test "${EN_NS_SELF_CONTAINED}" = yes; then ns_self_contained=yes @@ -1548,7 +1551,6 @@ if test "${HAVE_NS}" = yes; then INSTALL_ARCH_INDEP_EXTRA= fi ns_frag=$srcdir/src/ns.mk - NS_OBJ="fontset.o fringe.o image.o" NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o" fi CFLAGS="$tmp_CFLAGS" @@ -1560,18 +1562,29 @@ AC_SUBST(NS_OBJC_OBJ) AC_SUBST(LIB_STANDARD) AC_SUBST_FILE(ns_frag) +## $window_system is now set to the window system we will +## ultimately use. + +term_header= +HAVE_X_WINDOWS=no +HAVE_X11=no +USE_X_TOOLKIT=none + case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes HAVE_X11=yes + term_header=xterm.h case "${with_x_toolkit}" in athena | lucid ) USE_X_TOOLKIT=LUCID ;; motif ) USE_X_TOOLKIT=MOTIF ;; gtk ) with_gtk=yes + term_header=gtkutil.h dnl Don't set this for GTK. A lot of tests below assumes Xt when dnl USE_X_TOOLKIT is set. USE_X_TOOLKIT=none ;; gtk3 ) with_gtk3=yes + term_header=gtkutil.h USE_X_TOOLKIT=none ;; no ) USE_X_TOOLKIT=none ;; dnl If user did not say whether to use a toolkit, make this decision later: @@ -1579,13 +1592,16 @@ dnl use the toolkit if we have gtk, or X11R5 or newer. * ) USE_X_TOOLKIT=maybe ;; esac ;; - nextstep | none ) - HAVE_X_WINDOWS=no - HAVE_X11=no - USE_X_TOOLKIT=none + nextstep ) + term_header=nsterm.h ;; esac +if test -n "${term_header}"; then + AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}", + [Define to the header for the built-in window system.]) +fi + if test "$window_system" = none && test "X$with_x" != "Xno"; then AC_CHECK_PROG(HAVE_XSERVER, X, true, false) if test "$HAVE_XSERVER" = true || @@ -1901,6 +1917,7 @@ if test "${with_gtk3}" = "yes"; then fi AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) GTK_OBJ=emacsgtkfixed.o + term_header=gtkutil.h fi if test "$pkg_check_gtk" != "yes"; then @@ -1979,6 +1996,8 @@ if test "${HAVE_GTK}" = "yes"; then gtk_widget_get_mapped gtk_adjustment_get_page_size \ gtk_orientable_set_orientation \ gtk_window_set_has_resize_grip) + + term_header=gtkutil.h fi dnl D-Bus has been tested under GNU/Linux only. Must be adapted for @@ -3973,6 +3992,11 @@ AC_SUBST(ns_appsrc) AC_SUBST(GNU_OBJC_CFLAGS) AC_SUBST(OTHER_FILES) +if test -n "${term_header}"; then + AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}", + [Define to the header for the built-in window system.]) +fi + AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", [Define to the canonical Emacs configuration name.]) AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}", @@ -3987,7 +4011,7 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you want to use the X window system.]) XMENU_OBJ=xmenu.o - XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" + XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o" FONT_OBJ=xfont.o if test "$HAVE_XFT" = "yes"; then FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" @@ -4277,13 +4301,14 @@ if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then fi dnl if $GCC AC_SUBST(LIB_GCC) - -## If we're using X11/GNUstep, define some consequences. -if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then +## Common for all window systems +if test "$window_system" != "none"; then AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.]) AC_DEFINE(HAVE_MOUSE, 1, [Define if you have mouse support.]) + WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o" fi +AC_SUBST(WINDOW_SYSTEM_OBJ) AH_TOP([/* GNU Emacs site configuration template file. diff --git a/nt/ChangeLog b/nt/ChangeLog index 7729f09d00..1085138e3f 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2012-09-01 Daniel Colascione + + * inc/ms-w32.h (TERM_HEADER): Add for refactoring + 2012-08-22 Juanma Barranquero * config.nt: Sync with autogen/config.in. diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 022b168c0b..8945fb7be4 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -424,4 +424,7 @@ extern void _DebPrint (const char *fmt, ...); #define DebPrint(stuff) #endif +#define TERM_HEADER "w32term.h" + + /* ============================================================ */ diff --git a/src/ChangeLog b/src/ChangeLog index 4db48bbb96..0bd1d6c98a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,74 @@ +2012-09-01 Daniel Colascione + + * xterm.h: Add header guards. Declare x_menubar_window_to_frame. + Remove x_set_frame_alpha, x_bitmap_icon, x_make_frame_visible, + x_make_frame_invisible, x_iconify_frame, x_free_frame_resources, + x_wm_set_size_hint, x_query_colors, x_real_positions, + x_set_menu_bar_lines, x_char_width, x_char_height, x_sync, + x_set_tool_bar_lines, x_activate_menubar, and free_frame_menubar, + all of which have been moved to common code. + + * xfaces.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * w32xfns.c (x_sync): Correct definition of x_sync (a no-op here) + to match header. + + * w32term.h (FRAME_X_WINDOW): Use FRAME_W32_WINDOW instead of + directly accessing frame internals. + + * w32font.h (w): Include font.h. Define syms_of_w32font and + globals_of_w32font. + + * process.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * nsterm.h: Remove declarations now in frame.h. Define + FRAME_X_SCREEN, FRAME_X_VISUAL. + + * menu.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * keyboard.h: Declare ignore_mouse_drag_p whenever we have a + window system. + + * keyboard.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * image.c: Include TERM_HEADER instead of listing all possible + window-system headers. Declare Vlibrary_cache when compiling for + Windows. + + * gtkutil.h (xg_list_node_): Include xterm.h to pick up needed + window system declarations. + + * frame.h: Move common functions here: set_frame_menubar, + x_set_window_size, x_sync, x_get_focus_frame, + x_set_mouse_position, x_set_mouse_pixel_position, + x_make_frame_visible, x_make_frame_invisible, x_iconify_frame, + x_char_width, x_char_height, x_pixel_width, x_pixel_height, + x_set_frame_alpha, x_set_menu_bar_lines, x_set_tool_bar_lines, + x_activate_menubar, x_real_positions, x_bitmap_icon, + x_set_menu_bar_lines, free_frame_menubar, x_free_frame_resources, + and x_query_colors. + + * frame.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * font.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * emacs.c: Include TERM_HEADER. + + * dispnew.c (d): Include TERM_HEADER instead of listing all + possible window-system headers. + + * ccl.h (c): Include character.h. + + * Makefile.in: Define WINDOW_SYSTEM_OBJ to hold objects needed for + the current window system; include in list of objects to link into + Emacs. + 2012-08-31 Dmitry Antipov Remove mark_ttys function and fix tty_display_info initialization. diff --git a/src/Makefile.in b/src/Makefile.in index 60df1f1c67..a809216f09 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -211,8 +211,8 @@ LIBXMENU=@LIBXMENU@ ## xmenu.o if HAVE_X_WINDOWS, else empty. XMENU_OBJ=@XMENU_OBJ@ -## xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o -## xsettings.o xgselect.o if HAVE_X_WINDOWS, else empty. +## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o if +## HAVE_X_WINDOWS, else empty. XOBJ=@XOBJ@ TOOLKIT_LIBW=@TOOLKIT_LIBW@ @@ -247,6 +247,9 @@ WIDGET_OBJ=@WIDGET_OBJ@ ## sheap.o if CYGWIN, otherwise empty. CYGWIN_OBJ=@CYGWIN_OBJ@ +## fontset.o fringe.o image.o if we have any window system +WINDOW_SYSTEM_OBJ=@WINDOW_SYSTEM_OBJ@ + ## dosfns.o msdos.o w16select.o if MSDOS. MSDOS_OBJ = ## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS. @@ -255,7 +258,6 @@ MSDOS_X_OBJ = ns_appdir=@ns_appdir@ ns_appbindir=@ns_appbindir@ ns_appsrc=@ns_appsrc@ -## fontset.o fringe.o image.o if HAVE_NS, else empty. NS_OBJ=@NS_OBJ@ ## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o if HAVE_NS. NS_OBJC_OBJ=@NS_OBJC_OBJ@ @@ -340,7 +342,8 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ process.o gnutls.o callproc.o \ region-cache.o sound.o atimer.o \ doprnt.o intervals.o textprop.o composite.o xml.o \ - $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) + $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ + $(WINDOW_SYSTEM_OBJ) obj = $(base_obj) $(NS_OBJC_OBJ) ## Object files used on some machine or other. diff --git a/src/ccl.h b/src/ccl.h index 71139175be..cc5daf11e1 100644 --- a/src/ccl.h +++ b/src/ccl.h @@ -26,6 +26,8 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_CCL_H #define EMACS_CCL_H +#include "character.h" /* For MAX_MULTIBYTE_LENGTH */ + /* Macros for exit status of CCL program. */ #define CCL_STAT_SUCCESS 0 /* Terminated successfully. */ #define CCL_STAT_SUSPEND_BY_SRC 1 /* Terminated by empty input. */ diff --git a/src/dispnew.c b/src/dispnew.c index 2d232d49c5..cac4c2da4c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -47,17 +47,9 @@ along with GNU Emacs. If not, see . */ #include "syssignal.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif /* HAVE_X_WINDOWS */ - -#ifdef HAVE_NTGUI -#include "w32term.h" -#endif /* HAVE_NTGUI */ - -#ifdef HAVE_NS -#include "nsterm.h" -#endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ /* Include systime.h after xterm.h to avoid double inclusion of time.h. */ diff --git a/src/emacs.c b/src/emacs.c index 7ff5c43dbe..d6e4887292 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -31,6 +31,10 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ + #ifdef WINDOWSNT #include #include /* just for w32.h */ @@ -62,20 +66,12 @@ along with GNU Emacs. If not, see . */ #include "gnutls.h" #endif -#ifdef HAVE_NS -#include "nsterm.h" -#endif - #if (defined PROFILING \ && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) # include extern void moncontrol (int mode); #endif -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - #ifdef HAVE_SETLOCALE #include #endif diff --git a/src/font.c b/src/font.c index 5b9e4f1cfc..cf9964f08f 100644 --- a/src/font.c +++ b/src/font.c @@ -38,17 +38,9 @@ along with GNU Emacs. If not, see . */ #include "fontset.h" #include "font.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif /* HAVE_X_WINDOWS */ - -#ifdef HAVE_NTGUI -#include "w32term.h" -#endif /* HAVE_NTGUI */ - -#ifdef HAVE_NS -#include "nsterm.h" -#endif /* HAVE_NS */ +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ Lisp_Object Qopentype; diff --git a/src/frame.c b/src/frame.c index 4785840a95..968cb4905a 100644 --- a/src/frame.c +++ b/src/frame.c @@ -30,15 +30,11 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "character.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif -#ifdef WINDOWSNT -#include "w32term.h" -#endif -#ifdef HAVE_NS -#include "nsterm.h" -#endif + +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ + #include "buffer.h" /* These help us bind and responding to switch-frame events. */ #include "commands.h" @@ -58,11 +54,6 @@ along with GNU Emacs. If not, see . */ #include "dosfns.h" #endif - -#ifdef HAVE_WINDOW_SYSTEM - -#endif - #ifdef HAVE_NS Lisp_Object Qns_parse_geometry; #endif diff --git a/src/frame.h b/src/frame.h index 8587f094a9..76fde8ec96 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1251,10 +1251,40 @@ extern Lisp_Object display_x_get_resource (Display_Info *, Lisp_Object component, Lisp_Object subclass); +extern void set_frame_menubar (struct frame *f, int first_time, int deep_p); +extern void x_set_window_size (struct frame *f, int change_grav, + int cols, int rows); +extern void x_sync (struct frame *); +extern Lisp_Object x_get_focus_frame (struct frame *); +extern void x_set_mouse_position (struct frame *f, int h, int v); +extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); +extern void x_make_frame_visible (struct frame *f); +extern void x_make_frame_invisible (struct frame *f); +extern void x_iconify_frame (struct frame *f); +extern int x_char_width (struct frame *f); +extern int x_char_height (struct frame *f); +extern int x_pixel_width (struct frame *f); +extern int x_pixel_height (struct frame *f); +extern void x_set_frame_alpha (struct frame *f); +extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_tool_bar_lines (struct frame *f, + Lisp_Object value, + Lisp_Object oldval); +extern void x_activate_menubar (struct frame *); +extern void x_real_positions (struct frame *, int *, int *); +extern int x_bitmap_icon (struct frame *, Lisp_Object); +extern void x_set_menu_bar_lines (struct frame *, + Lisp_Object, + Lisp_Object); +extern void free_frame_menubar (struct frame *); +extern void x_free_frame_resources (struct frame *); + #if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT extern char *x_get_resource_string (const char *, const char *); #endif +extern void x_query_colors (struct frame *f, XColor *, int); + /* In xmenu.c */ extern void set_frame_menubar (FRAME_PTR, int, int); diff --git a/src/gtkutil.h b/src/gtkutil.h index 462e879d3e..c1b6634999 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see . */ #include #include "frame.h" +#include "xterm.h" /* Minimum and maximum values used for GTK scroll bars */ diff --git a/src/image.c b/src/image.c index f2778165ec..c444c986a7 100644 --- a/src/image.c +++ b/src/image.c @@ -50,11 +50,19 @@ along with GNU Emacs. If not, see . */ #include "termhooks.h" #include "font.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#include +#ifdef HAVE_SYS_STAT_H #include +#endif /* HAVE_SYS_STAT_H */ + +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ +#ifdef HAVE_X_WINDOWS #define COLOR_TABLE_SUPPORT 1 typedef struct x_bitmap_record Bitmap_Record; @@ -67,11 +75,7 @@ typedef struct x_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #endif /* HAVE_X_WINDOWS */ - #ifdef HAVE_NTGUI -#include "w32.h" -#include "w32term.h" - /* W32_TODO : Color tables on W32. */ #undef COLOR_TABLE_SUPPORT @@ -84,15 +88,9 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_RETAIN 0 #define PIX_MASK_DRAW 1 -#define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual #define x_defined_color w32_defined_color #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) -/* Functions from w32term.c that depend on XColor (so can't go in w32term.h - without modifying lots of files). */ -extern void x_query_colors (struct frame *f, XColor *colors, int ncolors); -extern void x_query_color (struct frame *f, XColor *color); - /* Version of libpng that we were compiled with, or -1 if no PNG support was compiled in. This is tested by w32-win.el to correctly set up the alist used to search for PNG libraries. */ @@ -100,10 +98,6 @@ Lisp_Object Qlibpng_version; #endif /* HAVE_NTGUI */ #ifdef HAVE_NS -#include "nsterm.h" -#include -#include - #undef COLOR_TABLE_SUPPORT typedef struct ns_bitmap_record Bitmap_Record; @@ -117,10 +111,8 @@ typedef struct ns_bitmap_record Bitmap_Record; #define PIX_MASK_RETAIN 0 #define PIX_MASK_DRAW 1 -#define FRAME_X_VISUAL FRAME_NS_DISPLAY_INFO (f)->visual #define x_defined_color(f, name, color_def, alloc) \ ns_defined_color (f, name, color_def, alloc, 0) -#define FRAME_X_SCREEN(f) 0 #define DefaultDepthOfScreen(screen) x_display_list->n_planes #endif /* HAVE_NS */ @@ -577,6 +569,7 @@ static void x_emboss (struct frame *, struct image *); static int x_build_heuristic_mask (struct frame *, struct image *, Lisp_Object); #ifdef HAVE_NTGUI +extern Lisp_Object Vlibrary_cache, QCloaded_from; #define CACHE_IMAGE_TYPE(type, status) \ do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) #else diff --git a/src/keyboard.c b/src/keyboard.c index d9b88a8a91..7b1ea341e7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -63,20 +63,11 @@ along with GNU Emacs. If not, see . */ #include #include -/* This is to get the definitions of the XK_ symbols. */ -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - -#ifdef HAVE_NTGUI -#include "w32term.h" -#endif /* HAVE_NTGUI */ - -#ifdef HAVE_NS -#include "nsterm.h" -#endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ -/* Variables for blockinput.h: */ +/* Variables for blockinput.h: */ /* Non-zero if interrupt input is blocked right now. */ volatile int interrupt_input_blocked; @@ -1324,7 +1315,7 @@ usage: (track-mouse BODY...) */) If ignore_mouse_drag_p is non-zero, ignore (implicit) mouse movement after resizing the tool-bar window. */ -#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS +#if !defined HAVE_WINDOW_SYSTEM static #endif int ignore_mouse_drag_p; diff --git a/src/keyboard.h b/src/keyboard.h index 91484b3649..98b1933f3f 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -469,7 +469,7 @@ extern int waiting_for_input; happens. */ extern EMACS_TIME *input_available_clear_time; -#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS +#if defined HAVE_WINDOW_SYSTEM extern int ignore_mouse_drag_p; #endif diff --git a/src/menu.c b/src/menu.c index 3e466b46aa..2077053732 100644 --- a/src/menu.c +++ b/src/menu.c @@ -36,24 +36,13 @@ along with GNU Emacs. If not, see . */ #include "../lwlib/lwlib.h" #endif -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - -#ifdef HAVE_NS -#include "nsterm.h" -#endif - -#ifdef USE_GTK -#include "gtkutil.h" -#endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_NTGUI -#include "w32term.h" - extern AppendMenuW_Proc unicode_append_menu; extern HMENU current_popup_menu; - #endif /* HAVE_NTGUI */ #include "menu.h" diff --git a/src/nsterm.h b/src/nsterm.h index f9149d9757..f0cae19300 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -631,6 +631,8 @@ struct x_output /* This is the `Display *' which frame F is on. */ #define FRAME_NS_DISPLAY(f) (0) #define FRAME_X_DISPLAY(f) (0) +#define FRAME_X_SCREEN(f) (0) +#define FRAME_X_VISUAL(f) FRAME_NS_DISPLAY_INFO(f)->visual #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color) #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color) @@ -780,31 +782,6 @@ extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f, extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header); -/* More prototypes that should be moved to a more general include file */ -extern void set_frame_menubar (struct frame *f, int first_time, int deep_p); -extern void x_set_window_size (struct frame *f, int change_grav, - int cols, int rows); -extern void x_sync (struct frame *); -extern Lisp_Object x_get_focus_frame (struct frame *); -extern void x_set_mouse_position (struct frame *f, int h, int v); -extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); -extern void x_make_frame_visible (struct frame *f); -extern void x_make_frame_invisible (struct frame *f); -extern void x_iconify_frame (struct frame *f); -extern int x_char_width (struct frame *f); -extern int x_char_height (struct frame *f); -extern int x_pixel_width (struct frame *f); -extern int x_pixel_height (struct frame *f); -extern void x_set_frame_alpha (struct frame *f); -extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_tool_bar_lines (struct frame *f, - Lisp_Object value, - Lisp_Object oldval); -extern void x_activate_menubar (struct frame *); -extern void free_frame_menubar (struct frame *); -extern void x_free_frame_resources (struct frame *); -extern void x_destroy_window (struct frame *); - #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); diff --git a/src/process.c b/src/process.c index fbe56ebcb5..bfac054c3c 100644 --- a/src/process.c +++ b/src/process.c @@ -116,12 +116,13 @@ along with GNU Emacs. If not, see . */ #include "gnutls.h" #endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ + #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) #include "xgselect.h" #endif -#ifdef HAVE_NS -#include "nsterm.h" -#endif /* Work around GCC 4.7.0 bug with strict overflow checking; see . diff --git a/src/w32font.h b/src/w32font.h index b08d48a3d3..a29ddbe778 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_W32FONT_H #define EMACS_W32FONT_H +#include "font.h" /* Bit 17 of ntmFlags in NEWTEXTMETRIC is set for PostScript OpenType fonts, bit 18 for TrueType OpenType fonts, bit 20 for Type1 fonts. */ @@ -83,4 +84,7 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); Lisp_Object intern_font_name (char *); +extern void syms_of_w32font (void); +extern void globals_of_w32font (void); + #endif diff --git a/src/w32term.h b/src/w32term.h index 6fc2beeb18..5d756f435e 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -342,7 +342,7 @@ extern struct w32_output w32term_display; /* Return the window associated with the frame F. */ #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc) -#define FRAME_X_WINDOW(f) ((f)->output_data.w32->window_desc) +#define FRAME_X_WINDOW(f) FRAME_W32_WINDOW (f) #define FRAME_FONT(f) ((f)->output_data.w32->font) #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset) diff --git a/src/w32xfns.c b/src/w32xfns.c index 745a5cfe3e..62e45dd987 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -438,6 +438,6 @@ XParseGeometry (char *string, /* x_sync is a no-op on W32. */ void -x_sync (void *f) +x_sync (struct frame *f) { } diff --git a/src/xfaces.c b/src/xfaces.c index 820d764d0a..5554c4aa70 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -225,11 +225,10 @@ along with GNU Emacs. If not, see . */ #include "dosfns.h" #endif -#ifdef WINDOWSNT -#include "w32term.h" +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER #include "fontset.h" -/* Redefine X specifics to W32 equivalents to avoid cluttering the - code with #ifdef blocks. */ +#ifdef WINDOWSNT #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO #define x_display_info w32_display_info @@ -238,13 +237,13 @@ along with GNU Emacs. If not, see . */ #endif /* WINDOWSNT */ #ifdef HAVE_NS -#include "nsterm.h" #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO #define x_display_info ns_display_info #define check_x check_ns #define GCGraphicsExposures 0 #endif /* HAVE_NS */ +#endif /* HAVE_WINDOW_SYSTEM */ #include "buffer.h" #include "dispextern.h" @@ -254,9 +253,6 @@ along with GNU Emacs. If not, see . */ #include "termchar.h" #include "font.h" -#ifdef HAVE_WINDOW_SYSTEM -#include "fontset.h" -#endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_X_WINDOWS @@ -2565,13 +2561,13 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, } else if (EQ (keyword, QCstipple)) { -#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) +#if defined (HAVE_WINDOW_SYSTEM) Lisp_Object pixmap_p = Fbitmap_spec_p (value); if (!NILP (pixmap_p)) to[LFACE_STIPPLE_INDEX] = value; else err = 1; -#endif +#endif /* HAVE_WINDOW_SYSTEM */ } else if (EQ (keyword, QCwidth)) { @@ -3125,14 +3121,14 @@ FRAME 0 means change the face on all frames, and change the default } else if (EQ (attr, QCstipple)) { -#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) +#if defined (HAVE_WINDOW_SYSTEM) if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value) && !NILP (value) && NILP (Fbitmap_spec_p (value))) signal_error ("Invalid stipple attribute", value); old_value = LFACE_STIPPLE (lface); ASET (lface, LFACE_STIPPLE_INDEX, value); -#endif /* HAVE_X_WINDOWS || HAVE_NS */ +#endif /* HAVE_WINDOW_SYSTEM */ } else if (EQ (attr, QCwidth)) { diff --git a/src/xterm.h b/src/xterm.h index 007c92b929..2d718f4911 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -16,6 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +#ifndef XTERM_H +#define XTERM_H + #include #include @@ -367,13 +370,14 @@ extern int use_xim; extern void check_x (void); extern struct frame *x_window_to_frame (struct x_display_info *, int); - extern struct frame *x_any_window_to_frame (struct x_display_info *, int); extern struct frame *x_menubar_window_to_frame (struct x_display_info *, XEvent *); - extern struct frame *x_top_window_to_frame (struct x_display_info *, int); +extern struct frame *x_menubar_window_to_frame (struct x_display_info *, + XEvent *); + #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) #define x_any_window_to_frame x_window_to_frame #define x_top_window_to_frame x_window_to_frame @@ -389,7 +393,6 @@ extern struct x_display_info *x_display_list; extern Lisp_Object x_display_name_list; extern struct x_display_info *x_display_info_for_display (Display *); -extern void x_set_frame_alpha (struct frame *); extern struct x_display_info *x_term_init (Lisp_Object, char *, char *); extern int x_display_ok (const char *); @@ -941,7 +944,6 @@ XrmDatabase x_load_resources (Display *, const char *, const char *, /* Defined in xterm.c */ extern int x_text_icon (struct frame *, const char *); -extern int x_bitmap_icon (struct frame *, Lisp_Object); extern void x_catch_errors (Display *); extern void x_check_errors (Display *, const char *) ATTRIBUTE_FORMAT_PRINTF (2, 0); @@ -953,11 +955,6 @@ extern void x_set_mouse_position (struct frame *, int, int); extern void x_set_mouse_pixel_position (struct frame *, int, int); extern void xembed_request_focus (struct frame *); extern void x_ewmh_activate_frame (struct frame *); -extern void x_make_frame_visible (struct frame *); -extern void x_make_frame_invisible (struct frame *); -extern void x_iconify_frame (struct frame *); -extern void x_free_frame_resources (struct frame *); -extern void x_wm_set_size_hint (struct frame *, long, int); extern void x_delete_terminal (struct terminal *terminal); extern unsigned long x_copy_color (struct frame *, unsigned long); #ifdef USE_X_TOOLKIT @@ -970,7 +967,6 @@ extern int x_alloc_lighter_color_for_widget (Widget, Display *, Colormap, double, int); #endif extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *); -extern void x_query_colors (struct frame *f, XColor *, int); extern void x_query_color (struct frame *f, XColor *); extern void x_clear_area (Display *, Window, int, int, int, int, int); #if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK @@ -1029,8 +1025,6 @@ extern int xg_set_icon (struct frame *, Lisp_Object); extern int xg_set_icon_from_xpm_data (struct frame *, const char**); #endif /* USE_GTK */ -extern void x_real_positions (struct frame *, int *, int *); -extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); extern void xic_free_xfontset (struct frame *); extern void create_frame_xic (struct frame *); @@ -1040,9 +1034,6 @@ extern void xic_set_statusarea (struct frame *); extern void xic_set_xfontset (struct frame *, const char *); extern int x_pixel_width (struct frame *); extern int x_pixel_height (struct frame *); -extern int x_char_width (struct frame *); -extern int x_char_height (struct frame *); -extern void x_sync (struct frame *); extern int x_defined_color (struct frame *, const char *, XColor *, int); #ifdef HAVE_X_I18N extern void free_frame_xic (struct frame *); @@ -1050,7 +1041,6 @@ extern void free_frame_xic (struct frame *); extern char * xic_create_fontsetname (const char *base_fontname, int motif); # endif #endif -extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); /* Defined in xfaces.c */ @@ -1067,10 +1057,8 @@ extern void x_menu_set_in_use (int); #ifdef USE_MOTIF extern void x_menu_wait_for_event (void *data); #endif -extern void x_activate_menubar (struct frame *); extern int popup_activated (void); extern void initialize_frame_menubar (struct frame *); -extern void free_frame_menubar (struct frame *); /* Defined in widget.c */ @@ -1112,3 +1100,5 @@ extern Lisp_Object Qx_gtk_map_stock; (nr).y = (ry), \ (nr).width = (rwidth), \ (nr).height = (rheight)) + +#endif /* XTERM_H */ -- 2.20.1