diff options
| author | Po Lu | 2022-04-06 12:27:57 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-06 12:27:57 +0800 |
| commit | 62eb57f43871dacb6c7ac1f6e2cdaf7add1414e2 (patch) | |
| tree | 0f4257717da2612a0780240058f7fdff97f92af0 /src | |
| parent | f0ff20be51980731364ef5ccf0505c35ea1b4e78 (diff) | |
| download | emacs-62eb57f43871dacb6c7ac1f6e2cdaf7add1414e2.tar.gz emacs-62eb57f43871dacb6c7ac1f6e2cdaf7add1414e2.zip | |
Clean up more PGTK code
* lisp/term/pgtk-win.el (featurep):
(pgtk):
(pgtk-use-im-context):
(pgtk-handle-nxopen):
(pgtk-handle-nxopentemp):
(pgtk-ignore-1-arg):
([C-drag-n-drop]):
([M-drag-n-drop]):
([C-M-drag-n-drop]):
(pgtk-alternate-modifier):
(pgtk-right-alternate-modifier):
(pgtk-right-command-modifier):
(pgtk-right-control-modifier):
(pgtk-do-hide-emacs):
(pgtk-hide-others):
(pgtk-do-hide-others):
(pgtk-emacs-info-panel):
(pgtk-do-emacs-info-panel):
(pgtk-next-frame):
(pgtk-prev-frame):
(after-make-frame-functions):
(tool-bar-mode):
(pgtk-toggle-toolbar):
(pgtk-print-buffer):
(scalable-fonts-allowed):
(pgtk-standard-fontset-spec):
(pgtk-store-cut-buffer-internal):
(pgtk-copy-including-secondary):
(pgtk-paste-secondary):
(pgtk-suspend-error):
(window-system-initialization):
(after-init-hook): Remove code mindlessly copied from ns-win.el,
delete unused custom group, write doc strings and rename
variables duplicated from X to their names on X. Also reformat
comments and code.
(pgtk-use-im-context-handler): New function.
* src/pgtkfns.c (syms_of_pgtkfns): Delete useless
AppleScript (!) code copied from NS.
* src/pgtkselect.c: Write FIXME about selection API usage.
* src/pgtkterm.c (get_keysym_name): Implement correctly instead
of sprintf'ing the numeric value of the keysym into a static
buffer.
(pgtk_set_window_size):
(xg_scroll_callback): Delete code that was #if 0'd out and
doesn't make sense on PGTK.
(pgtk_delete_terminal): Remove misleading comment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pgtkfns.c | 13 | ||||
| -rw-r--r-- | src/pgtkselect.c | 22 | ||||
| -rw-r--r-- | src/pgtkterm.c | 80 |
3 files changed, 31 insertions, 84 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c index 38e60858432..b028296720b 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c | |||
| @@ -38,13 +38,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 38 | #include "xsettings.h" | 38 | #include "xsettings.h" |
| 39 | #include "atimer.h" | 39 | #include "atimer.h" |
| 40 | 40 | ||
| 41 | |||
| 42 | #ifdef HAVE_PGTK | ||
| 43 | |||
| 44 | /* Static variables to handle applescript execution. */ | ||
| 45 | static Lisp_Object as_script, *as_result; | ||
| 46 | static int as_status; | ||
| 47 | |||
| 48 | static ptrdiff_t image_cache_refcount; | 41 | static ptrdiff_t image_cache_refcount; |
| 49 | 42 | ||
| 50 | static int x_decode_color (struct frame *f, Lisp_Object color_name, | 43 | static int x_decode_color (struct frame *f, Lisp_Object color_name, |
| @@ -4007,10 +4000,6 @@ be used as the image of the icon representing the frame. */); | |||
| 4007 | defsubr (&Sx_file_dialog); | 4000 | defsubr (&Sx_file_dialog); |
| 4008 | defsubr (&Sx_select_font); | 4001 | defsubr (&Sx_select_font); |
| 4009 | 4002 | ||
| 4010 | as_status = 0; | ||
| 4011 | as_script = Qnil; | ||
| 4012 | as_result = 0; | ||
| 4013 | |||
| 4014 | monitor_scale_factor_alist = Qnil; | 4003 | monitor_scale_factor_alist = Qnil; |
| 4015 | staticpro (&monitor_scale_factor_alist); | 4004 | staticpro (&monitor_scale_factor_alist); |
| 4016 | 4005 | ||
| @@ -4055,5 +4044,3 @@ be used as the image of the icon representing the frame. */); | |||
| 4055 | DEFSYM (Qreverse_portrait, "reverse-portrait"); | 4044 | DEFSYM (Qreverse_portrait, "reverse-portrait"); |
| 4056 | DEFSYM (Qreverse_landscape, "reverse-landscape"); | 4045 | DEFSYM (Qreverse_landscape, "reverse-landscape"); |
| 4057 | } | 4046 | } |
| 4058 | |||
| 4059 | #endif | ||
diff --git a/src/pgtkselect.c b/src/pgtkselect.c index 2660ea3ed38..2f4a872a05b 100644 --- a/src/pgtkselect.c +++ b/src/pgtkselect.c | |||
| @@ -17,13 +17,15 @@ GNU General Public License for more details. | |||
| 17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | /* | 20 | /* FIXME: this file needs a major rewrite to replace the use of GTK's |
| 21 | Originally by Carl Edman | 21 | own high-level GtkClipboard API with the GDK selection API: |
| 22 | Updated by Christian Limpach (chris@nice.ch) | 22 | |
| 23 | OpenStep/Rhapsody port by Scott Bender (sbender@harmony-ds.com) | 23 | https://developer-old.gnome.org/gdk3/stable/gdk3-Selections.html |
| 24 | macOS/Aqua port by Christophe de Dinechin (descubes@earthlink.net) | 24 | |
| 25 | GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | 25 | That way, most of the code can be shared with X, and non-text |
| 26 | */ | 26 | targets along with drag-and-drop can be supported. GDK implements |
| 27 | selections according to the ICCCM, as on X, but its selection API | ||
| 28 | will work on any supported window system. */ | ||
| 27 | 29 | ||
| 28 | /* This should be the first include, as it may set up #defines affecting | 30 | /* This should be the first include, as it may set up #defines affecting |
| 29 | interpretation of even the system includes. */ | 31 | interpretation of even the system includes. */ |
| @@ -151,10 +153,8 @@ selection_type_to_quarks (GdkAtom type, GQuark * quark_data, | |||
| 151 | *quark_size = quark_clipboard_size; | 153 | *quark_size = quark_clipboard_size; |
| 152 | } | 154 | } |
| 153 | else | 155 | else |
| 154 | { | 156 | /* FIXME: Is it safe to use 'error' here? */ |
| 155 | /* fixme: Is it safe to use 'error' here? */ | 157 | error ("Unknown selection type."); |
| 156 | error ("Unknown selection type."); | ||
| 157 | } | ||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | static void | 160 | static void |
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 94587381424..b2816aa04af 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -136,12 +136,10 @@ pgtk_toolkit_position (struct frame *f, int x, int y, | |||
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | /* | 139 | /* This is not a flip context in the same sense as gpu rendering |
| 140 | * This is not a flip context in the same sense as gpu rendering | 140 | scenes, it only occurs when a new context was required due to a |
| 141 | * scences, it only occurs when a new context was required due to a | 141 | resize or other fundamental change. This is called when that |
| 142 | * resize or other fundamental change. This is called when that | 142 | context's surface has completed drawing. */ |
| 143 | * context's surface has completed drawing | ||
| 144 | */ | ||
| 145 | 143 | ||
| 146 | static void | 144 | static void |
| 147 | flip_cr_context (struct frame *f) | 145 | flip_cr_context (struct frame *f) |
| @@ -221,14 +219,8 @@ mark_pgtkterm (void) | |||
| 221 | 219 | ||
| 222 | char * | 220 | char * |
| 223 | get_keysym_name (int keysym) | 221 | get_keysym_name (int keysym) |
| 224 | /* -------------------------------------------------------------------------- | ||
| 225 | Called by keyboard.c. Not sure if the return val is important, except | ||
| 226 | that it be unique. | ||
| 227 | -------------------------------------------------------------------------- */ | ||
| 228 | { | 222 | { |
| 229 | static char value[16]; | 223 | return gdk_keyval_name (keysym); |
| 230 | sprintf (value, "%d", keysym); | ||
| 231 | return value; | ||
| 232 | } | 224 | } |
| 233 | 225 | ||
| 234 | void | 226 | void |
| @@ -531,31 +523,8 @@ pgtk_set_window_size (struct frame *f, bool change_gravity, | |||
| 531 | gtk_widget_get_size_request (FRAME_GTK_WIDGET (f), &pixelwidth, | 523 | gtk_widget_get_size_request (FRAME_GTK_WIDGET (f), &pixelwidth, |
| 532 | &pixelheight); | 524 | &pixelheight); |
| 533 | 525 | ||
| 534 | #if 0 | ||
| 535 | if (pixelwise) | ||
| 536 | { | ||
| 537 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); | ||
| 538 | pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); | ||
| 539 | } | ||
| 540 | else | ||
| 541 | { | ||
| 542 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width); | ||
| 543 | pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); | ||
| 544 | } | ||
| 545 | #else | ||
| 546 | pixelwidth = width; | 526 | pixelwidth = width; |
| 547 | pixelheight = height; | 527 | pixelheight = height; |
| 548 | #endif | ||
| 549 | |||
| 550 | #if 0 | ||
| 551 | frame_size_history_add | ||
| 552 | (f, Qx_set_window_size_1, width, height, | ||
| 553 | list5 (Fcons (make_fixnum (pixelwidth), make_fixnum (pixelheight)), | ||
| 554 | Fcons (make_fixnum (pixelwidth), make_fixnum (pixelheight)), | ||
| 555 | make_fixnum (f->border_width), | ||
| 556 | make_fixnum (FRAME_PGTK_TITLEBAR_HEIGHT (f)), | ||
| 557 | make_fixnum (FRAME_TOOLBAR_HEIGHT (f)))); | ||
| 558 | #endif | ||
| 559 | 528 | ||
| 560 | for (GtkWidget * w = FRAME_GTK_WIDGET (f); w != NULL; | 529 | for (GtkWidget * w = FRAME_GTK_WIDGET (f); w != NULL; |
| 561 | w = gtk_widget_get_parent (w)) | 530 | w = gtk_widget_get_parent (w)) |
| @@ -3921,28 +3890,21 @@ xg_scroll_callback (GtkRange * range, | |||
| 3921 | switch (scroll) | 3890 | switch (scroll) |
| 3922 | { | 3891 | { |
| 3923 | case GTK_SCROLL_JUMP: | 3892 | case GTK_SCROLL_JUMP: |
| 3924 | #if 0 | 3893 | if (bar->horizontal) |
| 3925 | /* Buttons 1 2 or 3 must be grabbed. */ | 3894 | { |
| 3926 | if (FRAME_DISPLAY_INFO (f)->grabbed != 0 | 3895 | part = scroll_bar_horizontal_handle; |
| 3927 | && FRAME_DISPLAY_INFO (f)->grabbed < (1 << 4)) | 3896 | whole = (int) (gtk_adjustment_get_upper (adj) - |
| 3928 | #endif | 3897 | gtk_adjustment_get_page_size (adj)); |
| 3929 | { | 3898 | portion = min ((int) value, whole); |
| 3930 | if (bar->horizontal) | 3899 | bar->dragging = portion; |
| 3931 | { | 3900 | } |
| 3932 | part = scroll_bar_horizontal_handle; | 3901 | else |
| 3933 | whole = (int) (gtk_adjustment_get_upper (adj) - | 3902 | { |
| 3934 | gtk_adjustment_get_page_size (adj)); | 3903 | part = scroll_bar_handle; |
| 3935 | portion = min ((int) value, whole); | 3904 | whole = gtk_adjustment_get_upper (adj) - |
| 3936 | bar->dragging = portion; | 3905 | gtk_adjustment_get_page_size (adj); |
| 3937 | } | 3906 | portion = min ((int) value, whole); |
| 3938 | else | 3907 | bar->dragging = portion; |
| 3939 | { | ||
| 3940 | part = scroll_bar_handle; | ||
| 3941 | whole = gtk_adjustment_get_upper (adj) - | ||
| 3942 | gtk_adjustment_get_page_size (adj); | ||
| 3943 | portion = min ((int) value, whole); | ||
| 3944 | bar->dragging = portion; | ||
| 3945 | } | ||
| 3946 | } | 3908 | } |
| 3947 | break; | 3909 | break; |
| 3948 | case GTK_SCROLL_STEP_BACKWARD: | 3910 | case GTK_SCROLL_STEP_BACKWARD: |
| @@ -4505,8 +4467,6 @@ pgtk_delete_terminal (struct terminal *terminal) | |||
| 4505 | 4467 | ||
| 4506 | xg_display_close (dpyinfo->gdpy); | 4468 | xg_display_close (dpyinfo->gdpy); |
| 4507 | 4469 | ||
| 4508 | /* Do not close the connection here because it's already closed | ||
| 4509 | by X(t)CloseDisplay (Bug#18403). */ | ||
| 4510 | dpyinfo->gdpy = NULL; | 4470 | dpyinfo->gdpy = NULL; |
| 4511 | } | 4471 | } |
| 4512 | 4472 | ||