summaryrefslogtreecommitdiff
path: root/src/xsettings.c
diff options
context:
space:
mode:
authorYuuki Harano <masm@masm11.ddo.jp>2017-10-28 16:16:29 +0900
committerJeff Walsh <fejfighter@gmail.com>2020-11-22 14:46:55 +1100
commitf6d8c5939bff5b5baf46578718999e06061e26ff (patch)
tree74b69d2afb55da82c4edcfbcfd8ce31ea5af7f18 /src/xsettings.c
parent2c7687738d0b7da60014a7af05ab199936617d71 (diff)
downloademacs-f6d8c5939bff5b5baf46578718999e06061e26ff.tar.gz
Introduce Pure GTK3 port
* src/xsettings.h: * src/xsettings.c: (dpyinfo_valid, store_tool_bar_style_changed) (XSETTINGS_FONT_NAME, get_prop_window, read_settings) (apply_xft_settings, read_and_apply_settings) (xft_settings_event, init_xsettings, xsettings_initialize): * src/xfaces.c: (x_create_gc, x_free_gc): * src/xdisp.c (redisplay_tool_bar, redisplay_internal) (draw_glyphs_debug, draw_glyphs, mouse_face_from_buffer_pos) (note_mouse_highlight): * src/terminal.c (Fterminal_live_p): * src/termhooks.h (enum output_method, GCALIGNED_STRUCT) (TERMINAL_FONT_CACHE): * src/process.c (wait_reading_process_output): * src/pgtkterm.h: * src/pgtkterm.c: * src/pgtkselect.h: * src/pgtkselect.c: * src/pgtkgui.h: * src/pgtkfns.c: * src/image.c: (XGetPixel, XPutPixel, image_create_bitmap_from_data) (image_create_bitmap_from_file, free_bitmap_record) (image_destroy_x_image, gui_put_x_image, image_get_x_image) (Create_Pixmap_From_Bitmap_Data, xbm_load_image, ) (xpm_load_image, lookup_rgb_color, image_disable_image) (image_build_heuristic_mask, imagemagick_load_image): * src/gtkutil.h: * src/gtkutil.c (PGTK_TRACE, xg_set_screen, xg_display_open) (xg_display_close, xg_create_default_cursor) (xg_get_pixbuf_from_pix_and_mask, xg_check_special_colors) (qttip_cb, hierarchy_ch_cb, xg_prepare_tooltip, ) (xg_show_tooltip, xg_hide_tooltip, xg_frame_resized) (xg_frame_set_char_size, xg_height_or_width_changed) (xg_set_widget_bg, style_changed_cb, xg_create_frame_widgets) (xg_free_frame_widgets, x_wm_set_size_hint, xg_frame_restack) (xg_mark_data, xg_update_frame_menubar, free_frame_menubar) (xg_update_submenu, xg_finish_scroll_bar_creation) (xg_update_scrollbar_pos, xg_update_horizontal_scrollbar_pos) (xg_set_toolkit_scroll_bar_thumb, xg_event_is_for_scrollbar) (draw_page, xg_pack_tool_bar, xg_create_tool_bar) (xg_update_tool_bar_sizes, update_frame_tool_bar) (free_frame_tool_bar, xg_change_toolbar_position): * src/ftcrfont.c: (ftcrfont_draw): * src/fringe.c: (init_fringe_bitmap): * src/frame.h (GCALIGNED_STRUCT, FRAME_WINDOW_P): * src/frame.c (Fframep): * src/font.h: * src/font.c (syms_of_font): * src/emacsgtkfixed.c: (emacs_fixed_get_preferred_width) (emacs_fixed_get_preferred_height, XSetWMSizeHints): * src/emacs.c (main): * src/dispnew.c (init_display_interactive): * src/dispextern.h: * src/alloc.c: (garbage_collect): * src/Makefile.in (PGTK_OBJ, PGTK_LIBS, base_obj, LIBES): * src/.gdbinit: * lisp/url/url-privacy.el (url-setup-privacy-info): * lisp/term/pgtk-win.el (featurep): * lisp/startup.el (command-line, fancy-splash-frame): * lisp/net/eww.el (eww-form-submit, eww-form-file) (eww-form-checkbox, eww-form-select): * lisp/mwheel.el (mouse-wheel-down-event, mouse-wheel-up-event): * lisp/loadup.el (featurep): * lisp/international/mule-cmds.el (set-coding-system-map): * lisp/frame.el (pgtk-frame-geometry, frame-geometry) (w32-frame-edges, frame-edges) (pgtk-mouse-absolute-pixel-position) (mouse-absolute-pixel-position) (pgtk-set-mouse-absolute-pixel-position) (pgtk-frame-list-z-order, frame-list-z-order) (pgtk-frame-restack, frame-restack, display-mouse-p) (display-graphic-p, display-symbol-keys-p, ) (display-pixel-height, display-mm-height, display-mm-width) (display-backing-store, display-save-under, display-color-cells) (display-planes, display-visual-class) (pgtk-display-monitor-attributes-list) (display-monitor-attributes-list): * lisp/faces.el (face-spec-set-match-display, tool-bar): * lisp/cus-edit.el (custom-button, custom-button-mouse) (custom-button-pressed, custom-display): * configure.ac (AUTO_DEPEND, XARGS_LIMIT, XWIDGETS_OBJ):
Diffstat (limited to 'src/xsettings.c')
-rw-r--r--src/xsettings.c54
1 files changed, 43 insertions, 11 deletions
diff --git a/src/xsettings.c b/src/xsettings.c
index 1ba1021e40b..444bea0884b 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -26,7 +26,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <byteswap.h>
#include "lisp.h"
+#ifndef HAVE_PGTK
#include "xterm.h"
+#else
+#include "gtkutil.h"
+#endif
#include "xsettings.h"
#include "frame.h"
#include "keyboard.h"
@@ -34,7 +38,12 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "termhooks.h"
#include "pdumper.h"
+#ifndef HAVE_PGTK
#include <X11/Xproto.h>
+#else
+typedef unsigned short CARD16;
+typedef unsigned int CARD32;
+#endif
#ifdef HAVE_GSETTINGS
#include <glib-object.h>
@@ -55,7 +64,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
static char *current_mono_font;
static char *current_font;
-static struct x_display_info *first_dpyinfo;
+static Display_Info *first_dpyinfo;
static Lisp_Object current_tool_bar_style;
/* Store a config changed event in to the event queue. */
@@ -73,14 +82,18 @@ store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
/* Return true if DPYINFO is still valid. */
static bool
-dpyinfo_valid (struct x_display_info *dpyinfo)
+dpyinfo_valid (Display_Info *dpyinfo)
{
bool found = false;
if (dpyinfo != NULL)
{
- struct x_display_info *d;
+ Display_Info *d;
for (d = x_display_list; !found && d; d = d->next)
+#ifndef HAVE_PGTK
found = d == dpyinfo && d->display == dpyinfo->display;
+#else
+ found = d == dpyinfo && d->gdpy == dpyinfo->gdpy;
+#endif
}
return found;
}
@@ -149,7 +162,7 @@ map_tool_bar_style (const char *tool_bar_style)
static void
store_tool_bar_style_changed (const char *newstyle,
- struct x_display_info *dpyinfo)
+ Display_Info *dpyinfo)
{
Lisp_Object style = map_tool_bar_style (newstyle);
if (EQ (current_tool_bar_style, style))
@@ -161,10 +174,12 @@ store_tool_bar_style_changed (const char *newstyle,
XCAR (dpyinfo->name_list_element));
}
+#ifndef HAVE_PGTK
#if defined USE_CAIRO || defined HAVE_XFT
#define XSETTINGS_FONT_NAME "Gtk/FontName"
#endif
#define XSETTINGS_TOOL_BAR_STYLE "Gtk/ToolbarStyle"
+#endif
enum {
SEEN_AA = 0x01,
@@ -321,10 +336,11 @@ something_changed_gconfCB (GConfClient *client,
#endif /* USE_CAIRO || HAVE_XFT */
+#ifndef HAVE_PGTK
/* Find the window that contains the XSETTINGS property values. */
static void
-get_prop_window (struct x_display_info *dpyinfo)
+get_prop_window (Display_Info *dpyinfo)
{
Display *dpy = dpyinfo->display;
@@ -339,6 +355,9 @@ get_prop_window (struct x_display_info *dpyinfo)
XUngrabServer (dpy);
}
+#endif
+
+#ifndef HAVE_PGTK
#define PAD(nr) (((nr) + 3) & ~3)
@@ -566,13 +585,15 @@ parse_settings (unsigned char *prop,
return settings_seen;
}
+#endif
+#ifndef HAVE_PGTK
/* Read settings from the XSettings property window on display for DPYINFO.
Store settings read in SETTINGS.
Return true iff successful. */
static bool
-read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
+read_settings (Display_Info *dpyinfo, struct xsettings *settings)
{
Atom act_type;
int act_form;
@@ -600,12 +621,14 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
return got_settings;
}
+#endif
+#ifndef HAVE_PGTK
/* Apply Xft settings in SETTINGS to the Xft library.
Store a Lisp event that Xft settings changed. */
static void
-apply_xft_settings (struct x_display_info *dpyinfo,
+apply_xft_settings (Display_Info *dpyinfo,
struct xsettings *settings)
{
#ifdef HAVE_XFT
@@ -731,12 +754,14 @@ apply_xft_settings (struct x_display_info *dpyinfo,
FcPatternDestroy (pat);
#endif /* HAVE_XFT */
}
+#endif
+#ifndef HAVE_PGTK
/* Read XSettings from the display for DPYINFO.
If SEND_EVENT_P store a Lisp event settings that changed. */
static void
-read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p)
+read_and_apply_settings (Display_Info *dpyinfo, bool send_event_p)
{
struct xsettings settings;
@@ -763,11 +788,13 @@ read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p)
}
#endif
}
+#endif
+#ifndef HAVE_PGTK
/* Check if EVENT for the display in DPYINFO is XSettings related. */
void
-xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
+xft_settings_event (Display_Info *dpyinfo, const XEvent *event)
{
bool check_window_p = false, apply_settings_p = false;
@@ -805,6 +832,7 @@ xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
if (apply_settings_p)
read_and_apply_settings (dpyinfo, true);
}
+#endif
/* Initialize GSettings and read startup values. */
@@ -940,10 +968,11 @@ init_gconf (void)
#endif /* HAVE_GCONF */
}
+#ifndef HAVE_PGTK
/* Init Xsettings and read startup values. */
static void
-init_xsettings (struct x_display_info *dpyinfo)
+init_xsettings (Display_Info *dpyinfo)
{
Display *dpy = dpyinfo->display;
@@ -959,13 +988,16 @@ init_xsettings (struct x_display_info *dpyinfo)
unblock_input ();
}
+#endif
void
-xsettings_initialize (struct x_display_info *dpyinfo)
+xsettings_initialize (Display_Info *dpyinfo)
{
if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo;
init_gconf ();
+#ifndef HAVE_PGTK
init_xsettings (dpyinfo);
+#endif
init_gsettings ();
}