aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-02-06 09:18:59 +0800
committerPo Lu2022-02-06 09:18:59 +0800
commitb38c0d6a2ff2dca89e9bf5feed49b7708ebf9942 (patch)
treee9f1b7077a58a2f6d3d7874b96dccce87305af9b /src
parent9c1d6b1d6a24338517756437757cc4aaaa4da4e5 (diff)
downloademacs-b38c0d6a2ff2dca89e9bf5feed49b7708ebf9942.tar.gz
emacs-b38c0d6a2ff2dca89e9bf5feed49b7708ebf9942.zip
Clean up lots of #ifdef'd out code in PGTK files
Most of them are either relics from X or from the NS code pgtkfns.c was copied from whole. * src/pgtkfns.c (x_icon): (pgtk_set_scroll_bar_foreground): (pgtk_set_scroll_bar_background): (Fx_create_frame): (pgtk_window_is_ancestor): (x_create_tip_frame): * src/pgtkselect.c (syms_of_pgtkselect): * src/pgtkterm.c (pgtk_iconify_frame): (x_set_frame_alpha): (button_event): Remove defined out code that cannot make sense. * src/pgtkmenu.c (show_help_event): Remove ifdef'd out code and reword comment.
Diffstat (limited to 'src')
-rw-r--r--src/pgtkfns.c85
-rw-r--r--src/pgtkmenu.c34
-rw-r--r--src/pgtkselect.c9
-rw-r--r--src/pgtkterm.c50
4 files changed, 15 insertions, 163 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index c7987afc7db..15e14f75e47 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -682,40 +682,6 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
682{ 682{
683} 683}
684 684
685
686static void
687x_icon (struct frame *f, Lisp_Object parms)
688/* --------------------------------------------------------------------------
689 Strangely-named function to set icon position parameters in frame.
690 This is irrelevant under macOS, but might be needed under GNUstep,
691 depending on the window manager used. Note, this is not a standard
692 frame parameter-setter; it is called directly from x-create-frame.
693 -------------------------------------------------------------------------- */
694{
695#if 0
696 Lisp_Object icon_x, icon_y;
697 struct pgtk_display_info *dpyinfo = check_pgtk_display_info (Qnil);
698
699 FRAME_X_OUTPUT (f)->icon_top = -1;
700 FRAME_X_OUTPUT (f)->icon_left = -1;
701
702 /* Set the position of the icon. */
703 icon_x =
704 gui_display_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER);
705 icon_y =
706 gui_display_get_arg (dpyinfo, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
707 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
708 {
709 CHECK_NUMBER (icon_x);
710 CHECK_NUMBER (icon_y);
711 FRAME_X_OUTPUT (f)->icon_top = XFIXNUM (icon_y);
712 FRAME_X_OUTPUT (f)->icon_left = XFIXNUM (icon_x);
713 }
714 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
715 error ("Both left and top icon corners of icon must be specified");
716#endif
717}
718
719/** 685/**
720 * x_set_undecorated: 686 * x_set_undecorated:
721 * 687 *
@@ -892,13 +858,10 @@ pgtk_set_scroll_bar_foreground (struct frame *f, Lisp_Object new_value,
892 if (!pgtk_parse_color (f, SSDATA (new_value), &rgb)) 858 if (!pgtk_parse_color (f, SSDATA (new_value), &rgb))
893 error ("Unknown color."); 859 error ("Unknown color.");
894 860
895 /* On pgtk, this frame parameter should be ignored, and honor gtk theme. */
896#if 0
897 char css[64]; 861 char css[64];
898 sprintf (css, "scrollbar slider { background-color: #%06x; }", 862 sprintf (css, "scrollbar slider { background-color: #%06x; }",
899 (unsigned int) rgb.pixel & 0xffffff); 863 (unsigned int) rgb.pixel & 0xffffff);
900 gtk_css_provider_load_from_data (css_provider, css, -1, NULL); 864 gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
901#endif
902 update_face_from_frame_parameter (f, Qscroll_bar_foreground, new_value); 865 update_face_from_frame_parameter (f, Qscroll_bar_foreground, new_value);
903 866
904 } 867 }
@@ -925,13 +888,13 @@ pgtk_set_scroll_bar_background (struct frame *f, Lisp_Object new_value,
925 if (!pgtk_parse_color (f, SSDATA (new_value), &rgb)) 888 if (!pgtk_parse_color (f, SSDATA (new_value), &rgb))
926 error ("Unknown color."); 889 error ("Unknown color.");
927 890
928 /* On pgtk, this frame parameter should be ignored, and honor gtk theme. */ 891 /* On pgtk, this frame parameter should be ignored, and honor
929#if 0 892 gtk theme. (It honors the GTK theme if not explictly set, so
893 I see no harm in letting users tinker a bit more.) */
930 char css[64]; 894 char css[64];
931 sprintf (css, "scrollbar trough { background-color: #%06x; }", 895 sprintf (css, "scrollbar trough { background-color: #%06x; }",
932 (unsigned int) rgb.pixel & 0xffffff); 896 (unsigned int) rgb.pixel & 0xffffff);
933 gtk_css_provider_load_from_data (css_provider, css, -1, NULL); 897 gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
934#endif
935 update_face_from_frame_parameter (f, Qscroll_bar_background, new_value); 898 update_face_from_frame_parameter (f, Qscroll_bar_background, new_value);
936 899
937 } 900 }
@@ -1378,9 +1341,6 @@ This function is an internal primitive--use `make-frame' instead. */ )
1378 1341
1379 f->output_method = output_pgtk; 1342 f->output_method = output_pgtk;
1380 FRAME_X_OUTPUT (f) = xzalloc (sizeof *FRAME_X_OUTPUT (f)); 1343 FRAME_X_OUTPUT (f) = xzalloc (sizeof *FRAME_X_OUTPUT (f));
1381#if 0
1382 FRAME_X_OUTPUT (f)->icon_bitmap = -1;
1383#endif
1384 FRAME_FONTSET (f) = -1; 1344 FRAME_FONTSET (f) = -1;
1385 FRAME_X_OUTPUT (f)->white_relief.pixel = -1; 1345 FRAME_X_OUTPUT (f)->white_relief.pixel = -1;
1386 FRAME_X_OUTPUT (f)->black_relief.pixel = -1; 1346 FRAME_X_OUTPUT (f)->black_relief.pixel = -1;
@@ -1478,12 +1438,8 @@ This function is an internal primitive--use `make-frame' instead. */ )
1478 error ("Invalid frame font"); 1438 error ("Invalid frame font");
1479 } 1439 }
1480 1440
1481 /* Frame contents get displaced if an embedded X window has a border. */ 1441 gui_default_parameter (f, parms, Qborder_width, make_fixnum (0),
1482#if 0 1442 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
1483 if (!FRAME_X_EMBEDDED_P (f))
1484#endif
1485 gui_default_parameter (f, parms, Qborder_width, make_fixnum (0),
1486 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
1487 1443
1488 if (NILP (Fassq (Qinternal_border_width, parms))) 1444 if (NILP (Fassq (Qinternal_border_width, parms)))
1489 { 1445 {
@@ -1627,10 +1583,6 @@ This function is an internal primitive--use `make-frame' instead. */ )
1627 RES_TYPE_BOOLEAN); 1583 RES_TYPE_BOOLEAN);
1628 f->no_split = minibuffer_only || EQ (tem, Qt); 1584 f->no_split = minibuffer_only || EQ (tem, Qt);
1629 1585
1630#if 0
1631 x_icon_verify (f, parms);
1632#endif
1633
1634 /* Create the X widget or window. */ 1586 /* Create the X widget or window. */
1635 /* x_window (f); */ 1587 /* x_window (f); */
1636 xg_create_frame_widgets (f); 1588 xg_create_frame_widgets (f);
@@ -1658,11 +1610,6 @@ This function is an internal primitive--use `make-frame' instead. */ )
1658 1610
1659#undef INSTALL_CURSOR 1611#undef INSTALL_CURSOR
1660 1612
1661 x_icon (f, parms);
1662#if 0
1663 x_make_gc (f);
1664#endif
1665
1666 /* Now consider the frame official. */ 1613 /* Now consider the frame official. */
1667 f->terminal->reference_count++; 1614 f->terminal->reference_count++;
1668 FRAME_DISPLAY_INFO (f)->reference_count++; 1615 FRAME_DISPLAY_INFO (f)->reference_count++;
@@ -1819,21 +1766,6 @@ This function is an internal primitive--use `make-frame' instead. */ )
1819 return unbind_to (count, frame); 1766 return unbind_to (count, frame);
1820} 1767}
1821 1768
1822
1823#if 0
1824static int
1825pgtk_window_is_ancestor (PGTKWindow * win, PGTKWindow * candidate)
1826/* Test whether CANDIDATE is an ancestor window of WIN. */
1827{
1828 if (candidate == NULL)
1829 return 0;
1830 else if (win == candidate)
1831 return 1;
1832 else
1833 return pgtk_window_is_ancestor (win,[candidate parentWindow]);
1834}
1835#endif
1836
1837/** 1769/**
1838 * x_frame_restack: 1770 * x_frame_restack:
1839 * 1771 *
@@ -2817,9 +2749,6 @@ x_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, struct
2817 counts etc. */ 2749 counts etc. */
2818 f->output_method = output_pgtk; 2750 f->output_method = output_pgtk;
2819 f->output_data.pgtk = xzalloc (sizeof *f->output_data.pgtk); 2751 f->output_data.pgtk = xzalloc (sizeof *f->output_data.pgtk);
2820#if 0
2821 f->output_data.pgtk->icon_bitmap = -1;
2822#endif
2823 FRAME_FONTSET (f) = -1; 2752 FRAME_FONTSET (f) = -1;
2824 f->output_data.pgtk->white_relief.pixel = -1; 2753 f->output_data.pgtk->white_relief.pixel = -1;
2825 f->output_data.pgtk->black_relief.pixel = -1; 2754 f->output_data.pgtk->black_relief.pixel = -1;
@@ -2945,10 +2874,6 @@ x_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, struct
2945 gtk_window_set_type_hint (GTK_WINDOW (tip_window), GDK_WINDOW_TYPE_HINT_TOOLTIP); 2874 gtk_window_set_type_hint (GTK_WINDOW (tip_window), GDK_WINDOW_TYPE_HINT_TOOLTIP);
2946 f->output_data.pgtk->current_cursor = f->output_data.pgtk->text_cursor; 2875 f->output_data.pgtk->current_cursor = f->output_data.pgtk->text_cursor;
2947 2876
2948#if 0
2949 x_make_gc (f);
2950#endif
2951
2952 gui_default_parameter (f, parms, Qauto_raise, Qnil, 2877 gui_default_parameter (f, parms, Qauto_raise, Qnil,
2953 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); 2878 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
2954 gui_default_parameter (f, parms, Qauto_lower, Qnil, 2879 gui_default_parameter (f, parms, Qauto_lower, Qnil,
diff --git a/src/pgtkmenu.c b/src/pgtkmenu.c
index d1b1bfffb36..18aaf57302d 100644
--- a/src/pgtkmenu.c
+++ b/src/pgtkmenu.c
@@ -141,31 +141,15 @@ popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
141static void 141static void
142show_help_event (struct frame *f, GtkWidget *widget, Lisp_Object help) 142show_help_event (struct frame *f, GtkWidget *widget, Lisp_Object help)
143{ 143{
144 /* Don't show this tooltip. 144 /* Don't show help echo on PGTK, as tooltips are always transient
145 * Tooltips are always tied to main widget, so stacking order 145 for the main widget, so on Wayland the menu will display above
146 * on Wayland is: 146 and obscure the tooltip. FIXME: this is some low hanging fruit
147 * (above) 147 for fixing. After you fix Fx_show_tip in pgtkterm.c so that it
148 * - menu 148 can display tooltips above menus, copy the definition of this
149 * - tooltip 149 function from xmenu.c.
150 * - main widget 150
151 * (below) 151 As a workaround, GTK is used to display menu tooltips, outside
152 * This is applicable to tooltips for menu, and menu tooltips 152 the Emacs help echo machinery. */
153 * are shown below menus.
154 * As a workaround, I entrust Gtk with menu tooltips, and
155 * let emacs not to show menu tooltips.
156 */
157
158#if 0
159 Lisp_Object frame;
160
161 if (f)
162 {
163 XSETFRAME (frame, f);
164 kbd_buffer_store_help_event (frame, help);
165 }
166 else
167 show_help_echo (help, Qnil, Qnil, Qnil);
168#endif
169} 153}
170 154
171/* Callback called when menu items are highlighted/unhighlighted 155/* Callback called when menu items are highlighted/unhighlighted
diff --git a/src/pgtkselect.c b/src/pgtkselect.c
index 23a79895d54..24fed19cd23 100644
--- a/src/pgtkselect.c
+++ b/src/pgtkselect.c
@@ -36,10 +36,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
36#include "pgtkselect.h" 36#include "pgtkselect.h"
37#include <gdk/gdk.h> 37#include <gdk/gdk.h>
38 38
39#if 0
40static Lisp_Object Vselection_alist;
41#endif
42
43static GQuark quark_primary_data = 0; 39static GQuark quark_primary_data = 0;
44static GQuark quark_primary_size = 0; 40static GQuark quark_primary_size = 0;
45static GQuark quark_secondary_data = 0; 41static GQuark quark_secondary_data = 0;
@@ -606,11 +602,6 @@ syms_of_pgtkselect (void)
606 defsubr (&Spgtk_selection_exists_p); 602 defsubr (&Spgtk_selection_exists_p);
607 defsubr (&Spgtk_selection_owner_p); 603 defsubr (&Spgtk_selection_owner_p);
608 604
609#if 0
610 Vselection_alist = Qnil;
611 staticpro (&Vselection_alist);
612#endif
613
614 DEFVAR_LISP ("pgtk-sent-selection-hooks", Vpgtk_sent_selection_hooks, 605 DEFVAR_LISP ("pgtk-sent-selection-hooks", Vpgtk_sent_selection_hooks,
615 "A list of functions to be called when Emacs answers a selection request.\n\ 606 "A list of functions to be called when Emacs answers a selection request.\n\
616The functions are called with four arguments:\n\ 607The functions are called with four arguments:\n\
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 23ad3c318c2..169d3f8a031 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -582,10 +582,6 @@ pgtk_iconify_frame (struct frame *f)
582 582
583 block_input (); 583 block_input ();
584 584
585#if 0
586 x_set_bitmap_icon (f);
587#endif
588
589 if (FRAME_GTK_OUTER_WIDGET (f)) 585 if (FRAME_GTK_OUTER_WIDGET (f))
590 { 586 {
591 if (!FRAME_VISIBLE_P (f)) 587 if (!FRAME_VISIBLE_P (f))
@@ -600,21 +596,9 @@ pgtk_iconify_frame (struct frame *f)
600 596
601 /* Make sure the X server knows where the window should be positioned, 597 /* Make sure the X server knows where the window should be positioned,
602 in case the user deiconifies with the window manager. */ 598 in case the user deiconifies with the window manager. */
603 if (!FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f) 599 if (!FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f))
604#if 0
605 && !FRAME_X_EMBEDDED_P (f)
606#endif
607 )
608 x_set_offset (f, f->left_pos, f->top_pos, 0); 600 x_set_offset (f, f->left_pos, f->top_pos, 0);
609 601
610#if 0
611 if (!FRAME_VISIBLE_P (f))
612 {
613 /* If the frame was withdrawn, before, we must map it. */
614 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
615 }
616#endif
617
618 SET_FRAME_ICONIFIED (f, true); 602 SET_FRAME_ICONIFIED (f, true);
619 SET_FRAME_VISIBLE (f, 0); 603 SET_FRAME_VISIBLE (f, 0);
620 604
@@ -4600,22 +4584,6 @@ x_set_frame_alpha (struct frame *f)
4600 else if (alpha < alpha_min && alpha_min <= 1.0) 4584 else if (alpha < alpha_min && alpha_min <= 1.0)
4601 alpha = alpha_min; 4585 alpha = alpha_min;
4602 4586
4603#if 0
4604 /* If there is a parent from the window manager, put the property there
4605 also, to work around broken window managers that fail to do that.
4606 Do this unconditionally as this function is called on reparent when
4607 alpha has not changed on the frame. */
4608
4609 if (!FRAME_PARENT_FRAME (f))
4610 {
4611 Window parent = x_find_topmost_parent (f);
4612 if (parent != None)
4613 XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
4614 XA_CARDINAL, 32, PropModeReplace,
4615 (unsigned char *) &opac, 1);
4616 }
4617#endif
4618
4619 set_opacity_recursively (FRAME_WIDGET (f), &alpha); 4587 set_opacity_recursively (FRAME_WIDGET (f), &alpha);
4620 /* without this, blending mode is strange on wayland. */ 4588 /* without this, blending mode is strange on wayland. */
4621 gtk_widget_queue_resize_no_redraw (FRAME_WIDGET (f)); 4589 gtk_widget_queue_resize_no_redraw (FRAME_WIDGET (f));
@@ -6152,9 +6120,6 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
6152 dpyinfo = FRAME_DISPLAY_INFO (frame); 6120 dpyinfo = FRAME_DISPLAY_INFO (frame);
6153 6121
6154 dpyinfo->last_mouse_glyph_frame = NULL; 6122 dpyinfo->last_mouse_glyph_frame = NULL;
6155#if 0
6156 x_display_set_last_user_time (dpyinfo, event->button.time);
6157#endif
6158 6123
6159 if (gui_mouse_grabbed (dpyinfo)) 6124 if (gui_mouse_grabbed (dpyinfo))
6160 f = dpyinfo->last_mouse_frame; 6125 f = dpyinfo->last_mouse_frame;
@@ -6183,14 +6148,6 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
6183 } 6148 }
6184 } 6149 }
6185 6150
6186 /* xg_event_is_for_scrollbar() doesn't work correctly on sway, and
6187 * we shouldn't need it.
6188 */
6189#if 0
6190 if (f && xg_event_is_for_scrollbar (f, event))
6191 f = 0;
6192#endif
6193
6194 if (f) 6151 if (f)
6195 { 6152 {
6196 /* Is this in the tab-bar? */ 6153 /* Is this in the tab-bar? */
@@ -6232,11 +6189,6 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
6232 if (!NILP (tab_bar_arg)) 6189 if (!NILP (tab_bar_arg))
6233 inev.ie.arg = tab_bar_arg; 6190 inev.ie.arg = tab_bar_arg;
6234 } 6191 }
6235#if 0
6236 if (FRAME_X_EMBEDDED_P (f))
6237 xembed_send_message (f, event->button.time,
6238 XEMBED_REQUEST_FOCUS, 0, 0, 0);
6239#endif
6240 } 6192 }
6241 6193
6242 if (event->type == GDK_BUTTON_PRESS) 6194 if (event->type == GDK_BUTTON_PRESS)