diff options
| author | Alexander Gramiak | 2019-05-09 09:37:50 -0600 |
|---|---|---|
| committer | Alexander Gramiak | 2019-05-10 17:26:12 -0600 |
| commit | 616ce44ac53f08bf447cbc032f4bb10cd65c0b70 (patch) | |
| tree | 99e0fca55271fabf5e81819f95c19e484a5fa90b | |
| parent | 6bfc5fc6c4dfbed4b07528b64414fb04675cdf79 (diff) | |
| download | emacs-616ce44ac53f08bf447cbc032f4bb10cd65c0b70.tar.gz emacs-616ce44ac53f08bf447cbc032f4bb10cd65c0b70.zip | |
Convert Free_Pixmap macro into terminal hook
* src/termhooks.h (terminal) [HAVE_WINDOW_SYSTEM]: New terminal hook
free_pixmap.
* src/image.c: Replace Free_Pixmap with free_pixmap.
* src/msdos.h (FRAME_X_DISPLAY):
* src/nsgui.h (Display):
* src/nsterm.h (FRAME_NS_DISPLAY, FRAME_X_DISPLAY, FRAME_X_SCREEN)
(FRAME_X_VISUAL):
* src/w32term.h (FRAME_X_DISPLAY): Remove unused X-compatibility
macros and typedefs.
* src/nsterm.m:
* src/w32term.c:
* src/xterm.c: Implement and set free_pixmap hook.
| -rw-r--r-- | src/image.c | 24 | ||||
| -rw-r--r-- | src/msdos.h | 1 | ||||
| -rw-r--r-- | src/nsgui.h | 1 | ||||
| -rw-r--r-- | src/nsterm.h | 6 | ||||
| -rw-r--r-- | src/nsterm.m | 16 | ||||
| -rw-r--r-- | src/termhooks.h | 9 | ||||
| -rw-r--r-- | src/w32term.c | 14 | ||||
| -rw-r--r-- | src/w32term.h | 3 | ||||
| -rw-r--r-- | src/xterm.c | 12 |
9 files changed, 51 insertions, 35 deletions
diff --git a/src/image.c b/src/image.c index e8cb4341773..0779594989a 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1221,26 +1221,6 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners, | |||
| 1221 | return best; | 1221 | return best; |
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | /* Portability macros */ | ||
| 1225 | |||
| 1226 | #ifdef HAVE_NTGUI | ||
| 1227 | |||
| 1228 | #define Free_Pixmap(display, pixmap) \ | ||
| 1229 | DeleteObject (pixmap) | ||
| 1230 | |||
| 1231 | #elif defined (HAVE_NS) | ||
| 1232 | |||
| 1233 | #define Free_Pixmap(display, pixmap) \ | ||
| 1234 | ns_release_object (pixmap) | ||
| 1235 | |||
| 1236 | #else | ||
| 1237 | |||
| 1238 | #define Free_Pixmap(display, pixmap) \ | ||
| 1239 | XFreePixmap (display, pixmap) | ||
| 1240 | |||
| 1241 | #endif /* !HAVE_NTGUI && !HAVE_NS */ | ||
| 1242 | |||
| 1243 | |||
| 1244 | /* Return the `background' field of IMG. If IMG doesn't have one yet, | 1224 | /* Return the `background' field of IMG. If IMG doesn't have one yet, |
| 1245 | it is guessed heuristically. If non-zero, XIMG is an existing | 1225 | it is guessed heuristically. If non-zero, XIMG is an existing |
| 1246 | XImage object (or device context with the image selected on W32) to | 1226 | XImage object (or device context with the image selected on W32) to |
| @@ -1328,7 +1308,7 @@ image_clear_image_1 (struct frame *f, struct image *img, int flags) | |||
| 1328 | { | 1308 | { |
| 1329 | if (img->pixmap) | 1309 | if (img->pixmap) |
| 1330 | { | 1310 | { |
| 1331 | Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap); | 1311 | FRAME_TERMINAL (f)->free_pixmap (f, img->pixmap); |
| 1332 | img->pixmap = NO_PIXMAP; | 1312 | img->pixmap = NO_PIXMAP; |
| 1333 | /* NOTE (HAVE_NS): background color is NOT an indexed color! */ | 1313 | /* NOTE (HAVE_NS): background color is NOT an indexed color! */ |
| 1334 | img->background_valid = 0; | 1314 | img->background_valid = 0; |
| @@ -1347,7 +1327,7 @@ image_clear_image_1 (struct frame *f, struct image *img, int flags) | |||
| 1347 | { | 1327 | { |
| 1348 | if (img->mask) | 1328 | if (img->mask) |
| 1349 | { | 1329 | { |
| 1350 | Free_Pixmap (FRAME_X_DISPLAY (f), img->mask); | 1330 | FRAME_TERMINAL (f)->free_pixmap (f, img->mask); |
| 1351 | img->mask = NO_PIXMAP; | 1331 | img->mask = NO_PIXMAP; |
| 1352 | img->background_transparent_valid = 0; | 1332 | img->background_transparent_valid = 0; |
| 1353 | } | 1333 | } |
diff --git a/src/msdos.h b/src/msdos.h index 0d15df7a331..90ceea8e3d2 100644 --- a/src/msdos.h +++ b/src/msdos.h | |||
| @@ -95,7 +95,6 @@ typedef struct tty_display_info Display_Info; | |||
| 95 | extern struct tty_display_info the_only_display_info; | 95 | extern struct tty_display_info the_only_display_info; |
| 96 | extern struct tty_output the_only_tty_output; | 96 | extern struct tty_output the_only_tty_output; |
| 97 | 97 | ||
| 98 | #define FRAME_X_DISPLAY(f) ((Display *) 0) | ||
| 99 | #define FRAME_FONT(f) ((f)->output_data.tty->font) | 98 | #define FRAME_FONT(f) ((f)->output_data.tty->font) |
| 100 | #define FRAME_DISPLAY_INFO(f) (&the_only_display_info) | 99 | #define FRAME_DISPLAY_INFO(f) (&the_only_display_info) |
| 101 | 100 | ||
diff --git a/src/nsgui.h b/src/nsgui.h index c147f4dec49..ab6cdff1e5c 100644 --- a/src/nsgui.h +++ b/src/nsgui.h | |||
| @@ -115,7 +115,6 @@ typedef NSColor * Color; | |||
| 115 | typedef void * Color; | 115 | typedef void * Color; |
| 116 | #endif | 116 | #endif |
| 117 | typedef int Window; | 117 | typedef int Window; |
| 118 | typedef int Display; | ||
| 119 | 118 | ||
| 120 | 119 | ||
| 121 | /* Some sort of attempt to normalize rectangle handling. Seems a bit | 120 | /* Some sort of attempt to normalize rectangle handling. Seems a bit |
diff --git a/src/nsterm.h b/src/nsterm.h index 683f2dd9341..ffaf809785e 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -997,12 +997,6 @@ struct x_output | |||
| 997 | #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc) | 997 | #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc) |
| 998 | #define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f) | 998 | #define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f) |
| 999 | 999 | ||
| 1000 | /* This is the `Display *' which frame F is on. */ | ||
| 1001 | #define FRAME_NS_DISPLAY(f) (0) | ||
| 1002 | #define FRAME_X_DISPLAY(f) (0) | ||
| 1003 | #define FRAME_X_SCREEN(f) (0) | ||
| 1004 | #define FRAME_X_VISUAL(f) FRAME_DISPLAY_INFO(f)->visual | ||
| 1005 | |||
| 1006 | #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color) | 1000 | #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color) |
| 1007 | #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color) | 1001 | #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color) |
| 1008 | 1002 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index ffb7b7692b4..d688aceca53 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -2515,8 +2515,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2515 | 2515 | ||
| 2516 | /* Clear the mouse-moved flag for every frame on this display. */ | 2516 | /* Clear the mouse-moved flag for every frame on this display. */ |
| 2517 | FOR_EACH_FRAME (tail, frame) | 2517 | FOR_EACH_FRAME (tail, frame) |
| 2518 | if (FRAME_NS_P (XFRAME (frame)) | 2518 | if (FRAME_NS_P (XFRAME (frame))) |
| 2519 | && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp)) | ||
| 2520 | XFRAME (frame)->mouse_moved = 0; | 2519 | XFRAME (frame)->mouse_moved = 0; |
| 2521 | 2520 | ||
| 2522 | dpyinfo->last_mouse_scroll_bar = nil; | 2521 | dpyinfo->last_mouse_scroll_bar = nil; |
| @@ -4968,6 +4967,18 @@ ns_judge_scroll_bars (struct frame *f) | |||
| 4968 | 4967 | ||
| 4969 | /* ========================================================================== | 4968 | /* ========================================================================== |
| 4970 | 4969 | ||
| 4970 | Image Hooks | ||
| 4971 | |||
| 4972 | ========================================================================== */ | ||
| 4973 | |||
| 4974 | static void | ||
| 4975 | ns_free_pixmap (struct frame *_f, Pixmap pixmap) | ||
| 4976 | { | ||
| 4977 | ns_release_object (pixmap); | ||
| 4978 | } | ||
| 4979 | |||
| 4980 | /* ========================================================================== | ||
| 4981 | |||
| 4971 | Initialization | 4982 | Initialization |
| 4972 | 4983 | ||
| 4973 | ========================================================================== */ | 4984 | ========================================================================== */ |
| @@ -5196,6 +5207,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo) | |||
| 5196 | terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; | 5207 | terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; |
| 5197 | terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; | 5208 | terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; |
| 5198 | terminal->get_string_resource_hook = ns_get_string_resource; | 5209 | terminal->get_string_resource_hook = ns_get_string_resource; |
| 5210 | terminal->free_pixmap = ns_free_pixmap; | ||
| 5199 | terminal->delete_frame_hook = ns_destroy_window; | 5211 | terminal->delete_frame_hook = ns_destroy_window; |
| 5200 | terminal->delete_terminal_hook = ns_delete_terminal; | 5212 | terminal->delete_terminal_hook = ns_delete_terminal; |
| 5201 | /* Other hooks are NULL by default. */ | 5213 | /* Other hooks are NULL by default. */ |
diff --git a/src/termhooks.h b/src/termhooks.h index 54f09e03033..0962add0817 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -741,6 +741,15 @@ struct terminal | |||
| 741 | const char *name, | 741 | const char *name, |
| 742 | const char *class); | 742 | const char *class); |
| 743 | 743 | ||
| 744 | /* Image hooks */ | ||
| 745 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 746 | /* Free the pixmap PIXMAP on F. */ | ||
| 747 | void (*free_pixmap) (struct frame *f, Pixmap pixmap); | ||
| 748 | |||
| 749 | #endif | ||
| 750 | |||
| 751 | /* Deletion hooks */ | ||
| 752 | |||
| 744 | /* Called to delete the device-specific portions of a frame that is | 753 | /* Called to delete the device-specific portions of a frame that is |
| 745 | on this terminal device. */ | 754 | on this terminal device. */ |
| 746 | void (*delete_frame_hook) (struct frame *); | 755 | void (*delete_frame_hook) (struct frame *); |
diff --git a/src/w32term.c b/src/w32term.c index 0abec3d92a7..435455e1a6d 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -6869,6 +6869,7 @@ w32_wm_set_size_hint (struct frame *f, long flags, bool user_position) | |||
| 6869 | leave_crit (); | 6869 | leave_crit (); |
| 6870 | } | 6870 | } |
| 6871 | 6871 | ||
| 6872 | |||
| 6872 | /*********************************************************************** | 6873 | /*********************************************************************** |
| 6873 | Fonts | 6874 | Fonts |
| 6874 | ***********************************************************************/ | 6875 | ***********************************************************************/ |
| @@ -6940,6 +6941,18 @@ w32_toggle_invisible_pointer (struct frame *f, bool invisible) | |||
| 6940 | unblock_input (); | 6941 | unblock_input (); |
| 6941 | } | 6942 | } |
| 6942 | 6943 | ||
| 6944 | |||
| 6945 | /*********************************************************************** | ||
| 6946 | Image Hooks | ||
| 6947 | ***********************************************************************/ | ||
| 6948 | |||
| 6949 | static void | ||
| 6950 | w32_free_pixmap (struct frame *_f, Pixmap pixmap) | ||
| 6951 | { | ||
| 6952 | DeleteObject (pixmap); | ||
| 6953 | } | ||
| 6954 | |||
| 6955 | |||
| 6943 | /*********************************************************************** | 6956 | /*********************************************************************** |
| 6944 | Initialization | 6957 | Initialization |
| 6945 | ***********************************************************************/ | 6958 | ***********************************************************************/ |
| @@ -7119,6 +7132,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) | |||
| 7119 | terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; | 7132 | terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; |
| 7120 | terminal->judge_scroll_bars_hook = w32_judge_scroll_bars; | 7133 | terminal->judge_scroll_bars_hook = w32_judge_scroll_bars; |
| 7121 | terminal->get_string_resource_hook = w32_get_string_resource; | 7134 | terminal->get_string_resource_hook = w32_get_string_resource; |
| 7135 | terminal->free_pixmap = w32_free_pixmap; | ||
| 7122 | terminal->delete_frame_hook = w32_destroy_window; | 7136 | terminal->delete_frame_hook = w32_destroy_window; |
| 7123 | terminal->delete_terminal_hook = w32_delete_terminal; | 7137 | terminal->delete_terminal_hook = w32_delete_terminal; |
| 7124 | /* Other hooks are NULL by default. */ | 7138 | /* Other hooks are NULL by default. */ |
diff --git a/src/w32term.h b/src/w32term.h index de372d7e5d7..a03b9fd3311 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -420,9 +420,6 @@ extern struct w32_output w32term_display; | |||
| 420 | /* This gives the w32_display_info structure for the display F is on. */ | 420 | /* This gives the w32_display_info structure for the display F is on. */ |
| 421 | #define FRAME_DISPLAY_INFO(f) ((void) (f), (&one_w32_display_info)) | 421 | #define FRAME_DISPLAY_INFO(f) ((void) (f), (&one_w32_display_info)) |
| 422 | 422 | ||
| 423 | /* This is the `Display *' which frame F is on. */ | ||
| 424 | #define FRAME_X_DISPLAY(f) (0) | ||
| 425 | |||
| 426 | #define FRAME_NORMAL_PLACEMENT(F) ((F)->output_data.w32->normal_placement) | 423 | #define FRAME_NORMAL_PLACEMENT(F) ((F)->output_data.w32->normal_placement) |
| 427 | #define FRAME_PREV_FSMODE(F) ((F)->output_data.w32->prev_fsmode) | 424 | #define FRAME_PREV_FSMODE(F) ((F)->output_data.w32->prev_fsmode) |
| 428 | 425 | ||
diff --git a/src/xterm.c b/src/xterm.c index bd69e6c7a82..9371d47c95e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -12182,6 +12182,17 @@ x_check_font (struct frame *f, struct font *font) | |||
| 12182 | 12182 | ||
| 12183 | 12183 | ||
| 12184 | /*********************************************************************** | 12184 | /*********************************************************************** |
| 12185 | Image Hooks | ||
| 12186 | ***********************************************************************/ | ||
| 12187 | |||
| 12188 | static void | ||
| 12189 | x_free_pixmap (struct frame *f, Pixmap pixmap) | ||
| 12190 | { | ||
| 12191 | XFreePixmap (FRAME_X_DISPLAY (f), pixmap); | ||
| 12192 | } | ||
| 12193 | |||
| 12194 | |||
| 12195 | /*********************************************************************** | ||
| 12185 | Initialization | 12196 | Initialization |
| 12186 | ***********************************************************************/ | 12197 | ***********************************************************************/ |
| 12187 | 12198 | ||
| @@ -13257,6 +13268,7 @@ x_create_terminal (struct x_display_info *dpyinfo) | |||
| 13257 | terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; | 13268 | terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; |
| 13258 | terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; | 13269 | terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; |
| 13259 | terminal->get_string_resource_hook = x_get_string_resource; | 13270 | terminal->get_string_resource_hook = x_get_string_resource; |
| 13271 | terminal->free_pixmap = x_free_pixmap; | ||
| 13260 | terminal->delete_frame_hook = x_destroy_window; | 13272 | terminal->delete_frame_hook = x_destroy_window; |
| 13261 | terminal->delete_terminal_hook = x_delete_terminal; | 13273 | terminal->delete_terminal_hook = x_delete_terminal; |
| 13262 | /* Other hooks are NULL by default. */ | 13274 | /* Other hooks are NULL by default. */ |