34 |
#include <gdk/gdkkeysyms.h> |
#include <gdk/gdkkeysyms.h> |
35 |
|
|
36 |
#define FRAME_TOTAL_PIXEL_HEIGHT(f) \ |
#define FRAME_TOTAL_PIXEL_HEIGHT(f) \ |
37 |
(PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) |
(FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) |
38 |
|
|
39 |
|
|
40 |
|
|
237 |
xg_set_geometry (f) |
xg_set_geometry (f) |
238 |
FRAME_PTR f; |
FRAME_PTR f; |
239 |
{ |
{ |
240 |
if (f->output_data.x->size_hint_flags & USPosition) |
if (f->size_hint_flags & USPosition) |
241 |
{ |
{ |
242 |
int left = f->output_data.x->left_pos; |
int left = f->left_pos; |
243 |
int xneg = f->output_data.x->size_hint_flags & XNegative; |
int xneg = f->size_hint_flags & XNegative; |
244 |
int top = f->output_data.x->top_pos; |
int top = f->top_pos; |
245 |
int yneg = f->output_data.x->size_hint_flags & YNegative; |
int yneg = f->size_hint_flags & YNegative; |
246 |
char geom_str[32]; |
char geom_str[32]; |
247 |
|
|
248 |
if (xneg) |
if (xneg) |
251 |
top = -top; |
top = -top; |
252 |
|
|
253 |
sprintf (geom_str, "=%dx%d%c%d%c%d", |
sprintf (geom_str, "=%dx%d%c%d%c%d", |
254 |
PIXEL_WIDTH (f), |
FRAME_PIXEL_WIDTH (f), |
255 |
FRAME_TOTAL_PIXEL_HEIGHT (f), |
FRAME_TOTAL_PIXEL_HEIGHT (f), |
256 |
(xneg ? '-' : '+'), left, |
(xneg ? '-' : '+'), left, |
257 |
(yneg ? '-' : '+'), top); |
(yneg ? '-' : '+'), top); |
273 |
int rows; |
int rows; |
274 |
{ |
{ |
275 |
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
276 |
PIXEL_WIDTH (f), FRAME_TOTAL_PIXEL_HEIGHT (f)); |
FRAME_PIXEL_WIDTH (f), FRAME_TOTAL_PIXEL_HEIGHT (f)); |
277 |
|
|
278 |
/* base_height is now changed. */ |
/* base_height is now changed. */ |
279 |
x_wm_set_size_hint (f, 0, 0); |
x_wm_set_size_hint (f, 0, 0); |
317 |
{ |
{ |
318 |
int mbheight = FRAME_MENUBAR_HEIGHT (f); |
int mbheight = FRAME_MENUBAR_HEIGHT (f); |
319 |
int tbheight = FRAME_TOOLBAR_HEIGHT (f); |
int tbheight = FRAME_TOOLBAR_HEIGHT (f); |
320 |
int rows = PIXEL_TO_CHAR_HEIGHT (f, pixelheight - mbheight - tbheight); |
int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (pixelheight |
321 |
int columns = PIXEL_TO_CHAR_WIDTH (f, pixelwidth); |
- mbheight - tbheight)); |
322 |
|
int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); |
323 |
|
|
324 |
if (FRAME_GTK_WIDGET (f) |
if (FRAME_GTK_WIDGET (f) |
325 |
&& (columns != FRAME_WIDTH (f) || rows != FRAME_HEIGHT (f) |
&& (columns != FRAME_COLS (f) || rows != FRAME_LINES (f) |
326 |
|| pixelwidth != PIXEL_WIDTH (f) || pixelheight != PIXEL_HEIGHT (f))) |
|| pixelwidth != FRAME_PIXEL_WIDTH (f) || pixelheight != FRAME_PIXEL_HEIGHT (f))) |
327 |
{ |
{ |
328 |
struct x_output *x = f->output_data.x; |
struct x_output *x = f->output_data.x; |
329 |
GtkAllocation all; |
GtkAllocation all; |
350 |
int cols; |
int cols; |
351 |
int rows; |
int rows; |
352 |
{ |
{ |
353 |
int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows) |
int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) |
354 |
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
355 |
int pixelwidth; |
int pixelwidth; |
356 |
|
|
359 |
might end up with a frame width that is not a multiple of the |
might end up with a frame width that is not a multiple of the |
360 |
frame's character width which is bad for vertically split |
frame's character width which is bad for vertically split |
361 |
windows. */ |
windows. */ |
362 |
f->output_data.x->vertical_scroll_bar_extra |
f->scroll_bar_actual_width |
363 |
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
= FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); |
|
? 0 |
|
|
: (FRAME_SCROLL_BAR_COLS (f) |
|
|
* FONT_WIDTH (f->output_data.x->font))); |
|
364 |
|
|
365 |
compute_fringe_widths (f, 0); |
compute_fringe_widths (f, 0); |
366 |
|
|
367 |
/* CHAR_TO_PIXEL_WIDTH uses vertical_scroll_bar_extra, so call it |
/* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it |
368 |
after calculating that value. */ |
after calculating that value. */ |
369 |
pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); |
370 |
|
|
371 |
/* Must resize our top level widget. Font size may have changed, |
/* Must resize our top level widget. Font size may have changed, |
372 |
but not rows/cols. */ |
but not rows/cols. */ |
509 |
|
|
510 |
gtk_fixed_set_has_window (GTK_FIXED (wfixed), TRUE); |
gtk_fixed_set_has_window (GTK_FIXED (wfixed), TRUE); |
511 |
|
|
512 |
gtk_widget_set_size_request (wfixed, |
gtk_widget_set_size_request (wfixed, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); |
|
PIXEL_WIDTH (f), |
|
|
PIXEL_HEIGHT (f)); |
|
513 |
|
|
514 |
gtk_container_add (GTK_CONTAINER (wtop), wvbox); |
gtk_container_add (GTK_CONTAINER (wtop), wvbox); |
515 |
gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0); |
gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0); |
590 |
gtk_widget_modify_style (wfixed, style); |
gtk_widget_modify_style (wfixed, style); |
591 |
|
|
592 |
/* GTK does not set any border, and they look bad with GTK. */ |
/* GTK does not set any border, and they look bad with GTK. */ |
593 |
f->output_data.x->border_width = 0; |
f->border_width = 0; |
594 |
f->output_data.x->internal_border_width = 0; |
f->internal_border_width = 0; |
595 |
|
|
596 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
597 |
|
|
617 |
gint hint_flags = 0; |
gint hint_flags = 0; |
618 |
int base_width, base_height; |
int base_width, base_height; |
619 |
int min_rows = 0, min_cols = 0; |
int min_rows = 0, min_cols = 0; |
620 |
int win_gravity = f->output_data.x->win_gravity; |
int win_gravity = f->win_gravity; |
621 |
|
|
622 |
if (flags) |
if (flags) |
623 |
{ |
{ |
626 |
f->output_data.x->hint_flags = hint_flags; |
f->output_data.x->hint_flags = hint_flags; |
627 |
} |
} |
628 |
else |
else |
629 |
flags = f->output_data.x->size_hint_flags; |
flags = f->size_hint_flags; |
630 |
|
|
631 |
size_hints = f->output_data.x->size_hints; |
size_hints = f->output_data.x->size_hints; |
632 |
hint_flags = f->output_data.x->hint_flags; |
hint_flags = f->output_data.x->hint_flags; |
633 |
|
|
634 |
hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE; |
hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE; |
635 |
size_hints.width_inc = FONT_WIDTH (f->output_data.x->font); |
size_hints.width_inc = FRAME_COLUMN_WIDTH (f); |
636 |
size_hints.height_inc = f->output_data.x->line_height; |
size_hints.height_inc = FRAME_LINE_HEIGHT (f); |
637 |
|
|
638 |
hint_flags |= GDK_HINT_BASE_SIZE; |
hint_flags |= GDK_HINT_BASE_SIZE; |
639 |
base_width = CHAR_TO_PIXEL_WIDTH (f, 0); |
base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); |
640 |
base_height = CHAR_TO_PIXEL_HEIGHT (f, 0) |
base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0) |
641 |
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
642 |
|
|
643 |
check_frame_size (f, &min_rows, &min_cols); |
check_frame_size (f, &min_rows, &min_cols); |
2294 |
|
|
2295 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
2296 |
rows to what we had before adding the menu bar. */ |
rows to what we had before adding the menu bar. */ |
2297 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
2298 |
|
|
2299 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
2300 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
2323 |
|
|
2324 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
2325 |
rows to what we had before removing the menu bar. */ |
rows to what we had before removing the menu bar. */ |
2326 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
2327 |
|
|
2328 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
2329 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
2731 |
/* We do the same as for MOTIF in xterm.c, assume 30 chars per line |
/* We do the same as for MOTIF in xterm.c, assume 30 chars per line |
2732 |
rather than the real portion value. This makes the thumb less likely |
rather than the real portion value. This makes the thumb less likely |
2733 |
to resize and that looks better. */ |
to resize and that looks better. */ |
2734 |
portion = XFASTINT (XWINDOW (bar->window)->height) * 30; |
portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; |
2735 |
/* When the thumb is at the bottom, position == whole. |
/* When the thumb is at the bottom, position == whole. |
2736 |
So we need to increase `whole' to make space for the thumb. */ |
So we need to increase `whole' to make space for the thumb. */ |
2737 |
whole += portion; |
whole += portion; |
2753 |
value = max (value, XG_SB_MIN); |
value = max (value, XG_SB_MIN); |
2754 |
|
|
2755 |
/* Assume all lines are of equal size. */ |
/* Assume all lines are of equal size. */ |
2756 |
new_step = size / max (1, FRAME_HEIGHT (f)); |
new_step = size / max (1, FRAME_LINES (f)); |
2757 |
|
|
2758 |
if ((int) adj->page_size != size |
if ((int) adj->page_size != size |
2759 |
|| (int) adj->step_increment != new_step) |
|| (int) adj->step_increment != new_step) |
2853 |
|
|
2854 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
2855 |
rows to what we had before detaching the tool bar. */ |
rows to what we had before detaching the tool bar. */ |
2856 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
2857 |
} |
} |
2858 |
} |
} |
2859 |
|
|
2880 |
|
|
2881 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
2882 |
rows to what we had before detaching the tool bar. */ |
rows to what we had before detaching the tool bar. */ |
2883 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
2884 |
} |
} |
2885 |
} |
} |
2886 |
|
|
3025 |
|
|
3026 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
3027 |
rows to what we had before adding the tool bar. */ |
rows to what we had before adding the tool bar. */ |
3028 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3029 |
|
|
3030 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
3031 |
} |
} |
3198 |
if (old_req.height != new_req.height) |
if (old_req.height != new_req.height) |
3199 |
{ |
{ |
3200 |
FRAME_TOOLBAR_HEIGHT (f) = new_req.height; |
FRAME_TOOLBAR_HEIGHT (f) = new_req.height; |
3201 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3202 |
} |
} |
3203 |
|
|
3204 |
if (icon_list) g_list_free (icon_list); |
if (icon_list) g_list_free (icon_list); |
3223 |
|
|
3224 |
/* The height has changed, resize outer widget and set columns |
/* The height has changed, resize outer widget and set columns |
3225 |
rows to what we had before removing the tool bar. */ |
rows to what we had before removing the tool bar. */ |
3226 |
xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3227 |
|
|
3228 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
3229 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |