/* Handle negative positions without consulting
gtk_window_parse_geometry (Bug#25851). The position will
be off by scrollbar width + window manager decorations. */
+#ifndef HAVE_PGTK
if (f->size_hint_flags & XNegative)
f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
- FRAME_PIXEL_WIDTH (f) + f->left_pos);
if (f->size_hint_flags & YNegative)
f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
- FRAME_PIXEL_HEIGHT (f) + f->top_pos);
+#else
+ if (f->size_hint_flags & XNegative)
+ f->left_pos = (pgtk_display_pixel_width (FRAME_DISPLAY_INFO (f))
+ - FRAME_PIXEL_WIDTH (f) + f->left_pos);
+
+ if (f->size_hint_flags & YNegative)
+ f->top_pos = (pgtk_display_pixel_height (FRAME_DISPLAY_INFO (f))
+ - FRAME_PIXEL_HEIGHT (f) + f->top_pos);
+#endif
/* GTK works in scaled pixels, so convert from X pixels. */
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_height /= xg_get_scale (f);
outer_width /= xg_get_scale (f);
- x_wm_set_size_hint (f, 0, 0);
+ xg_wm_set_size_hint (f, 0, 0);
/* Resize the top level widget so rows and columns remain constant.
flag (this is useful when FLAGS is 0). */
void
-x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
+xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
{
/* Must use GTK routines here, otherwise GTK resets the size hints
to its own defaults. */
extern int xg_get_default_scrollbar_width (struct frame *f);
extern int xg_get_default_scrollbar_height (struct frame *f);
+extern void xg_wm_set_size_hint (struct frame *, long int, bool);
+
extern void update_frame_tool_bar (struct frame *f);
extern void free_frame_tool_bar (struct frame *f);
extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos);
extern bool xg_filter_key (struct frame *frame, XEvent *xkey);
#endif
-/* Mark all callback data that are Lisp_object:s during GC. */
+/* Mark all callback data that are Lisp_Objects during GC. */
extern void xg_mark_data (void);
/* Initialize GTK specific parts. */
&& FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount)
FRAME_IMAGE_CACHE (f)->refcount++;
- x_free_frame_resources (f);
+ pgtk_free_frame_resources (f);
free_glyphs (f);
return Qt;
}
badly we want them. This should be done after we have the menu
bar so that its size can be taken into account. */
block_input ();
- x_wm_set_size_hint (f, window_prompting, false);
+ xg_wm_set_size_hint (f, window_prompting, false);
unblock_input ();
adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
{
min_x = 0;
min_y = 0;
- max_x = x_display_pixel_width (FRAME_DISPLAY_INFO (f));
- max_y = x_display_pixel_height (FRAME_DISPLAY_INFO (f));
+ max_x = pgtk_display_pixel_width (FRAME_DISPLAY_INFO (f));
+ max_y = pgtk_display_pixel_height (FRAME_DISPLAY_INFO (f));
}
if (INTEGERP (top))
/* Free X resources of frame F. */
void
-x_free_frame_resources (struct frame *f)
+pgtk_free_frame_resources (struct frame *f)
{
struct pgtk_display_info *dpyinfo;
Mouse_HLInfo *hlinfo;
}
void
-x_destroy_window (struct frame *f)
+pgtk_destroy_window (struct frame *f)
/* --------------------------------------------------------------------------
External: Delete the window
-------------------------------------------------------------------------- */
check_window_system (f);
if (dpyinfo->gdpy != NULL)
- x_free_frame_resources (f);
+ pgtk_free_frame_resources (f);
dpyinfo->reference_count--;
}
from its current recorded position values and gravity. */
static void
-x_calc_absolute_position (struct frame *f)
+pgtk_calc_absolute_position (struct frame *f)
{
int flags = f->size_hint_flags;
struct frame *p = FRAME_PARENT_FRAME (f);
f->left_pos = (FRAME_PIXEL_WIDTH (p) - width - 2 * f->border_width
+ f->left_pos);
else
- f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
+ f->left_pos = (pgtk_display_pixel_width (FRAME_DISPLAY_INFO (f))
- width + f->left_pos);
}
f->top_pos = (FRAME_PIXEL_HEIGHT (p) - height - 2 * f->border_width
+ f->top_pos);
else
- f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
+ f->top_pos = (pgtk_display_pixel_height (FRAME_DISPLAY_INFO (f))
- height + f->top_pos);
}
f->win_gravity = NorthWestGravity;
}
- x_calc_absolute_position (f);
+ pgtk_calc_absolute_position (f);
block_input ();
- x_wm_set_size_hint (f, 0, false);
+ xg_wm_set_size_hint (f, 0, false);
if (change_gravity != 0)
{
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- f->left_pos, f->top_pos);
- }
+ gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ f->left_pos, f->top_pos);
else
{
GtkWidget *fixed = FRAME_GTK_WIDGET (f);
f->output_data.pgtk->preferred_width = pixelwidth;
f->output_data.pgtk->preferred_height = pixelheight;
- x_wm_set_size_hint (f, 0, 0);
+ xg_wm_set_size_hint (f, 0, 0);
xg_frame_set_char_size (f, pixelwidth, pixelheight);
gtk_widget_queue_resize (FRAME_WIDGET (f));
}
int
-x_display_pixel_height (struct pgtk_display_info *dpyinfo)
+pgtk_display_pixel_height (struct pgtk_display_info *dpyinfo)
{
GdkDisplay *gdpy = dpyinfo->gdpy;
GdkScreen *gscr = gdk_display_get_default_screen (gdpy);
+
return gdk_screen_get_height (gscr);
}
int
-x_display_pixel_width (struct pgtk_display_info *dpyinfo)
+pgtk_display_pixel_width (struct pgtk_display_info *dpyinfo)
{
GdkDisplay *gdpy = dpyinfo->gdpy;
GdkScreen *gscr = gdk_display_get_default_screen (gdpy);
+
return gdk_screen_get_width (gscr);
}
gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), fixed, TRUE, TRUE, 0);
f->output_data.pgtk->preferred_width = alloc.width;
f->output_data.pgtk->preferred_height = alloc.height;
- x_wm_set_size_hint (f, 0, 0);
+ xg_wm_set_size_hint (f, 0, 0);
xg_frame_set_char_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, alloc.width),
FRAME_PIXEL_TO_TEXT_HEIGHT (f, alloc.height));
gtk_widget_queue_resize (FRAME_WIDGET (f));
terminal->redeem_scroll_bar_hook = pgtk_redeem_scroll_bar;
terminal->judge_scroll_bars_hook = pgtk_judge_scroll_bars;
terminal->get_string_resource_hook = pgtk_get_string_resource;
- terminal->delete_frame_hook = x_destroy_window;
+ terminal->delete_frame_hook = pgtk_destroy_window;
terminal->delete_terminal_hook = pgtk_delete_terminal;
terminal->query_frame_background_color = pgtk_query_frame_background_color;
terminal->defined_color_hook = pgtk_defined_color;
terminal->set_bitmap_icon_hook = pgtk_bitmap_icon;
terminal->implicit_set_name_hook = pgtk_implicitly_set_name;
terminal->iconify_frame_hook = pgtk_iconify_frame;
- terminal->set_scroll_bar_default_width_hook =
- pgtk_set_scroll_bar_default_width;
- terminal->set_scroll_bar_default_height_hook =
- pgtk_set_scroll_bar_default_height;
+ terminal->set_scroll_bar_default_width_hook
+ = pgtk_set_scroll_bar_default_width;
+ terminal->set_scroll_bar_default_height_hook
+ = pgtk_set_scroll_bar_default_height;
terminal->set_window_size_hook = pgtk_set_window_size;
terminal->query_colors = pgtk_query_colors;
terminal->get_focus_frame = x_get_focus_frame;
#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
#define ALPHA_FROM_ULONG(color) ((color) >> 24)
-#define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
+#define RED_FROM_ULONG(color) (((color) >> 16) & 0xff)
#define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
-#define BLUE_FROM_ULONG(color) ((color) & 0xff)
+#define BLUE_FROM_ULONG(color) ((color) & 0xff)
struct scroll_bar
{
extern void pgtk_set_event_handler (struct frame *f);
/* Implemented in pgtkterm.c */
-extern int x_display_pixel_height (struct pgtk_display_info *);
-extern int x_display_pixel_width (struct pgtk_display_info *);
+extern int pgtk_display_pixel_height (struct pgtk_display_info *);
+extern int pgtk_display_pixel_width (struct pgtk_display_info *);
-/* Implemented in pgtkterm.c */
-extern void x_destroy_window (struct frame *f);
+extern void pgtk_destroy_window (struct frame *f);
extern void pgtk_set_parent_frame (struct frame *f, Lisp_Object, Lisp_Object);
extern void pgtk_set_no_focus_on_map (struct frame *, Lisp_Object, Lisp_Object);
extern void pgtk_set_no_accept_focus (struct frame *, Lisp_Object, Lisp_Object);
extern void pgtk_make_frame_visible (struct frame *f);
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_free_frame_resources (struct frame *);
extern void pgtk_iconify_frame (struct frame *f);
extern void pgtk_focus_frame (struct frame *f, bool noactivate);
extern void pgtk_set_scroll_bar_default_width (struct frame *f);
flag (this is useful when FLAGS is 0).
The GTK version is in gtkutils.c. */
-#ifndef USE_GTK
void
x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
{
+#ifndef USE_GTK
XSizeHints size_hints;
Window window = FRAME_OUTER_WINDOW (f);
#ifdef USE_X_TOOLKIT
#endif /* PWinGravity */
XSetWMNormalHints (FRAME_X_DISPLAY (f), window, &size_hints);
+#else
+ xg_wm_set_size_size_hint (f, flags, user_position);
+#endif /* USE_GTK */
}
-#endif /* not USE_GTK */
/* Used for IconicState or NormalState */