aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2020-03-31 01:32:10 +0900
committerJeff Walsh2020-11-24 12:24:39 +1100
commit49645df52e949da1c34a69f49aabbff300986893 (patch)
treece8f79f54d5c1993af9f3b734598148c3d8a2adc /src
parentcbd28cddea180ab3be14532e7a341c89ebc02fcc (diff)
downloademacs-49645df52e949da1c34a69f49aabbff300986893.tar.gz
emacs-49645df52e949da1c34a69f49aabbff300986893.zip
minimize gtkutil.c differences.
* src/pgtkterm.h: remove compiletime ifdefs * src/gtkutil.h: block out unused decl * src/gtkutil.c: (xg_get_pixbuf_from_pix_and_mask, xg_height_or_width_changed) (xg_create_frame_widgets, x_wm_set_size_hint) (xg_event_is_for_menubar, update_frame_tool_bar): resolve argument type mismatch. fix compatibility.
Diffstat (limited to 'src')
-rw-r--r--src/gtkutil.c50
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/pgtkterm.h7
3 files changed, 16 insertions, 43 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2a45f057fd4..6d6e4b46859 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
26 26
27#include <config.h> 27#include <config.h>
28 28
29#if defined(USE_GTK) 29#ifdef USE_GTK
30#include <float.h> 30#include <float.h>
31#include <stdio.h> 31#include <stdio.h>
32#include <stdlib.h> 32#include <stdlib.h>
@@ -53,7 +53,6 @@ typedef struct pgtk_output xp_output;
53#include "coding.h" 53#include "coding.h"
54#ifndef PGTK_TRACE 54#ifndef PGTK_TRACE
55#define PGTK_TRACE(fmt, ...) ((void) 0) 55#define PGTK_TRACE(fmt, ...) ((void) 0)
56#define PGTK_BACKTRACE() ((void) 0)
57#endif 56#endif
58 57
59#include <gdk/gdkkeysyms.h> 58#include <gdk/gdkkeysyms.h>
@@ -319,18 +318,16 @@ xg_create_default_cursor (GdkDisplay *gdpy)
319 318
320static GdkPixbuf * 319static GdkPixbuf *
321xg_get_pixbuf_from_pix_and_mask (struct frame *f, 320xg_get_pixbuf_from_pix_and_mask (struct frame *f,
322 Emacs_Pixmap pix, 321 Pixmap pix,
323 Emacs_Pixmap mask) 322 Pixmap mask)
324{ 323{
325 GdkPixbuf *icon_buf = 0; 324 GdkPixbuf *icon_buf = 0;
326 int iunused; 325 int iunused;
327 Window wunused; 326 Window wunused;
328 unsigned int width, height, depth, uunused; 327 unsigned int width, height, depth, uunused;
329 328
330#ifndef HAVE_PGTK
331 if (FRAME_DISPLAY_INFO (f)->red_bits != 8) 329 if (FRAME_DISPLAY_INFO (f)->red_bits != 8)
332 return 0; 330 return 0;
333
334 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused, 331 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
335 &width, &height, &uunused, &depth); 332 &width, &height, &uunused, &depth);
336 if (depth != 24) 333 if (depth != 24)
@@ -362,21 +359,10 @@ xg_get_pixbuf_from_pix_and_mask (struct frame *f,
362 XDestroyImage (xmm); 359 XDestroyImage (xmm);
363 XDestroyImage (xim); 360 XDestroyImage (xim);
364 } 361 }
365#else
366 width = pix->width;
367 height = pix->height;
368 depth = pix->bits_per_pixel;
369
370 icon_buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
371
372
373#endif
374 362
375 return icon_buf; 363 return icon_buf;
376} 364}
377 365
378
379
380#if defined USE_CAIRO && !defined HAVE_GTK3 366#if defined USE_CAIRO && !defined HAVE_GTK3
381static GdkPixbuf * 367static GdkPixbuf *
382xg_get_pixbuf_from_surface (cairo_surface_t *surface) 368xg_get_pixbuf_from_surface (cairo_surface_t *surface)
@@ -907,7 +893,6 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
907bool 893bool
908xg_hide_tooltip (struct frame *f) 894xg_hide_tooltip (struct frame *f)
909{ 895{
910 bool ret = 0;
911 if (f->output_data.xp->ttip_window) 896 if (f->output_data.xp->ttip_window)
912 { 897 {
913 GtkWindow *win = f->output_data.xp->ttip_window; 898 GtkWindow *win = f->output_data.xp->ttip_window;
@@ -1185,12 +1170,13 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
1185 } 1170 }
1186 else 1171 else
1187 adjust_frame_size (f, width, height, 5, 0, Qxg_frame_set_char_size); 1172 adjust_frame_size (f, width, height, 5, 0, Qxg_frame_set_char_size);
1173
1188} 1174}
1189 1175
1190#ifndef HAVE_PGTK
1191/* Handle height/width changes (i.e. add/remove/move menu/toolbar). 1176/* Handle height/width changes (i.e. add/remove/move menu/toolbar).
1192 The policy is to keep the number of editable lines. */ 1177 The policy is to keep the number of editable lines. */
1193 1178
1179#if 0
1194static void 1180static void
1195xg_height_or_width_changed (struct frame *f) 1181xg_height_or_width_changed (struct frame *f)
1196{ 1182{
@@ -1368,7 +1354,7 @@ xg_create_frame_widgets (struct frame *f)
1368 else 1354 else
1369 wtop = gtk_window_new (type); 1355 wtop = gtk_window_new (type);
1370#else 1356#else
1371 if (!NILP(f->parent_frame)){ 1357 if (!NILP(f->parent_frame)) {
1372 type = GTK_WINDOW_POPUP; 1358 type = GTK_WINDOW_POPUP;
1373 } 1359 }
1374 wtop = gtk_window_new (type); 1360 wtop = gtk_window_new (type);
@@ -1493,17 +1479,11 @@ xg_create_frame_widgets (struct frame *f)
1493#endif 1479#endif
1494 | GDK_VISIBILITY_NOTIFY_MASK); 1480 | GDK_VISIBILITY_NOTIFY_MASK);
1495 1481
1482#ifndef HAVE_PGTK
1496 /* Must realize the windows so the X window gets created. It is used 1483 /* Must realize the windows so the X window gets created. It is used
1497 by callers of this function. */ 1484 by callers of this function. */
1498#ifndef HAVE_PGTK
1499 gtk_widget_realize (wfixed); 1485 gtk_widget_realize (wfixed);
1500#else
1501 // gtk_widget_show_all(wtop);
1502#endif
1503#ifndef HAVE_PGTK
1504 FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (wfixed); 1486 FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (wfixed);
1505#endif
1506#ifndef HAVE_PGTK
1507 initial_set_up_x_back_buffer (f); 1487 initial_set_up_x_back_buffer (f);
1508#endif 1488#endif
1509 1489
@@ -1522,7 +1502,9 @@ xg_create_frame_widgets (struct frame *f)
1522 gtk_widget_modify_style (wfixed, style); 1502 gtk_widget_modify_style (wfixed, style);
1523#else 1503#else
1524 gtk_widget_set_can_focus (wfixed, TRUE); 1504 gtk_widget_set_can_focus (wfixed, TRUE);
1505#ifdef HAVE_PGTK
1525 gtk_widget_grab_focus(wfixed); 1506 gtk_widget_grab_focus(wfixed);
1507#endif
1526 gtk_window_set_resizable (GTK_WINDOW (wtop), TRUE); 1508 gtk_window_set_resizable (GTK_WINDOW (wtop), TRUE);
1527#endif 1509#endif
1528 1510
@@ -1717,7 +1699,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
1717 { 1699 {
1718 block_input (); 1700 block_input ();
1719 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1701 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1720 NULL, &size_hints, hint_flags); 1702 NULL, &size_hints, hint_flags);
1721 f->output_data.xp->size_hints = size_hints; 1703 f->output_data.xp->size_hints = size_hints;
1722 f->output_data.xp->hint_flags = hint_flags; 1704 f->output_data.xp->hint_flags = hint_flags;
1723 unblock_input (); 1705 unblock_input ();
@@ -3763,9 +3745,9 @@ free_frame_menubar (struct frame *f)
3763 3745
3764#ifndef HAVE_PGTK 3746#ifndef HAVE_PGTK
3765bool 3747bool
3766xg_event_is_for_menubar (struct frame *f, const EVENT *event) 3748xg_event_is_for_menubar (struct frame *f, const XEvent *event)
3767{ 3749{
3768 xp_output *x = f->output_data.xp; 3750 struct x_output *x = f->output_data.x;
3769 GList *iter; 3751 GList *iter;
3770 GdkRectangle rec; 3752 GdkRectangle rec;
3771 GList *list; 3753 GList *list;
@@ -4768,7 +4750,6 @@ xg_tool_bar_help_callback (GtkWidget *w,
4768} 4750}
4769 4751
4770 4752
4771#ifndef HAVE_GTK3
4772/* This callback is called when a tool bar item shall be redrawn. 4753/* This callback is called when a tool bar item shall be redrawn.
4773 It modifies the expose event so that the GtkImage widget redraws the 4754 It modifies the expose event so that the GtkImage widget redraws the
4774 whole image. This to overcome a bug that makes GtkImage draw the image 4755 whole image. This to overcome a bug that makes GtkImage draw the image
@@ -4779,6 +4760,7 @@ xg_tool_bar_help_callback (GtkWidget *w,
4779 4760
4780 Returns FALSE to tell GTK to keep processing this event. */ 4761 Returns FALSE to tell GTK to keep processing this event. */
4781 4762
4763#ifndef HAVE_GTK3
4782static gboolean 4764static gboolean
4783xg_tool_bar_item_expose_callback (GtkWidget *w, 4765xg_tool_bar_item_expose_callback (GtkWidget *w,
4784 GdkEventExpose *event, 4766 GdkEventExpose *event,
@@ -5189,11 +5171,7 @@ void
5189update_frame_tool_bar (struct frame *f) 5171update_frame_tool_bar (struct frame *f)
5190{ 5172{
5191 int i, j; 5173 int i, j;
5192#ifndef HAVE_PGTK 5174 xp_output *x = f->output_data.xp;
5193 struct x_output *x = f->output_data.xp;
5194#else
5195 struct pgtk_output *x = f->output_data.pgtk;
5196#endif
5197 int hmargin = 0, vmargin = 0; 5175 int hmargin = 0, vmargin = 0;
5198 GtkToolbar *wtoolbar; 5176 GtkToolbar *wtoolbar;
5199 GtkToolItem *ti; 5177 GtkToolItem *ti;
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 5087b3167d2..b7f67ba9281 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -180,9 +180,11 @@ extern bool xg_check_special_colors (struct frame *f,
180 const char *color_name, 180 const char *color_name,
181 Emacs_Color *color); 181 Emacs_Color *color);
182 182
183#ifndef HAVE_PGTK
183extern void xg_set_frame_icon (struct frame *f, 184extern void xg_set_frame_icon (struct frame *f,
184 Pixmap icon_pixmap, 185 Pixmap icon_pixmap,
185 Pixmap icon_mask); 186 Pixmap icon_mask);
187#endif
186 188
187extern void xg_set_undecorated (struct frame *f, Lisp_Object undecorated); 189extern void xg_set_undecorated (struct frame *f, Lisp_Object undecorated);
188extern void xg_frame_restack (struct frame *f1, struct frame *f2, bool above); 190extern void xg_frame_restack (struct frame *f1, struct frame *f2, bool above);
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index 9d6b0a1f800..bb9dca65fe4 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -41,11 +41,6 @@ extern void pgtk_backtrace(const char *file, int lineno);
41#define PGTK_BACKTRACE() ((void) 0) 41#define PGTK_BACKTRACE() ((void) 0)
42#endif 42#endif
43 43
44/* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
45#if GTK_CHECK_VERSION (2, 14, 0)
46#define USE_GTK_TOOLTIP
47#endif
48
49/* could use list to store these, but rest of emacs has a big infrastructure 44/* could use list to store these, but rest of emacs has a big infrastructure
50 for managing a table of bitmap "records" */ 45 for managing a table of bitmap "records" */
51struct pgtk_bitmap_record 46struct pgtk_bitmap_record
@@ -343,11 +338,9 @@ struct pgtk_output
343 bool_bf toolbar_in_hbox : 1; 338 bool_bf toolbar_in_hbox : 1;
344 bool_bf toolbar_is_packed : 1; 339 bool_bf toolbar_is_packed : 1;
345 340
346#ifdef USE_GTK_TOOLTIP
347 GtkTooltip *ttip_widget; 341 GtkTooltip *ttip_widget;
348 GtkWidget *ttip_lbl; 342 GtkWidget *ttip_lbl;
349 GtkWindow *ttip_window; 343 GtkWindow *ttip_window;
350#endif /* USE_GTK_TOOLTIP */
351 344
352 /* Height of menu bar widget, in pixels. This value 345 /* Height of menu bar widget, in pixels. This value
353 is not meaningful if the menubar is turned off. */ 346 is not meaningful if the menubar is turned off. */