aboutsummaryrefslogtreecommitdiffstats
path: root/src/pgtkterm.c
diff options
context:
space:
mode:
authorJeff Walsh2020-06-12 21:44:18 +1000
committerJeff Walsh2020-11-22 14:46:55 +1100
commit592badc3571cc3bb315db8f08ee38db4f6a8cb82 (patch)
tree246cb6f7bb025918996a325065454a77df2ca1c7 /src/pgtkterm.c
parent164800da6f673afeba729befbfbfd0e6131eadb8 (diff)
downloademacs-592badc3571cc3bb315db8f08ee38db4f6a8cb82.tar.gz
emacs-592badc3571cc3bb315db8f08ee38db4f6a8cb82.zip
Early toolbar improvements
* src/xdisp.c (redisplay_tool_bar): * src/pgtkterm.h: * src/pgtkterm.c: (pgtk_make_frame_visible, pgtk_make_frame_invisible) (pgtk_update_begin, pgtk_parse_color, pgtk_query_colors) (syms_of_pgtkterm): * src/pgtkfns.c: cleanup function * src/image.c (image_create_bitmap_from_file): * src/gtkutil.c (xg_get_pixbuf_from_pix_and_mask):
Diffstat (limited to 'src/pgtkterm.c')
-rw-r--r--src/pgtkterm.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 9fbf41c6fbc..e081d8c23e1 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -80,6 +80,8 @@ static struct event_queue_t {
80 80
81static Time ignore_next_mouse_click_timeout; 81static Time ignore_next_mouse_click_timeout;
82 82
83static Lisp_Object xg_default_icon_file;
84
83static void pgtk_delete_display (struct pgtk_display_info *dpyinfo); 85static void pgtk_delete_display (struct pgtk_display_info *dpyinfo);
84static void pgtk_clear_frame_area(struct frame *f, int x, int y, int width, int height); 86static void pgtk_clear_frame_area(struct frame *f, int x, int y, int width, int height);
85static void pgtk_fill_rectangle(struct frame *f, unsigned long color, int x, int y, int width, int height); 87static void pgtk_fill_rectangle(struct frame *f, unsigned long color, int x, int y, int width, int height);
@@ -475,6 +477,11 @@ pgtk_make_frame_visible (struct frame *f)
475 -------------------------------------------------------------------------- */ 477 -------------------------------------------------------------------------- */
476{ 478{
477 PGTK_TRACE("pgtk_make_frame_visible"); 479 PGTK_TRACE("pgtk_make_frame_visible");
480
481 GtkWidget *win = FRAME_OUTPUT_DATA(f)->widget;
482
483 gtk_widget_show(win);
484
478#if 0 485#if 0
479 NSTRACE ("x_make_frame_visible"); 486 NSTRACE ("x_make_frame_visible");
480 /* XXX: at some points in past this was not needed, as the only place that 487 /* XXX: at some points in past this was not needed, as the only place that
@@ -529,6 +536,11 @@ pgtk_make_frame_invisible (struct frame *f)
529 -------------------------------------------------------------------------- */ 536 -------------------------------------------------------------------------- */
530{ 537{
531 PGTK_TRACE("pgtk_make_frame_invisible"); 538 PGTK_TRACE("pgtk_make_frame_invisible");
539
540 GtkWidget *win = FRAME_OUTPUT_DATA(f)->widget;
541
542 gtk_widget_hide(win);
543
532#if 0 544#if 0
533 NSView *view; 545 NSView *view;
534 NSTRACE ("x_make_frame_invisible"); 546 NSTRACE ("x_make_frame_invisible");
@@ -2766,16 +2778,30 @@ pgtk_update_begin (struct frame *f)
2766 2778
2767 if (! FRAME_CR_SURFACE (f)) 2779 if (! FRAME_CR_SURFACE (f))
2768 { 2780 {
2769 int width = FRAME_PIXEL_WIDTH (f); 2781 int width, height;
2770 int height = FRAME_PIXEL_HEIGHT (f); 2782 if (FRAME_GTK_WIDGET (f))
2783 {
2784 GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
2785 width = gdk_window_get_width (w);
2786 height = gdk_window_get_height (w);
2787 }
2788 else
2789 {
2790 width = FRAME_PIXEL_WIDTH (f);
2791 height = FRAME_PIXEL_HEIGHT (f);
2792 if (! FRAME_EXTERNAL_TOOL_BAR (f))
2793 height += FRAME_TOOL_BAR_HEIGHT (f);
2794 if (! FRAME_EXTERNAL_MENU_BAR (f))
2795 height += FRAME_MENU_BAR_HEIGHT (f);
2796 }
2771 2797
2772 if (width > 0 && height > 0) 2798 if (width > 0 && height > 0)
2773 { 2799 {
2774 block_input(); 2800 block_input();
2775 FRAME_CR_SURFACE (f) = cairo_image_surface_create 2801 FRAME_CR_SURFACE (f) = cairo_image_surface_create
2776 (CAIRO_FORMAT_ARGB32, width, height); 2802 (CAIRO_FORMAT_ARGB32, width, height);
2777 unblock_input(); 2803 unblock_input();
2778 } 2804 }
2779 } 2805 }
2780 2806
2781 pgtk_clear_under_internal_border (f); 2807 pgtk_clear_under_internal_border (f);
@@ -6123,7 +6149,7 @@ pgtk_defined_color (struct frame *f,
6123 6149
6124int pgtk_parse_color (const char *color_name, Emacs_Color *color) 6150int pgtk_parse_color (const char *color_name, Emacs_Color *color)
6125{ 6151{
6126 // PGTK_TRACE("pgtk_parse_color: %s", color_name); 6152 PGTK_TRACE("pgtk_parse_color: %s", color_name);
6127 6153
6128 GdkRGBA rgba; 6154 GdkRGBA rgba;
6129 if (gdk_rgba_parse(&rgba, color_name)) { 6155 if (gdk_rgba_parse(&rgba, color_name)) {
@@ -6173,6 +6199,7 @@ pgtk_query_colors (struct frame *f, Emacs_Color *colors, int ncolors)
6173 colors[i].red = GetRValue (pixel) * 257; 6199 colors[i].red = GetRValue (pixel) * 257;
6174 colors[i].green = GetGValue (pixel) * 257; 6200 colors[i].green = GetGValue (pixel) * 257;
6175 colors[i].blue = GetBValue (pixel) * 257; 6201 colors[i].blue = GetBValue (pixel) * 257;
6202 PGTK_TRACE("pixel: %lx, red: %d, blue %d, green %d", colors[i].pixel, colors[i].red, colors[i].blue, colors[i].green);
6176 } 6203 }
6177} 6204}
6178 6205
@@ -6217,6 +6244,12 @@ syms_of_pgtkterm (void)
6217 6244
6218 DEFSYM (Qlatin_1, "latin-1"); 6245 DEFSYM (Qlatin_1, "latin-1");
6219 6246
6247 xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
6248 staticpro (&xg_default_icon_file);
6249
6250 DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock");
6251
6252
6220 Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier)); 6253 Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
6221 Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier)); 6254 Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
6222 Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier)); 6255 Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));