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):
This commit is contained in:
parent
164800da6f
commit
592badc357
6 changed files with 75 additions and 33 deletions
|
@ -316,8 +316,8 @@ xg_create_default_cursor (GdkDisplay *gdpy)
|
|||
|
||||
static GdkPixbuf *
|
||||
xg_get_pixbuf_from_pix_and_mask (struct frame *f,
|
||||
Pixmap pix,
|
||||
Pixmap mask)
|
||||
Emacs_Pixmap pix,
|
||||
Emacs_Pixmap mask)
|
||||
{
|
||||
GdkPixbuf *icon_buf = 0;
|
||||
int iunused;
|
||||
|
@ -327,7 +327,7 @@ xg_get_pixbuf_from_pix_and_mask (struct frame *f,
|
|||
#ifndef HAVE_PGTK
|
||||
if (FRAME_DISPLAY_INFO (f)->red_bits != 8)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
|
||||
&width, &height, &uunused, &depth);
|
||||
if (depth != 24)
|
||||
|
@ -359,10 +359,20 @@ xg_get_pixbuf_from_pix_and_mask (struct frame *f,
|
|||
XDestroyImage (xmm);
|
||||
XDestroyImage (xim);
|
||||
}
|
||||
#else
|
||||
width = pix->width;
|
||||
height = pix->height;
|
||||
depth = pix->bits_per_pixel;
|
||||
|
||||
icon_buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
return icon_buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined USE_CAIRO && !defined HAVE_GTK3
|
||||
static GdkPixbuf *
|
||||
|
@ -414,6 +424,8 @@ xg_get_pixbuf_from_surface (cairo_surface_t *surface)
|
|||
}
|
||||
#endif /* USE_CAIRO && !HAVE_GTK3 */
|
||||
|
||||
#endif /* !HAVE_PGTK */
|
||||
|
||||
static Lisp_Object
|
||||
file_for_image (Lisp_Object image)
|
||||
{
|
||||
|
|
17
src/image.c
17
src/image.c
|
@ -507,7 +507,22 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file)
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_PGTK
|
||||
return -1; // fixme:
|
||||
GError *err;
|
||||
ptrdiff_t id;
|
||||
void * bitmap = gdk_pixbuf_new_from_file(SSDATA(file), &err);
|
||||
|
||||
if (!bitmap)
|
||||
return -1;
|
||||
|
||||
id = image_allocate_bitmap_record(f);
|
||||
|
||||
dpyinfo->bitmaps[id - 1].img = bitmap;
|
||||
dpyinfo->bitmaps[id - 1].refcount = 1;
|
||||
dpyinfo->bitmaps[id - 1].file = xlispstrdup (file);
|
||||
//dpyinfo->bitmaps[id - 1].depth = 1;
|
||||
dpyinfo->bitmaps[id - 1].height = gdk_pixbuf_get_width (bitmap);
|
||||
dpyinfo->bitmaps[id - 1].width = gdk_pixbuf_get_height (bitmap);
|
||||
return id;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
|
|
|
@ -1394,22 +1394,6 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
return unbind_to (count, frame);
|
||||
}
|
||||
|
||||
void
|
||||
x_focus_frame (struct frame *f, bool noactivate)
|
||||
{
|
||||
struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
|
||||
|
||||
#if 0
|
||||
if (dpyinfo->x_focus_frame != f)
|
||||
{
|
||||
EmacsView *view = FRAME_PGTK_VIEW (f);
|
||||
block_input ();
|
||||
[NSApp activateIgnoringOtherApps: YES];
|
||||
[[view window] makeKeyAndOrderFront: view];
|
||||
unblock_input ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
|
|
|
@ -80,6 +80,8 @@ static struct event_queue_t {
|
|||
|
||||
static Time ignore_next_mouse_click_timeout;
|
||||
|
||||
static Lisp_Object xg_default_icon_file;
|
||||
|
||||
static void pgtk_delete_display (struct pgtk_display_info *dpyinfo);
|
||||
static void pgtk_clear_frame_area(struct frame *f, int x, int y, int width, int height);
|
||||
static 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)
|
|||
-------------------------------------------------------------------------- */
|
||||
{
|
||||
PGTK_TRACE("pgtk_make_frame_visible");
|
||||
|
||||
GtkWidget *win = FRAME_OUTPUT_DATA(f)->widget;
|
||||
|
||||
gtk_widget_show(win);
|
||||
|
||||
#if 0
|
||||
NSTRACE ("x_make_frame_visible");
|
||||
/* 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)
|
|||
-------------------------------------------------------------------------- */
|
||||
{
|
||||
PGTK_TRACE("pgtk_make_frame_invisible");
|
||||
|
||||
GtkWidget *win = FRAME_OUTPUT_DATA(f)->widget;
|
||||
|
||||
gtk_widget_hide(win);
|
||||
|
||||
#if 0
|
||||
NSView *view;
|
||||
NSTRACE ("x_make_frame_invisible");
|
||||
|
@ -2766,16 +2778,30 @@ pgtk_update_begin (struct frame *f)
|
|||
|
||||
if (! FRAME_CR_SURFACE (f))
|
||||
{
|
||||
int width = FRAME_PIXEL_WIDTH (f);
|
||||
int height = FRAME_PIXEL_HEIGHT (f);
|
||||
int width, height;
|
||||
if (FRAME_GTK_WIDGET (f))
|
||||
{
|
||||
GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
|
||||
width = gdk_window_get_width (w);
|
||||
height = gdk_window_get_height (w);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = FRAME_PIXEL_WIDTH (f);
|
||||
height = FRAME_PIXEL_HEIGHT (f);
|
||||
if (! FRAME_EXTERNAL_TOOL_BAR (f))
|
||||
height += FRAME_TOOL_BAR_HEIGHT (f);
|
||||
if (! FRAME_EXTERNAL_MENU_BAR (f))
|
||||
height += FRAME_MENU_BAR_HEIGHT (f);
|
||||
}
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
block_input();
|
||||
FRAME_CR_SURFACE (f) = cairo_image_surface_create
|
||||
(CAIRO_FORMAT_ARGB32, width, height);
|
||||
unblock_input();
|
||||
}
|
||||
{
|
||||
block_input();
|
||||
FRAME_CR_SURFACE (f) = cairo_image_surface_create
|
||||
(CAIRO_FORMAT_ARGB32, width, height);
|
||||
unblock_input();
|
||||
}
|
||||
}
|
||||
|
||||
pgtk_clear_under_internal_border (f);
|
||||
|
@ -6123,7 +6149,7 @@ pgtk_defined_color (struct frame *f,
|
|||
|
||||
int pgtk_parse_color (const char *color_name, Emacs_Color *color)
|
||||
{
|
||||
// PGTK_TRACE("pgtk_parse_color: %s", color_name);
|
||||
PGTK_TRACE("pgtk_parse_color: %s", color_name);
|
||||
|
||||
GdkRGBA rgba;
|
||||
if (gdk_rgba_parse(&rgba, color_name)) {
|
||||
|
@ -6173,6 +6199,7 @@ pgtk_query_colors (struct frame *f, Emacs_Color *colors, int ncolors)
|
|||
colors[i].red = GetRValue (pixel) * 257;
|
||||
colors[i].green = GetGValue (pixel) * 257;
|
||||
colors[i].blue = GetBValue (pixel) * 257;
|
||||
PGTK_TRACE("pixel: %lx, red: %d, blue %d, green %d", colors[i].pixel, colors[i].red, colors[i].blue, colors[i].green);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6217,6 +6244,12 @@ syms_of_pgtkterm (void)
|
|||
|
||||
DEFSYM (Qlatin_1, "latin-1");
|
||||
|
||||
xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
|
||||
staticpro (&xg_default_icon_file);
|
||||
|
||||
DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock");
|
||||
|
||||
|
||||
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
|
||||
Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
|
||||
Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
|
||||
|
|
|
@ -574,7 +574,7 @@ extern void pgtk_make_frame_invisible (struct frame *f);
|
|||
extern void x_wm_set_size_hint (struct frame *, long, bool);
|
||||
extern void x_free_frame_resources (struct frame *);
|
||||
extern void pgtk_iconify_frame (struct frame *f);
|
||||
extern void x_focus_frame (struct frame *f, bool noactivate);
|
||||
extern void pgtk_focus_frame (struct frame *f, bool noactivate);
|
||||
extern void pgtk_set_scroll_bar_default_width (struct frame *f);
|
||||
extern void pgtk_set_scroll_bar_default_height (struct frame *f);
|
||||
extern Lisp_Object x_get_focus_frame (struct frame *frame);
|
||||
|
|
|
@ -14330,10 +14330,8 @@ redisplay_tool_bar (struct frame *f)
|
|||
f->tool_bar_redisplayed = true;
|
||||
#ifdef HAVE_EXT_TOOL_BAR
|
||||
|
||||
#if 0
|
||||
if (FRAME_EXTERNAL_TOOL_BAR (f))
|
||||
update_frame_tool_bar (f);
|
||||
#endif
|
||||
return false;
|
||||
|
||||
#else /* ! (HAVE_EXT_TOOL_BAR) */
|
||||
|
|
Loading…
Add table
Reference in a new issue