1 |
/* X Communication module for terminals which understand the X protocol. |
/* X Communication module for terminals which understand the X protocol. |
2 |
Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001, 2002 |
Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000, 01, 02, 2003 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
158 |
|
|
159 |
#define abs(x) ((x) < 0 ? -(x) : (x)) |
#define abs(x) ((x) < 0 ? -(x) : (x)) |
160 |
|
|
161 |
|
/* Default to using XIM if available. */ |
162 |
|
#ifdef USE_XIM |
163 |
|
int use_xim = 1; |
164 |
|
#else |
165 |
|
int use_xim = 0; /* configure --without-xim */ |
166 |
|
#endif |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
/* Non-nil means Emacs uses toolkit scroll bars. */ |
/* Non-nil means Emacs uses toolkit scroll bars. */ |
301 |
static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value; |
static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value; |
302 |
|
|
303 |
static Lisp_Object Qvendor_specific_keysyms; |
static Lisp_Object Qvendor_specific_keysyms; |
304 |
static Lisp_Object Qlatin_1, Qutf_8; |
static Lisp_Object Qlatin_1; |
305 |
|
|
306 |
extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); |
extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); |
307 |
|
extern int x_bitmap_mask P_ ((FRAME_PTR, int)); |
308 |
|
|
309 |
static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *)); |
static int x_alloc_nearest_color_1 P_ ((Display *, Colormap, XColor *)); |
310 |
static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); |
static void x_set_window_size_1 P_ ((struct frame *, int, int, int)); |
351 |
static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, |
static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, |
352 |
enum text_cursor_kinds)); |
enum text_cursor_kinds)); |
353 |
|
|
354 |
static void x_clip_to_row P_ ((struct window *, struct glyph_row *, |
static void x_clip_to_row P_ ((struct window *, struct glyph_row *, GC)); |
|
GC, int)); |
|
355 |
static void x_flush P_ ((struct frame *f)); |
static void x_flush P_ ((struct frame *f)); |
356 |
static void x_update_begin P_ ((struct frame *)); |
static void x_update_begin P_ ((struct frame *)); |
357 |
static void x_update_window_begin P_ ((struct window *)); |
static void x_update_window_begin P_ ((struct window *)); |
362 |
Lisp_Object *, Lisp_Object *, |
Lisp_Object *, Lisp_Object *, |
363 |
unsigned long *)); |
unsigned long *)); |
364 |
static void x_check_fullscreen P_ ((struct frame *)); |
static void x_check_fullscreen P_ ((struct frame *)); |
365 |
static void x_check_fullscreen_move P_ ((struct frame *)); |
static void x_check_expected_move P_ ((struct frame *)); |
366 |
static int handle_one_xevent P_ ((struct x_display_info *, |
static int handle_one_xevent P_ ((struct x_display_info *, |
367 |
XEvent *, |
XEvent *, |
368 |
struct input_event **, |
struct input_event **, |
534 |
int x, y0, y1; |
int x, y0, y1; |
535 |
{ |
{ |
536 |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
537 |
|
|
538 |
XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
539 |
f->output_data.x->normal_gc, x, y0, x, y1); |
f->output_data.x->normal_gc, x, y0, x, y1); |
540 |
} |
} |
679 |
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
680 |
0, y, width, height, False); |
0, y, width, height, False); |
681 |
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
682 |
f->output_data.x->pixel_width - width, |
FRAME_PIXEL_WIDTH (f) - width, |
683 |
y, width, height, False); |
y, width, height, False); |
684 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
685 |
} |
} |
698 |
struct face *face = p->face; |
struct face *face = p->face; |
699 |
|
|
700 |
/* Must clip because of partially visible lines. */ |
/* Must clip because of partially visible lines. */ |
701 |
x_clip_to_row (w, row, gc, 1); |
x_clip_to_row (w, row, gc); |
702 |
|
|
703 |
if (p->bx >= 0) |
if (p->bx >= 0) |
704 |
{ |
{ |
2082 |
if (s->row->full_width_p |
if (s->row->full_width_p |
2083 |
&& !s->w->pseudo_window_p) |
&& !s->w->pseudo_window_p) |
2084 |
{ |
{ |
2085 |
last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f); |
last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w); |
2086 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) |
if (s->area != RIGHT_MARGIN_AREA |
2087 |
last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); |
|| WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w)) |
2088 |
|
last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w); |
2089 |
} |
} |
2090 |
|
|
2091 |
/* The glyph that may have a right box line. */ |
/* The glyph that may have a right box line. */ |
2473 |
{ |
{ |
2474 |
/* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
/* If `x-stretch-block-cursor' is nil, don't draw a block cursor |
2475 |
as wide as the stretch glyph. */ |
as wide as the stretch glyph. */ |
2476 |
int width = min (CANON_X_UNIT (s->f), s->background_width); |
int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width); |
2477 |
|
|
2478 |
/* Draw cursor. */ |
/* Draw cursor. */ |
2479 |
x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); |
x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); |
2826 |
|
|
2827 |
{ |
{ |
2828 |
/* Get the height not including a menu bar widget. */ |
/* Get the height not including a menu bar widget. */ |
2829 |
int height = CHAR_TO_PIXEL_HEIGHT (f, FRAME_HEIGHT (f)); |
int height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f)); |
2830 |
/* Height of each line to flash. */ |
/* Height of each line to flash. */ |
2831 |
int flash_height = FRAME_LINE_HEIGHT (f); |
int flash_height = FRAME_LINE_HEIGHT (f); |
2832 |
/* These will be the left and right margins of the rectangles. */ |
/* These will be the left and right margins of the rectangles. */ |
2833 |
int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f); |
int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f); |
2834 |
int flash_right = PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f); |
int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f); |
2835 |
|
|
2836 |
int width; |
int width; |
2837 |
|
|
2859 |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
2860 |
flash_left, |
flash_left, |
2861 |
(FRAME_INTERNAL_BORDER_WIDTH (f) |
(FRAME_INTERNAL_BORDER_WIDTH (f) |
2862 |
+ FRAME_TOOL_BAR_LINES (f) * CANON_Y_UNIT (f)), |
+ FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)), |
2863 |
width, flash_height); |
width, flash_height); |
2864 |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
2865 |
flash_left, |
flash_left, |
2913 |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
2914 |
flash_left, |
flash_left, |
2915 |
(FRAME_INTERNAL_BORDER_WIDTH (f) |
(FRAME_INTERNAL_BORDER_WIDTH (f) |
2916 |
+ FRAME_TOOL_BAR_LINES (f) * CANON_Y_UNIT (f)), |
+ FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)), |
2917 |
width, flash_height); |
width, flash_height); |
2918 |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, |
2919 |
flash_left, |
flash_left, |
3005 |
without mode lines. Include in this box the left and right |
without mode lines. Include in this box the left and right |
3006 |
fringe of W. */ |
fringe of W. */ |
3007 |
window_box (w, -1, &x, &y, &width, &height); |
window_box (w, -1, &x, &y, &width, &height); |
|
width += FRAME_X_FRINGE_WIDTH (f); |
|
|
x -= FRAME_X_LEFT_FRINGE_WIDTH (f); |
|
3008 |
|
|
3009 |
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); |
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); |
3010 |
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); |
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); |
3108 |
selected_frame = frame; |
selected_frame = frame; |
3109 |
XSETFRAME (XWINDOW (selected_frame->selected_window)->frame, |
XSETFRAME (XWINDOW (selected_frame->selected_window)->frame, |
3110 |
selected_frame); |
selected_frame); |
3111 |
Fselect_window (selected_frame->selected_window); |
Fselect_window (selected_frame->selected_window, Qnil); |
3112 |
choose_minibuf_frame (); |
choose_minibuf_frame (); |
3113 |
#endif /* ! 0 */ |
#endif /* ! 0 */ |
3114 |
|
|
3579 |
Lisp_Object window; |
Lisp_Object window; |
3580 |
int found = 0; |
int found = 0; |
3581 |
|
|
3582 |
window = window_from_coordinates (f, x, y, 0, 0); |
window = window_from_coordinates (f, x, y, 0, &x, &y, 0); |
3583 |
if (!NILP (window)) |
if (!NILP (window)) |
3584 |
{ |
{ |
3585 |
struct window *w = XWINDOW (window); |
struct window *w = XWINDOW (window); |
3586 |
struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
3587 |
struct glyph_row *end = r + w->current_matrix->nrows - 1; |
struct glyph_row *end = r + w->current_matrix->nrows - 1; |
3588 |
|
|
|
frame_to_window_pixel_xy (w, &x, &y); |
|
|
|
|
3589 |
for (; !found && r < end && r->enabled_p; ++r) |
for (; !found && r < end && r->enabled_p; ++r) |
3590 |
if (r->y >= y) |
if (r->y >= y) |
3591 |
{ |
{ |
3805 |
gx = win_x; |
gx = win_x; |
3806 |
gy = win_y; |
gy = win_y; |
3807 |
|
|
3808 |
/* Arrange for the division in PIXEL_TO_CHAR_COL etc. to |
/* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to |
3809 |
round down even for negative values. */ |
round down even for negative values. */ |
3810 |
if (gx < 0) |
if (gx < 0) |
3811 |
gx -= width - 1; |
gx -= width - 1; |
3988 |
x_send_scroll_bar_event (window_being_scrolled, |
x_send_scroll_bar_event (window_being_scrolled, |
3989 |
scroll_bar_end_scroll, 0, 0); |
scroll_bar_end_scroll, 0, 0); |
3990 |
w = XWINDOW (window_being_scrolled); |
w = XWINDOW (window_being_scrolled); |
3991 |
|
|
3992 |
if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging)) |
if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging)) |
3993 |
{ |
{ |
3994 |
XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; |
XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; |
4193 |
#else /* !USE_MOTIF, i.e. Xaw or GTK */ |
#else /* !USE_MOTIF, i.e. Xaw or GTK */ |
4194 |
#ifdef USE_GTK |
#ifdef USE_GTK |
4195 |
/* Scroll bar callback for GTK scroll bars. WIDGET is the scroll |
/* Scroll bar callback for GTK scroll bars. WIDGET is the scroll |
4196 |
bar adjustment widget. DATA is a pointer to the scroll_bar structure. */ |
bar widget. DATA is a pointer to the scroll_bar structure. */ |
4197 |
|
|
4198 |
static void |
static void |
4199 |
xg_scroll_callback (widget, data) |
xg_scroll_callback (widget, data) |
4200 |
GtkWidget *widget; |
GtkRange *widget; |
4201 |
gpointer data; |
gpointer data; |
4202 |
{ |
{ |
4203 |
struct scroll_bar *bar = (struct scroll_bar *) data; |
struct scroll_bar *bar = (struct scroll_bar *) data; |
4207 |
int diff; |
int diff; |
4208 |
|
|
4209 |
int part = -1, whole = 0, portion = 0; |
int part = -1, whole = 0, portion = 0; |
4210 |
GtkAdjustment *adj = GTK_ADJUSTMENT (widget); |
GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (widget)); |
4211 |
|
|
4212 |
if (xg_ignore_gtk_scrollbar) return; |
if (xg_ignore_gtk_scrollbar) return; |
4213 |
|
|
4591 |
its size, the update will often happen too late. |
its size, the update will often happen too late. |
4592 |
If you don't believe it, check out revision 1.650 of xterm.c to see |
If you don't believe it, check out revision 1.650 of xterm.c to see |
4593 |
what hoops we were going through and the still poor behavior we got. */ |
what hoops we were going through and the still poor behavior we got. */ |
4594 |
portion = XFASTINT (XWINDOW (bar->window)->height) * 30; |
portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; |
4595 |
/* When the thumb is at the bottom, position == whole. |
/* When the thumb is at the bottom, position == whole. |
4596 |
So we need to increase `whole' to make space for the thumb. */ |
So we need to increase `whole' to make space for the thumb. */ |
4597 |
whole += portion; |
whole += portion; |
4959 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
4960 |
struct scroll_bar *bar; |
struct scroll_bar *bar; |
4961 |
int top, height, left, sb_left, width, sb_width; |
int top, height, left, sb_left, width, sb_width; |
4962 |
int window_x, window_y, window_width, window_height; |
int window_y, window_height; |
4963 |
|
|
4964 |
/* Get window dimensions. */ |
/* Get window dimensions. */ |
4965 |
window_box (w, -1, &window_x, &window_y, &window_width, &window_height); |
window_box (w, -1, 0, &window_y, 0, &window_height); |
4966 |
top = window_y; |
top = window_y; |
4967 |
width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); |
width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); |
4968 |
height = window_height; |
height = window_height; |
4969 |
|
|
4970 |
/* Compute the left edge of the scroll bar area. */ |
/* Compute the left edge of the scroll bar area. */ |
4971 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
left = WINDOW_SCROLL_BAR_AREA_X (w); |
|
left = XINT (w->left) + XINT (w->width) - FRAME_SCROLL_BAR_COLS (f); |
|
|
else |
|
|
left = XFASTINT (w->left); |
|
|
left *= CANON_X_UNIT (f); |
|
|
left += FRAME_INTERNAL_BORDER_WIDTH (f); |
|
4972 |
|
|
4973 |
/* Compute the width of the scroll bar which might be less than |
/* Compute the width of the scroll bar which might be less than |
4974 |
the width of the area reserved for the scroll bar. */ |
the width of the area reserved for the scroll bar. */ |
4975 |
if (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0) |
if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0) |
4976 |
sb_width = FRAME_SCROLL_BAR_PIXEL_WIDTH (f); |
sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); |
4977 |
else |
else |
4978 |
sb_width = width; |
sb_width = width; |
4979 |
|
|
4980 |
/* Compute the left edge of the scroll bar. */ |
/* Compute the left edge of the scroll bar. */ |
4981 |
#ifdef USE_TOOLKIT_SCROLL_BARS |
#ifdef USE_TOOLKIT_SCROLL_BARS |
4982 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
4983 |
sb_left = left + width - sb_width - (width - sb_width) / 2; |
sb_left = left + width - sb_width - (width - sb_width) / 2; |
4984 |
else |
else |
4985 |
sb_left = left + (width - sb_width) / 2; |
sb_left = left + (width - sb_width) / 2; |
4986 |
#else |
#else |
4987 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
4988 |
sb_left = left + width - sb_width; |
sb_left = left + width - sb_width; |
4989 |
else |
else |
4990 |
sb_left = left; |
sb_left = left; |
5069 |
previous mode line display is cleared after C-x 2 C-x 1, for |
previous mode line display is cleared after C-x 2 C-x 1, for |
5070 |
example. */ |
example. */ |
5071 |
{ |
{ |
5072 |
int area_width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); |
int area_width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); |
5073 |
int rest = area_width - sb_width; |
int rest = area_width - sb_width; |
5074 |
if (rest > 0 && height > 0) |
if (rest > 0 && height > 0) |
5075 |
{ |
{ |
5076 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) |
5077 |
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
5078 |
left + area_width - rest, top, |
left + area_width - rest, top, |
5079 |
rest, height, False); |
rest, height, False); |
5860 |
|
|
5861 |
if (f) |
if (f) |
5862 |
{ |
{ |
5863 |
f->output_data.x->left_pos = new_x; |
f->left_pos = new_x; |
5864 |
f->output_data.x->top_pos = new_y; |
f->top_pos = new_y; |
5865 |
} |
} |
5866 |
} |
} |
5867 |
#ifdef HACK_EDITRES |
#ifdef HACK_EDITRES |
5988 |
int x, y; |
int x, y; |
5989 |
f->output_data.x->parent_desc = event.xreparent.parent; |
f->output_data.x->parent_desc = event.xreparent.parent; |
5990 |
x_real_positions (f, &x, &y); |
x_real_positions (f, &x, &y); |
5991 |
f->output_data.x->left_pos = x; |
f->left_pos = x; |
5992 |
f->output_data.x->top_pos = y; |
f->top_pos = y; |
5993 |
|
|
5994 |
|
/* Perhaps reparented due to a WM restart. Reset this. */ |
5995 |
|
FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN; |
5996 |
} |
} |
5997 |
goto OTHER; |
goto OTHER; |
5998 |
break; |
break; |
6011 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
6012 |
} |
} |
6013 |
else |
else |
6014 |
expose_frame (x_window_to_frame (dpyinfo, |
expose_frame (f, |
6015 |
event.xexpose.window), |
event.xexpose.x, event.xexpose.y, |
|
event.xexpose.x, event.xexpose.y, |
|
6016 |
event.xexpose.width, event.xexpose.height); |
event.xexpose.width, event.xexpose.height); |
6017 |
} |
} |
6018 |
else |
else |
6461 |
require = decoding_buffer_size (&coding, nbytes); |
require = decoding_buffer_size (&coding, nbytes); |
6462 |
p = (unsigned char *) alloca (require); |
p = (unsigned char *) alloca (require); |
6463 |
coding.mode |= CODING_MODE_LAST_BLOCK; |
coding.mode |= CODING_MODE_LAST_BLOCK; |
6464 |
/* We explicitely disable composition |
/* We explicitly disable composition |
6465 |
handling because key data should |
handling because key data should |
6466 |
not contain any composition |
not contain any composition |
6467 |
sequence. */ |
sequence. */ |
6657 |
|
|
6658 |
window = window_from_coordinates (f, |
window = window_from_coordinates (f, |
6659 |
event.xmotion.x, event.xmotion.y, |
event.xmotion.x, event.xmotion.y, |
6660 |
0, 0); |
0, 0, 0, 0); |
6661 |
|
|
6662 |
/* Window will be selected only when it is not selected now and |
/* Window will be selected only when it is not selected now and |
6663 |
last mouse movement event was not in it. Minibuffer window |
last mouse movement event was not in it. Minibuffer window |
6728 |
do this one, the right one will come later. |
do this one, the right one will come later. |
6729 |
The toolkit version doesn't seem to need this, but we |
The toolkit version doesn't seem to need this, but we |
6730 |
need to reset it below. */ |
need to reset it below. */ |
6731 |
int dont_resize = |
int dont_resize |
6732 |
((f->output_data.x->want_fullscreen & FULLSCREEN_WAIT) |
= ((f->want_fullscreen & FULLSCREEN_WAIT) |
6733 |
&& FRAME_NEW_WIDTH (f) != 0); |
&& f->new_text_cols != 0); |
6734 |
int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); |
int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); |
6735 |
int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); |
int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width); |
6736 |
|
|
6737 |
if (dont_resize) |
if (dont_resize) |
6738 |
goto OTHER; |
goto OTHER; |
6739 |
|
|
6744 |
/* Even if the number of character rows and columns has |
/* Even if the number of character rows and columns has |
6745 |
not changed, the font size may have changed, so we need |
not changed, the font size may have changed, so we need |
6746 |
to check the pixel dimensions as well. */ |
to check the pixel dimensions as well. */ |
6747 |
if (columns != f->width |
if (columns != FRAME_COLS (f) |
6748 |
|| rows != f->height |
|| rows != FRAME_LINES (f) |
6749 |
|| event.xconfigure.width != f->output_data.x->pixel_width |
|| event.xconfigure.width != FRAME_PIXEL_WIDTH (f) |
6750 |
|| event.xconfigure.height != f->output_data.x->pixel_height) |
|| event.xconfigure.height != FRAME_PIXEL_HEIGHT (f)) |
6751 |
{ |
{ |
6752 |
change_frame_size (f, rows, columns, 0, 1, 0); |
change_frame_size (f, rows, columns, 0, 1, 0); |
6753 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
6756 |
#endif /* not USE_GTK */ |
#endif /* not USE_GTK */ |
6757 |
#endif |
#endif |
6758 |
|
|
6759 |
f->output_data.x->pixel_width = event.xconfigure.width; |
FRAME_PIXEL_WIDTH (f) = event.xconfigure.width; |
6760 |
f->output_data.x->pixel_height = event.xconfigure.height; |
FRAME_PIXEL_HEIGHT (f) = event.xconfigure.height; |
6761 |
|
|
6762 |
#ifdef USE_GTK |
#ifdef USE_GTK |
6763 |
/* GTK creates windows but doesn't map them. |
/* GTK creates windows but doesn't map them. |
6764 |
Only get real positions and check fullscreen when mapped. */ |
Only get real positions and check fullscreen when mapped. */ |
6765 |
if (FRAME_GTK_OUTER_WIDGET (f) |
if (FRAME_GTK_OUTER_WIDGET (f) |
6766 |
&& GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f))) |
&& GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f))) |
|
{ |
|
6767 |
#endif |
#endif |
6768 |
/* What we have now is the position of Emacs's own window. |
{ |
6769 |
Convert that to the position of the window manager window. */ |
/* What we have now is the position of Emacs's own window. |
6770 |
x_real_positions (f, &f->output_data.x->left_pos, |
Convert that to the position of the window manager window. */ |
6771 |
&f->output_data.x->top_pos); |
x_real_positions (f, &f->left_pos, &f->top_pos); |
6772 |
|
|
6773 |
x_check_fullscreen_move (f); |
x_check_expected_move (f); |
6774 |
if (f->output_data.x->want_fullscreen & FULLSCREEN_WAIT) |
if (f->want_fullscreen & FULLSCREEN_WAIT) |
6775 |
f->output_data.x->want_fullscreen &= |
f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH); |
|
~(FULLSCREEN_WAIT|FULLSCREEN_BOTH); |
|
|
#ifdef USE_GTK |
|
6776 |
} |
} |
6777 |
#endif |
|
6778 |
#ifdef HAVE_X_I18N |
#ifdef HAVE_X_I18N |
6779 |
if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) |
if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) |
6780 |
xic_set_statusarea (f); |
xic_set_statusarea (f); |
6784 |
{ |
{ |
6785 |
/* Since the WM decorations come below top_pos now, |
/* Since the WM decorations come below top_pos now, |
6786 |
we must put them below top_pos in the future. */ |
we must put them below top_pos in the future. */ |
6787 |
f->output_data.x->win_gravity = NorthWestGravity; |
f->win_gravity = NorthWestGravity; |
6788 |
x_wm_set_size_hint (f, (long) 0, 0); |
x_wm_set_size_hint (f, (long) 0, 0); |
6789 |
} |
} |
6790 |
} |
} |
6812 |
{ |
{ |
6813 |
/* Is this in the tool-bar? */ |
/* Is this in the tool-bar? */ |
6814 |
if (WINDOWP (f->tool_bar_window) |
if (WINDOWP (f->tool_bar_window) |
6815 |
&& XFASTINT (XWINDOW (f->tool_bar_window)->height)) |
&& WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) |
6816 |
{ |
{ |
6817 |
Lisp_Object window; |
Lisp_Object window; |
6818 |
int x = event.xbutton.x; |
int x = event.xbutton.x; |
6819 |
int y = event.xbutton.y; |
int y = event.xbutton.y; |
6820 |
|
|
6821 |
window = window_from_coordinates (f, x, y, 0, 1); |
window = window_from_coordinates (f, x, y, 0, 0, 0, 1); |
6822 |
if (EQ (window, f->tool_bar_window)) |
if (EQ (window, f->tool_bar_window)) |
6823 |
{ |
{ |
6824 |
if (event.xbutton.type == ButtonPress) |
if (event.xbutton.type == ButtonPress) |
6901 |
/* Verify the event is really within the menu bar |
/* Verify the event is really within the menu bar |
6902 |
and not just sent to it due to grabbing. */ |
and not just sent to it due to grabbing. */ |
6903 |
&& event.xbutton.x >= 0 |
&& event.xbutton.x >= 0 |
6904 |
&& event.xbutton.x < f->output_data.x->pixel_width |
&& event.xbutton.x < FRAME_PIXEL_WIDTH (f) |
6905 |
&& event.xbutton.y >= 0 |
&& event.xbutton.y >= 0 |
6906 |
&& event.xbutton.y < f->output_data.x->menubar_height |
&& event.xbutton.y < f->output_data.x->menubar_height |
6907 |
&& event.xbutton.same_screen) |
&& event.xbutton.same_screen) |
6997 |
{ |
{ |
6998 |
struct x_display_info *dpyinfo; |
struct x_display_info *dpyinfo; |
6999 |
struct input_event bufp[10]; |
struct input_event bufp[10]; |
7000 |
struct input_event *bufpp = bufp; |
struct input_event *bufpp; |
7001 |
int numchars = 10; |
int numchars = 10; |
7002 |
int finish = X_EVENT_NORMAL; |
int finish = X_EVENT_NORMAL; |
7003 |
|
|
7004 |
|
for (bufpp = bufp; bufpp != bufp + 10; bufpp++) |
7005 |
|
EVENT_INIT (*bufpp); |
7006 |
|
bufpp = bufp; |
7007 |
|
|
7008 |
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) |
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) |
7009 |
if (dpyinfo->display == display) |
if (dpyinfo->display == display) |
7010 |
break; |
break; |
7118 |
|
|
7119 |
while (gtk_events_pending ()) |
while (gtk_events_pending ()) |
7120 |
{ |
{ |
|
static int nr = 0; |
|
7121 |
current_count = count; |
current_count = count; |
7122 |
current_numcharsp = &numchars; |
current_numcharsp = &numchars; |
7123 |
current_bufp = &bufp; |
current_bufp = &bufp; |
7205 |
|
|
7206 |
/* Set clipping for output in glyph row ROW. W is the window in which |
/* Set clipping for output in glyph row ROW. W is the window in which |
7207 |
we operate. GC is the graphics context to set clipping in. |
we operate. GC is the graphics context to set clipping in. |
|
WHOLE_LINE_P non-zero means include the areas used for truncation |
|
|
mark display and alike in the clipping rectangle. |
|
7208 |
|
|
7209 |
ROW may be a text row or, e.g., a mode line. Text rows must be |
ROW may be a text row or, e.g., a mode line. Text rows must be |
7210 |
clipped to the interior of the window dedicated to text display, |
clipped to the interior of the window dedicated to text display, |
7211 |
mode lines must be clipped to the whole window. */ |
mode lines must be clipped to the whole window. */ |
7212 |
|
|
7213 |
static void |
static void |
7214 |
x_clip_to_row (w, row, gc, whole_line_p) |
x_clip_to_row (w, row, gc) |
7215 |
struct window *w; |
struct window *w; |
7216 |
struct glyph_row *row; |
struct glyph_row *row; |
7217 |
GC gc; |
GC gc; |
|
int whole_line_p; |
|
7218 |
{ |
{ |
7219 |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
7220 |
XRectangle clip_rect; |
XRectangle clip_rect; |
7221 |
int window_x, window_y, window_width, window_height; |
int window_y, window_width; |
7222 |
|
|
7223 |
window_box (w, -1, &window_x, &window_y, &window_width, &window_height); |
window_box (w, -1, 0, &window_y, &window_width, 0); |
7224 |
|
|
7225 |
clip_rect.x = WINDOW_TO_FRAME_PIXEL_X (w, 0); |
clip_rect.x = WINDOW_TO_FRAME_PIXEL_X (w, 0); |
7226 |
clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
7228 |
clip_rect.width = window_width; |
clip_rect.width = window_width; |
7229 |
clip_rect.height = row->visible_height; |
clip_rect.height = row->visible_height; |
7230 |
|
|
|
/* If clipping to the whole line, including trunc marks, extend |
|
|
the rectangle to the left and increase its width. */ |
|
|
if (whole_line_p) |
|
|
{ |
|
|
clip_rect.x -= FRAME_X_LEFT_FRINGE_WIDTH (f); |
|
|
clip_rect.width += FRAME_X_FRINGE_WIDTH (f); |
|
|
} |
|
|
|
|
7231 |
XSetClipRectangles (FRAME_X_DISPLAY (f), gc, 0, 0, &clip_rect, 1, Unsorted); |
XSetClipRectangles (FRAME_X_DISPLAY (f), gc, 0, 0, &clip_rect, 1, Unsorted); |
7232 |
} |
} |
7233 |
|
|
7267 |
wd = cursor_glyph->pixel_width - 1; |
wd = cursor_glyph->pixel_width - 1; |
7268 |
if (cursor_glyph->type == STRETCH_GLYPH |
if (cursor_glyph->type == STRETCH_GLYPH |
7269 |
&& !x_stretch_cursor_p) |
&& !x_stretch_cursor_p) |
7270 |
wd = min (CANON_X_UNIT (f), wd); |
wd = min (FRAME_COLUMN_WIDTH (f), wd); |
7271 |
w->phys_cursor_width = wd; |
w->phys_cursor_width = wd; |
7272 |
|
|
7273 |
/* The foreground of cursor_gc is typically the same as the normal |
/* The foreground of cursor_gc is typically the same as the normal |
7281 |
gc = dpyinfo->scratch_cursor_gc; |
gc = dpyinfo->scratch_cursor_gc; |
7282 |
|
|
7283 |
/* Set clipping, draw the rectangle, and reset clipping again. */ |
/* Set clipping, draw the rectangle, and reset clipping again. */ |
7284 |
x_clip_to_row (w, row, gc, 0); |
x_clip_to_row (w, row, gc); |
7285 |
XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h); |
XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h); |
7286 |
XSetClipMask (dpy, gc, None); |
XSetClipMask (dpy, gc, None); |
7287 |
} |
} |
7353 |
width = min (cursor_glyph->pixel_width, width); |
width = min (cursor_glyph->pixel_width, width); |
7354 |
|
|
7355 |
w->phys_cursor_width = width; |
w->phys_cursor_width = width; |
7356 |
x_clip_to_row (w, row, gc, 0); |
x_clip_to_row (w, row, gc); |
7357 |
|
|
7358 |
if (kind == BAR_CURSOR) |
if (kind == BAR_CURSOR) |
7359 |
XFillRectangle (dpy, window, gc, |
XFillRectangle (dpy, window, gc, |
7467 |
if (FRAME_X_WINDOW (f) == 0) |
if (FRAME_X_WINDOW (f) == 0) |
7468 |
return 1; |
return 1; |
7469 |
|
|
7470 |
/* Free up our existing icon bitmap if any. */ |
/* Free up our existing icon bitmap and mask if any. */ |
7471 |
if (f->output_data.x->icon_bitmap > 0) |
if (f->output_data.x->icon_bitmap > 0) |
7472 |
x_destroy_bitmap (f, f->output_data.x->icon_bitmap); |
x_destroy_bitmap (f, f->output_data.x->icon_bitmap); |
7473 |
f->output_data.x->icon_bitmap = 0; |
f->output_data.x->icon_bitmap = 0; |
7474 |
|
|
7475 |
if (STRINGP (file)) |
if (STRINGP (file)) |
7476 |
bitmap_id = x_create_bitmap_from_file (f, file); |
{ |
7477 |
|
#ifdef USE_GTK |
7478 |
|
/* Use gtk_window_set_icon_from_file() if available, |
7479 |
|
It's not restricted to bitmaps */ |
7480 |
|
if (xg_set_icon(f, file)) |
7481 |
|
return 0; |
7482 |
|
#endif /* USE_GTK */ |
7483 |
|
bitmap_id = x_create_bitmap_from_file (f, file); |
7484 |
|
x_create_bitmap_mask(f, bitmap_id); |
7485 |
|
} |
7486 |
else |
else |
7487 |
{ |
{ |
7488 |
/* Create the GNU bitmap if necessary. */ |
/* Create the GNU bitmap and mask if necessary. */ |
7489 |
if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0) |
if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0) |
7490 |
FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id |
{ |
7491 |
= x_create_bitmap_from_data (f, gnu_bits, |
FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id |
7492 |
gnu_width, gnu_height); |
= x_create_bitmap_from_data (f, gnu_bits, |
7493 |
|
gnu_width, gnu_height); |
7494 |
|
x_create_bitmap_mask(f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); |
7495 |
|
} |
7496 |
|
|
7497 |
/* The first time we create the GNU bitmap, |
/* The first time we create the GNU bitmap and mask, |
7498 |
this increments the ref-count one extra time. |
this increments the ref-count one extra time. |
7499 |
As a result, the GNU bitmap is never freed. |
As a result, the GNU bitmap and mask are never freed. |
7500 |
That way, we don't have to worry about allocating it again. */ |
That way, we don't have to worry about allocating it again. */ |
7501 |
x_reference_bitmap (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); |
x_reference_bitmap (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); |
7502 |
|
|
7884 |
if (!fontp) |
if (!fontp) |
7885 |
return Qnil; |
return Qnil; |
7886 |
|
|
7887 |
f->output_data.x->font = (XFontStruct *) (fontp->font); |
FRAME_FONT (f) = (XFontStruct *) (fontp->font); |
7888 |
f->output_data.x->baseline_offset = fontp->baseline_offset; |
FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; |
7889 |
f->output_data.x->fontset = -1; |
FRAME_FONTSET (f) = -1; |
7890 |
|
|
7891 |
|
FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f)); |
7892 |
|
FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); |
7893 |
|
|
7894 |
compute_fringe_widths (f, 1); |
compute_fringe_widths (f, 1); |
7895 |
|
|
7896 |
/* Compute the scroll bar width in character columns. */ |
/* Compute the scroll bar width in character columns. */ |
7897 |
if (f->scroll_bar_pixel_width > 0) |
if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) |
7898 |
{ |
{ |
7899 |
int wid = FONT_WIDTH (f->output_data.x->font); |
int wid = FRAME_COLUMN_WIDTH (f); |
7900 |
f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; |
FRAME_CONFIG_SCROLL_BAR_COLS (f) |
7901 |
|
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid; |
7902 |
} |
} |
7903 |
else |
else |
7904 |
{ |
{ |
7905 |
int wid = FONT_WIDTH (f->output_data.x->font); |
int wid = FRAME_COLUMN_WIDTH (f); |
7906 |
f->scroll_bar_cols = (14 + wid - 1) / wid; |
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; |
7907 |
} |
} |
7908 |
|
|
7909 |
/* Now make the frame display the given font. */ |
/* Now make the frame display the given font. */ |
7910 |
if (FRAME_X_WINDOW (f) != 0) |
if (FRAME_X_WINDOW (f) != 0) |
7911 |
{ |
{ |
7912 |
XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, |
XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, |
7913 |
f->output_data.x->font->fid); |
FRAME_FONT (f)->fid); |
7914 |
XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->reverse_gc, |
XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->reverse_gc, |
7915 |
f->output_data.x->font->fid); |
FRAME_FONT (f)->fid); |
7916 |
XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, |
XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, |
7917 |
f->output_data.x->font->fid); |
FRAME_FONT (f)->fid); |
|
|
|
|
frame_update_line_height (f); |
|
7918 |
|
|
7919 |
/* Don't change the size of a tip frame; there's no point in |
/* Don't change the size of a tip frame; there's no point in |
7920 |
doing it because it's done in Fx_show_tip, and it leads to |
doing it because it's done in Fx_show_tip, and it leads to |
7921 |
problems because the tip frame has no widget. */ |
problems because the tip frame has no widget. */ |
7922 |
if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
7923 |
x_set_window_size (f, 0, f->width, f->height); |
x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
7924 |
} |
} |
|
else |
|
|
/* If we are setting a new frame's font for the first time, |
|
|
there are no faces yet, so this font's height is the line height. */ |
|
|
f->output_data.x->line_height = FONT_HEIGHT (f->output_data.x->font); |
|
7925 |
|
|
7926 |
return build_string (fontp->full_name); |
return build_string (fontp->full_name); |
7927 |
} |
} |
7942 |
if (fontset < 0) |
if (fontset < 0) |
7943 |
return Qnil; |
return Qnil; |
7944 |
|
|
7945 |
if (f->output_data.x->fontset == fontset) |
if (FRAME_FONTSET (f) == fontset) |
7946 |
/* This fontset is already set in frame F. There's nothing more |
/* This fontset is already set in frame F. There's nothing more |
7947 |
to do. */ |
to do. */ |
7948 |
return fontset_name (fontset); |
return fontset_name (fontset); |
7954 |
return Qnil; |
return Qnil; |
7955 |
|
|
7956 |
/* Since x_new_font doesn't update any fontset information, do it now. */ |
/* Since x_new_font doesn't update any fontset information, do it now. */ |
7957 |
f->output_data.x->fontset = fontset; |
FRAME_FONTSET (f) = fontset; |
7958 |
|
|
7959 |
#ifdef HAVE_X_I18N |
#ifdef HAVE_X_I18N |
7960 |
if (FRAME_XIC (f) |
if (FRAME_XIC (f) |
8025 |
struct x_display_info *dpyinfo; |
struct x_display_info *dpyinfo; |
8026 |
char *resource_name; |
char *resource_name; |
8027 |
{ |
{ |
|
#ifdef USE_XIM |
|
8028 |
XIM xim; |
XIM xim; |
8029 |
|
|
8030 |
xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, EMACS_CLASS); |
#ifdef HAVE_XIM |
8031 |
dpyinfo->xim = xim; |
if (use_xim) |
|
|
|
|
if (xim) |
|
8032 |
{ |
{ |
8033 |
|
xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, |
8034 |
|
EMACS_CLASS); |
8035 |
|
dpyinfo->xim = xim; |
8036 |
|
|
8037 |
|
if (xim) |
8038 |
|
{ |
8039 |
#ifdef HAVE_X11R6 |
#ifdef HAVE_X11R6 |
8040 |
XIMCallback destroy; |
XIMCallback destroy; |
8041 |
#endif |
#endif |
8042 |
|
|
8043 |
/* Get supported styles and XIM values. */ |
/* Get supported styles and XIM values. */ |
8044 |
XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); |
XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); |
8045 |
|
|
8046 |
#ifdef HAVE_X11R6 |
#ifdef HAVE_X11R6 |
8047 |
destroy.callback = xim_destroy_callback; |
destroy.callback = xim_destroy_callback; |
8048 |
destroy.client_data = (XPointer)dpyinfo; |
destroy.client_data = (XPointer)dpyinfo; |
8049 |
XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); |
XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); |
8050 |
#endif |
#endif |
8051 |
|
} |
8052 |
} |
} |
8053 |
|
|
8054 |
#else /* not USE_XIM */ |
else |
8055 |
dpyinfo->xim = NULL; |
#endif /* HAVE_XIM */ |
8056 |
#endif /* not USE_XIM */ |
dpyinfo->xim = NULL; |
8057 |
} |
} |
8058 |
|
|
8059 |
|
|
8127 |
struct x_display_info *dpyinfo; |
struct x_display_info *dpyinfo; |
8128 |
char *resource_name; |
char *resource_name; |
8129 |
{ |
{ |
8130 |
#ifdef USE_XIM |
#ifdef HAVE_XIM |
8131 |
|
if (use_xim) |
8132 |
|
{ |
8133 |
#ifdef HAVE_X11R6_XIM |
#ifdef HAVE_X11R6_XIM |
8134 |
struct xim_inst_t *xim_inst; |
struct xim_inst_t *xim_inst; |
8135 |
int len; |
int len; |
8136 |
|
|
8137 |
dpyinfo->xim = NULL; |
dpyinfo->xim = NULL; |
8138 |
xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); |
xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); |
8139 |
xim_inst->dpyinfo = dpyinfo; |
xim_inst->dpyinfo = dpyinfo; |
8140 |
len = strlen (resource_name); |
len = strlen (resource_name); |
8141 |
xim_inst->resource_name = (char *) xmalloc (len + 1); |
xim_inst->resource_name = (char *) xmalloc (len + 1); |
8142 |
bcopy (resource_name, xim_inst->resource_name, len + 1); |
bcopy (resource_name, xim_inst->resource_name, len + 1); |
8143 |
XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
8144 |
resource_name, EMACS_CLASS, |
resource_name, EMACS_CLASS, |
8145 |
xim_instantiate_callback, |
xim_instantiate_callback, |
8146 |
/* Fixme: This is XPointer in |
/* This is XPointer in XFree86 |
8147 |
XFree86 but (XPointer *) on |
but (XPointer *) on Tru64, at |
8148 |
Tru64, at least. */ |
least, hence the configure test. */ |
8149 |
(XPointer) xim_inst); |
(XRegisterIMInstantiateCallback_arg6) xim_inst); |
8150 |
#else /* not HAVE_X11R6_XIM */ |
#else /* not HAVE_X11R6_XIM */ |
8151 |
dpyinfo->xim = NULL; |
dpyinfo->xim = NULL; |
8152 |
xim_open_dpy (dpyinfo, resource_name); |
xim_open_dpy (dpyinfo, resource_name); |
8153 |
#endif /* not HAVE_X11R6_XIM */ |
#endif /* not HAVE_X11R6_XIM */ |
8154 |
|
|
8155 |
#else /* not USE_XIM */ |
} |
8156 |
dpyinfo->xim = NULL; |
else |
8157 |
#endif /* not USE_XIM */ |
#endif /* HAVE_XIM */ |
8158 |
|
dpyinfo->xim = NULL; |
8159 |
} |
} |
8160 |
|
|
8161 |
|
|
8165 |
xim_close_dpy (dpyinfo) |
xim_close_dpy (dpyinfo) |
8166 |
struct x_display_info *dpyinfo; |
struct x_display_info *dpyinfo; |
8167 |
{ |
{ |
8168 |
#ifdef USE_XIM |
#ifdef HAVE_XIM |
8169 |
|
if (use_xim) |
8170 |
|
{ |
8171 |
#ifdef HAVE_X11R6_XIM |
#ifdef HAVE_X11R6_XIM |
8172 |
if (dpyinfo->display) |
if (dpyinfo->display) |
8173 |
XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
8174 |
NULL, EMACS_CLASS, |
NULL, EMACS_CLASS, |
8175 |
xim_instantiate_callback, NULL); |
xim_instantiate_callback, NULL); |
8176 |
#endif /* not HAVE_X11R6_XIM */ |
#endif /* not HAVE_X11R6_XIM */ |
8177 |
if (dpyinfo->display) |
if (dpyinfo->display) |
8178 |
XCloseIM (dpyinfo->xim); |
XCloseIM (dpyinfo->xim); |
8179 |
dpyinfo->xim = NULL; |
dpyinfo->xim = NULL; |
8180 |
XFree (dpyinfo->xim_styles); |
XFree (dpyinfo->xim_styles); |
8181 |
#endif /* USE_XIM */ |
} |
8182 |
|
#endif /* HAVE_XIM */ |
8183 |
} |
} |
8184 |
|
|
8185 |
#endif /* not HAVE_X11R6_XIM */ |
#endif /* not HAVE_X11R6_XIM */ |
8195 |
{ |
{ |
8196 |
Window child; |
Window child; |
8197 |
int win_x = 0, win_y = 0; |
int win_x = 0, win_y = 0; |
8198 |
int flags = f->output_data.x->size_hint_flags; |
int flags = f->size_hint_flags; |
8199 |
int this_window; |
int this_window; |
8200 |
|
|
8201 |
/* We have nothing to do if the current position |
/* We have nothing to do if the current position |
8253 |
/* Treat negative positions as relative to the leftmost bottommost |
/* Treat negative positions as relative to the leftmost bottommost |
8254 |
position that fits on the screen. */ |
position that fits on the screen. */ |
8255 |
if (flags & XNegative) |
if (flags & XNegative) |
8256 |
f->output_data.x->left_pos = (FRAME_X_DISPLAY_INFO (f)->width |
f->left_pos = (FRAME_X_DISPLAY_INFO (f)->width |
8257 |
- 2 * f->output_data.x->border_width - win_x |
- 2 * f->border_width - win_x |
8258 |
- PIXEL_WIDTH (f) |
- FRAME_PIXEL_WIDTH (f) |
8259 |
+ f->output_data.x->left_pos); |
+ f->left_pos); |
8260 |
|
|
8261 |
{ |
{ |
8262 |
int height = PIXEL_HEIGHT (f); |
int height = FRAME_PIXEL_HEIGHT (f); |
8263 |
|
|
8264 |
#if defined USE_X_TOOLKIT && defined USE_MOTIF |
#if defined USE_X_TOOLKIT && defined USE_MOTIF |
8265 |
/* Something is fishy here. When using Motif, starting Emacs with |
/* Something is fishy here. When using Motif, starting Emacs with |
8278 |
#endif |
#endif |
8279 |
|
|
8280 |
if (flags & YNegative) |
if (flags & YNegative) |
8281 |
f->output_data.x->top_pos = (FRAME_X_DISPLAY_INFO (f)->height |
f->top_pos = (FRAME_X_DISPLAY_INFO (f)->height |
8282 |
- 2 * f->output_data.x->border_width |
- 2 * f->border_width |
8283 |
- win_y |
- win_y |
8284 |
- height |
- height |
8285 |
+ f->output_data.x->top_pos); |
+ f->top_pos); |
8286 |
} |
} |
8287 |
|
|
8288 |
/* The left_pos and top_pos |
/* The left_pos and top_pos |
8289 |
are now relative to the top and left screen edges, |
are now relative to the top and left screen edges, |
8290 |
so the flags should correspond. */ |
so the flags should correspond. */ |
8291 |
f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); |
f->size_hint_flags &= ~ (XNegative | YNegative); |
8292 |
} |
} |
8293 |
|
|
8294 |
/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, |
/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, |
8307 |
|
|
8308 |
if (change_gravity > 0) |
if (change_gravity > 0) |
8309 |
{ |
{ |
8310 |
f->output_data.x->top_pos = yoff; |
f->top_pos = yoff; |
8311 |
f->output_data.x->left_pos = xoff; |
f->left_pos = xoff; |
8312 |
f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); |
f->size_hint_flags &= ~ (XNegative | YNegative); |
8313 |
if (xoff < 0) |
if (xoff < 0) |
8314 |
f->output_data.x->size_hint_flags |= XNegative; |
f->size_hint_flags |= XNegative; |
8315 |
if (yoff < 0) |
if (yoff < 0) |
8316 |
f->output_data.x->size_hint_flags |= YNegative; |
f->size_hint_flags |= YNegative; |
8317 |
f->output_data.x->win_gravity = NorthWestGravity; |
f->win_gravity = NorthWestGravity; |
8318 |
} |
} |
8319 |
x_calc_absolute_position (f); |
x_calc_absolute_position (f); |
8320 |
|
|
8321 |
BLOCK_INPUT; |
BLOCK_INPUT; |
8322 |
x_wm_set_size_hint (f, (long) 0, 0); |
x_wm_set_size_hint (f, (long) 0, 0); |
8323 |
|
|
8324 |
modified_left = f->output_data.x->left_pos; |
modified_left = f->left_pos; |
8325 |
modified_top = f->output_data.x->top_pos; |
modified_top = f->top_pos; |
8326 |
|
|
8327 |
#if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal, |
#if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal, |
8328 |
this seems to be unnecessary and incorrect. rms, 4/17/97. */ |
this seems to be unnecessary and incorrect. rms, 4/17/97. */ |
8329 |
/* It is a mystery why we need to add the border_width here |
/* It is a mystery why we need to add the border_width here |
8330 |
when the frame is already visible, but experiment says we do. */ |
when the frame is already visible, but experiment says we do. */ |
8331 |
if (change_gravity != 0) |
if (change_gravity != 0) |
8332 |
{ |
{ |
8333 |
modified_left += f->output_data.x->border_width; |
modified_left += f->border_width; |
8334 |
modified_top += f->output_data.x->border_width; |
modified_top += f->border_width; |
8335 |
} |
} |
8336 |
#endif |
#endif |
8337 |
|
|
8338 |
|
if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A) |
8339 |
|
{ |
8340 |
|
/* Some WMs (twm, wmaker at least) has an offset that is smaller |
8341 |
|
than the WM decorations. So we use the calculated offset instead |
8342 |
|
of the WM decoration sizes here (x/y_pixels_outer_diff). */ |
8343 |
|
modified_left += FRAME_X_OUTPUT (f)->move_offset_left; |
8344 |
|
modified_top += FRAME_X_OUTPUT (f)->move_offset_top; |
8345 |
|
} |
8346 |
|
|
8347 |
XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
8348 |
modified_left, modified_top); |
modified_left, modified_top); |
8349 |
|
|
8350 |
|
if (FRAME_VISIBLE_P (f) |
8351 |
|
&& FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) |
8352 |
|
{ |
8353 |
|
FRAME_X_OUTPUT (f)->check_expected_move = 1; |
8354 |
|
FRAME_X_OUTPUT (f)->expected_top = f->top_pos; |
8355 |
|
FRAME_X_OUTPUT (f)->expected_left = f->left_pos; |
8356 |
|
} |
8357 |
|
|
8358 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
8359 |
} |
} |
8360 |
|
|
8364 |
x_check_fullscreen (f) |
x_check_fullscreen (f) |
8365 |
struct frame *f; |
struct frame *f; |
8366 |
{ |
{ |
8367 |
if (f->output_data.x->want_fullscreen & FULLSCREEN_BOTH) |
if (f->want_fullscreen & FULLSCREEN_BOTH) |
8368 |
{ |
{ |
8369 |
int width, height, ign; |
int width, height, ign; |
8370 |
|
|
8371 |
x_real_positions (f, &f->output_data.x->left_pos, |
x_real_positions (f, &f->left_pos, &f->top_pos); |
|
&f->output_data.x->top_pos); |
|
8372 |
|
|
8373 |
x_fullscreen_adjust (f, &width, &height, &ign, &ign); |
x_fullscreen_adjust (f, &width, &height, &ign, &ign); |
8374 |
|
|
8375 |
/* We do not need to move the window, it shall be taken care of |
/* We do not need to move the window, it shall be taken care of |
8376 |
when setting WM manager hints. |
when setting WM manager hints. |
8377 |
If the frame is visible already, the position is checked by |
If the frame is visible already, the position is checked by |
8378 |
x_check_fullscreen_move. */ |
x_check_expected_move. */ |
8379 |
if (f->width != width || f->height != height) |
if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) |
8380 |
{ |
{ |
8381 |
change_frame_size (f, height, width, 0, 1, 0); |
change_frame_size (f, height, width, 0, 1, 0); |
8382 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
8383 |
cancel_mouse_face (f); |
cancel_mouse_face (f); |
8384 |
|
|
8385 |
/* Wait for the change of frame size to occur */ |
/* Wait for the change of frame size to occur */ |
8386 |
f->output_data.x->want_fullscreen |= FULLSCREEN_WAIT; |
f->want_fullscreen |= FULLSCREEN_WAIT; |
8387 |
} |
} |
8388 |
} |
} |
8389 |
} |
} |
8390 |
|
|
8391 |
/* If frame parameters are set after the frame is mapped, we need to move |
/* If frame parameters are set after the frame is mapped, we need to move |
8392 |
the window. This is done in xfns.c. |
the window. |
8393 |
Some window managers moves the window to the right position, some |
Some window managers moves the window to the right position, some |
8394 |
moves the outer window manager window to the specified position. |
moves the outer window manager window to the specified position. |
8395 |
Here we check that we are in the right spot. If not, make a second |
Here we check that we are in the right spot. If not, make a second |
8396 |
move, assuming we are dealing with the second kind of window manager. */ |
move, assuming we are dealing with the second kind of window manager. */ |
8397 |
static void |
static void |
8398 |
x_check_fullscreen_move (f) |
x_check_expected_move (f) |
8399 |
struct frame *f; |
struct frame *f; |
8400 |
{ |
{ |
8401 |
if (f->output_data.x->want_fullscreen & FULLSCREEN_MOVE_WAIT) |
if (FRAME_X_OUTPUT (f)->check_expected_move) |
8402 |
{ |
{ |
8403 |
int expect_top = f->output_data.x->top_pos; |
int expect_top = FRAME_X_OUTPUT (f)->expected_top; |
8404 |
int expect_left = f->output_data.x->left_pos; |
int expect_left = FRAME_X_OUTPUT (f)->expected_left; |
8405 |
|
|
8406 |
|
if (expect_top != f->top_pos || expect_left != f->left_pos) |
8407 |
|
{ |
8408 |
|
FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_A; |
8409 |
|
FRAME_X_OUTPUT (f)->move_offset_left = expect_left - f->left_pos; |
8410 |
|
FRAME_X_OUTPUT (f)->move_offset_top = expect_top - f->top_pos; |
8411 |
|
|
8412 |
if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT) |
x_set_offset (f, expect_left, expect_top, 1); |
8413 |
expect_top = 0; |
} |
8414 |
if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH) |
else if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN) |
8415 |
expect_left = 0; |
FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_B; |
|
|
|
|
if (expect_top != f->output_data.x->top_pos |
|
|
|| expect_left != f->output_data.x->left_pos) |
|
|
x_set_offset (f, expect_left, expect_top, 1); |
|
8416 |
|
|
8417 |
/* Just do this once */ |
/* Just do this once */ |
8418 |
f->output_data.x->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT; |
FRAME_X_OUTPUT (f)->check_expected_move = 0; |
8419 |
} |
} |
8420 |
} |
} |
8421 |
|
|
8434 |
int pixelwidth, pixelheight; |
int pixelwidth, pixelheight; |
8435 |
|
|
8436 |
check_frame_size (f, &rows, &cols); |
check_frame_size (f, &rows, &cols); |
8437 |
f->output_data.x->vertical_scroll_bar_extra |
f->scroll_bar_actual_width |
8438 |
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
8439 |
? 0 |
? 0 |
8440 |
: FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 |
: FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 |
8441 |
? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) |
? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) |
8442 |
: (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); |
: (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))); |
8443 |
|
|
8444 |
compute_fringe_widths (f, 0); |
compute_fringe_widths (f, 0); |
8445 |
|
|
8446 |
pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); |
8447 |
pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); |
8448 |
|
|
8449 |
f->output_data.x->win_gravity = NorthWestGravity; |
f->win_gravity = NorthWestGravity; |
8450 |
x_wm_set_size_hint (f, (long) 0, 0); |
x_wm_set_size_hint (f, (long) 0, 0); |
8451 |
|
|
8452 |
XSync (FRAME_X_DISPLAY (f), False); |
XSync (FRAME_X_DISPLAY (f), False); |
8467 |
We pass 1 for DELAY since we can't run Lisp code inside of |
We pass 1 for DELAY since we can't run Lisp code inside of |
8468 |
a BLOCK_INPUT. */ |
a BLOCK_INPUT. */ |
8469 |
change_frame_size (f, rows, cols, 0, 1, 0); |
change_frame_size (f, rows, cols, 0, 1, 0); |
8470 |
PIXEL_WIDTH (f) = pixelwidth; |
FRAME_PIXEL_WIDTH (f) = pixelwidth; |
8471 |
PIXEL_HEIGHT (f) = pixelheight; |
FRAME_PIXEL_HEIGHT (f) = pixelheight; |
8472 |
|
|
8473 |
/* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to |
/* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to |
8474 |
receive in the ConfigureNotify event; if we get what we asked |
receive in the ConfigureNotify event; if we get what we asked |
8542 |
{ |
{ |
8543 |
int pix_x, pix_y; |
int pix_x, pix_y; |
8544 |
|
|
8545 |
pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->output_data.x->font) / 2; |
pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2; |
8546 |
pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.x->line_height / 2; |
pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2; |
8547 |
|
|
8548 |
if (pix_x < 0) pix_x = 0; |
if (pix_x < 0) pix_x = 0; |
8549 |
if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); |
if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f); |
8550 |
|
|
8551 |
if (pix_y < 0) pix_y = 0; |
if (pix_y < 0) pix_y = 0; |
8552 |
if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); |
if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); |
8553 |
|
|
8554 |
BLOCK_INPUT; |
BLOCK_INPUT; |
8555 |
|
|
8676 |
before the window gets really visible. */ |
before the window gets really visible. */ |
8677 |
if (! FRAME_ICONIFIED_P (f) |
if (! FRAME_ICONIFIED_P (f) |
8678 |
&& ! f->output_data.x->asked_for_visible) |
&& ! f->output_data.x->asked_for_visible) |
8679 |
x_set_offset (f, f->output_data.x->left_pos, f->output_data.x->top_pos, 0); |
x_set_offset (f, f->left_pos, f->top_pos, 0); |
8680 |
|
|
8681 |
f->output_data.x->asked_for_visible = 1; |
f->output_data.x->asked_for_visible = 1; |
8682 |
|
|
8714 |
will set it when they are handled. */ |
will set it when they are handled. */ |
8715 |
int previously_visible = f->output_data.x->has_been_visible; |
int previously_visible = f->output_data.x->has_been_visible; |
8716 |
|
|
8717 |
original_left = f->output_data.x->left_pos; |
original_left = f->left_pos; |
8718 |
original_top = f->output_data.x->top_pos; |
original_top = f->top_pos; |
8719 |
|
|
8720 |
/* This must come after we set COUNT. */ |
/* This must come after we set COUNT. */ |
8721 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
8732 |
and we don't want to override it. */ |
and we don't want to override it. */ |
8733 |
|
|
8734 |
if (! FRAME_VISIBLE_P (f) && ! FRAME_ICONIFIED_P (f) |
if (! FRAME_VISIBLE_P (f) && ! FRAME_ICONIFIED_P (f) |
8735 |
&& f->output_data.x->win_gravity == NorthWestGravity |
&& f->win_gravity == NorthWestGravity |
8736 |
&& previously_visible) |
&& previously_visible) |
8737 |
{ |
{ |
8738 |
Drawable rootw; |
Drawable rootw; |
8798 |
(raise-frame f)) |
(raise-frame f)) |
8799 |
|
|
8800 |
the frame is not raised with various window managers on |
the frame is not raised with various window managers on |
8801 |
FreeBSD, Linux and Solaris. It turns out that, for some |
FreeBSD, GNU/Linux and Solaris. It turns out that, for some |
8802 |
unknown reason, the call to XtMapWidget is completely ignored. |
unknown reason, the call to XtMapWidget is completely ignored. |
8803 |
Mapping the widget a second time works. */ |
Mapping the widget a second time works. */ |
8804 |
|
|
8973 |
/* Make sure the X server knows where the window should be positioned, |
/* Make sure the X server knows where the window should be positioned, |
8974 |
in case the user deiconifies with the window manager. */ |
in case the user deiconifies with the window manager. */ |
8975 |
if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)) |
if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)) |
8976 |
x_set_offset (f, f->output_data.x->left_pos, f->output_data.x->top_pos, 0); |
x_set_offset (f, f->left_pos, f->top_pos, 0); |
8977 |
|
|
8978 |
/* Since we don't know which revision of X we're running, we'll use both |
/* Since we don't know which revision of X we're running, we'll use both |
8979 |
the X11R3 and X11R4 techniques. I don't know if this is a good idea. */ |
the X11R3 and X11R4 techniques. I don't know if this is a good idea. */ |
9188 |
/* Setting PMaxSize caused various problems. */ |
/* Setting PMaxSize caused various problems. */ |
9189 |
size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; |
size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; |
9190 |
|
|
9191 |
size_hints.x = f->output_data.x->left_pos; |
size_hints.x = f->left_pos; |
9192 |
size_hints.y = f->output_data.x->top_pos; |
size_hints.y = f->top_pos; |
9193 |
|
|
9194 |
#ifdef USE_X_TOOLKIT |
#ifdef USE_X_TOOLKIT |
9195 |
XtSetArg (al[ac], XtNwidth, &widget_width); ac++; |
XtSetArg (al[ac], XtNwidth, &widget_width); ac++; |
9198 |
size_hints.height = widget_height; |
size_hints.height = widget_height; |
9199 |
size_hints.width = widget_width; |
size_hints.width = widget_width; |
9200 |
#else /* not USE_X_TOOLKIT */ |
#else /* not USE_X_TOOLKIT */ |
9201 |
size_hints.height = PIXEL_HEIGHT (f); |
size_hints.height = FRAME_PIXEL_HEIGHT (f); |
9202 |
size_hints.width = PIXEL_WIDTH (f); |
size_hints.width = FRAME_PIXEL_WIDTH (f); |
9203 |
#endif /* not USE_X_TOOLKIT */ |
#endif /* not USE_X_TOOLKIT */ |
9204 |
|
|
9205 |
size_hints.width_inc = FONT_WIDTH (f->output_data.x->font); |
size_hints.width_inc = FRAME_COLUMN_WIDTH (f); |
9206 |
size_hints.height_inc = f->output_data.x->line_height; |
size_hints.height_inc = FRAME_LINE_HEIGHT (f); |
9207 |
size_hints.max_width |
size_hints.max_width |
9208 |
= FRAME_X_DISPLAY_INFO (f)->width - CHAR_TO_PIXEL_WIDTH (f, 0); |
= FRAME_X_DISPLAY_INFO (f)->width - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); |
9209 |
size_hints.max_height |
size_hints.max_height |
9210 |
= FRAME_X_DISPLAY_INFO (f)->height - CHAR_TO_PIXEL_HEIGHT (f, 0); |
= FRAME_X_DISPLAY_INFO (f)->height - FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); |
9211 |
|
|
9212 |
/* Calculate the base and minimum sizes. |
/* Calculate the base and minimum sizes. |
9213 |
|
|
9218 |
int base_width, base_height; |
int base_width, base_height; |
9219 |
int min_rows = 0, min_cols = 0; |
int min_rows = 0, min_cols = 0; |
9220 |
|
|
9221 |
base_width = CHAR_TO_PIXEL_WIDTH (f, 0); |
base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); |
9222 |
base_height = CHAR_TO_PIXEL_HEIGHT (f, 0); |
base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); |
9223 |
|
|
9224 |
check_frame_size (f, &min_rows, &min_cols); |
check_frame_size (f, &min_rows, &min_cols); |
9225 |
|
|
9294 |
#endif |
#endif |
9295 |
|
|
9296 |
#ifdef PWinGravity |
#ifdef PWinGravity |
9297 |
size_hints.win_gravity = f->output_data.x->win_gravity; |
size_hints.win_gravity = f->win_gravity; |
9298 |
size_hints.flags |= PWinGravity; |
size_hints.flags |= PWinGravity; |
9299 |
|
|
9300 |
if (user_position) |
if (user_position) |
9339 |
struct frame *f; |
struct frame *f; |
9340 |
int pixmap_id; |
int pixmap_id; |
9341 |
{ |
{ |
9342 |
Pixmap icon_pixmap; |
Pixmap icon_pixmap, icon_mask; |
9343 |
|
|
9344 |
#ifndef USE_X_TOOLKIT |
#ifndef USE_X_TOOLKIT |
9345 |
Window window = FRAME_OUTER_WINDOW (f); |
Window window = FRAME_OUTER_WINDOW (f); |
9349 |
{ |
{ |
9350 |
icon_pixmap = x_bitmap_pixmap (f, pixmap_id); |
icon_pixmap = x_bitmap_pixmap (f, pixmap_id); |
9351 |
f->output_data.x->wm_hints.icon_pixmap = icon_pixmap; |
f->output_data.x->wm_hints.icon_pixmap = icon_pixmap; |
9352 |
|
icon_mask = x_bitmap_mask (f, pixmap_id); |
9353 |
|
f->output_data.x->wm_hints.icon_mask = icon_mask; |
9354 |
} |
} |
9355 |
else |
else |
9356 |
{ |
{ |
9363 |
best to explicitly give up. */ |
best to explicitly give up. */ |
9364 |
#if 0 |
#if 0 |
9365 |
f->output_data.x->wm_hints.icon_pixmap = None; |
f->output_data.x->wm_hints.icon_pixmap = None; |
9366 |
|
f->output_data.x->wm_hints.icon_mask = None; |
9367 |
#else |
#else |
9368 |
return; |
return; |
9369 |
#endif |
#endif |
9375 |
Arg al[1]; |
Arg al[1]; |
9376 |
XtSetArg (al[0], XtNiconPixmap, icon_pixmap); |
XtSetArg (al[0], XtNiconPixmap, icon_pixmap); |
9377 |
XtSetValues (f->output_data.x->widget, al, 1); |
XtSetValues (f->output_data.x->widget, al, 1); |
9378 |
|
XtSetArg (al[0], XtNiconMask, icon_mask); |
9379 |
|
XtSetValues (f->output_data.x->widget, al, 1); |
9380 |
} |
} |
9381 |
|
|
9382 |
#else /* not USE_X_TOOLKIT */ |
#else /* not USE_X_TOOLKIT */ |
9383 |
|
|
9384 |
f->output_data.x->wm_hints.flags |= IconPixmapHint; |
f->output_data.x->wm_hints.flags |= (IconPixmapHint | IconMaskHint); |
9385 |
XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); |
XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); |
9386 |
|
|
9387 |
#endif /* not USE_X_TOOLKIT */ |
#endif /* not USE_X_TOOLKIT */ |
9891 |
|
|
9892 |
/* Now fill in the slots of *FONTP. */ |
/* Now fill in the slots of *FONTP. */ |
9893 |
BLOCK_INPUT; |
BLOCK_INPUT; |
9894 |
|
bzero (fontp, sizeof (*fontp)); |
9895 |
fontp->font = font; |
fontp->font = font; |
9896 |
fontp->font_idx = i; |
fontp->font_idx = i; |
9897 |
fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
10146 |
} |
} |
10147 |
#endif |
#endif |
10148 |
|
|
10149 |
|
/* Count number of set bits in mask and number of bits to shift to |
10150 |
|
get to the first bit. With MASK 0x7e0, *BITS is set to 6, and *OFFSET |
10151 |
|
to 5. */ |
10152 |
|
static void |
10153 |
|
get_bits_and_offset (mask, bits, offset) |
10154 |
|
unsigned long mask; |
10155 |
|
int *bits; |
10156 |
|
int *offset; |
10157 |
|
{ |
10158 |
|
int nr = 0; |
10159 |
|
int off = 0; |
10160 |
|
|
10161 |
|
while (!(mask & 1)) |
10162 |
|
{ |
10163 |
|
off++; |
10164 |
|
mask >>= 1; |
10165 |
|
} |
10166 |
|
|
10167 |
|
while (mask & 1) |
10168 |
|
{ |
10169 |
|
nr++; |
10170 |
|
mask >>= 1; |
10171 |
|
} |
10172 |
|
|
10173 |
|
*offset = off; |
10174 |
|
*bits = nr; |
10175 |
|
} |
10176 |
|
|
10177 |
struct x_display_info * |
struct x_display_info * |
10178 |
x_term_init (display_name, xrm_option, resource_name) |
x_term_init (display_name, xrm_option, resource_name) |
10179 |
Lisp_Object display_name; |
Lisp_Object display_name; |
10190 |
if (!x_initialized) |
if (!x_initialized) |
10191 |
{ |
{ |
10192 |
x_initialize (); |
x_initialize (); |
10193 |
x_initialized = 1; |
++x_initialized; |
10194 |
} |
} |
10195 |
|
|
10196 |
#ifdef USE_GTK |
#ifdef USE_GTK |
10206 |
if (x_initialized > 1) |
if (x_initialized > 1) |
10207 |
return 0; |
return 0; |
10208 |
|
|
|
x_initialized++; |
|
|
|
|
10209 |
for (argc = 0; argc < NUM_ARGV; ++argc) |
for (argc = 0; argc < NUM_ARGV; ++argc) |
10210 |
argv[argc] = 0; |
argv[argc] = 0; |
10211 |
|
|
10246 |
s = make_string (file, strlen (file)); |
s = make_string (file, strlen (file)); |
10247 |
abs_file = Fexpand_file_name(s, Qnil); |
abs_file = Fexpand_file_name(s, Qnil); |
10248 |
|
|
10249 |
if (! NILP (abs_file) && Ffile_readable_p (abs_file)) |
if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) |
10250 |
gtk_rc_parse (SDATA (abs_file)); |
gtk_rc_parse (SDATA (abs_file)); |
10251 |
|
|
10252 |
UNGCPRO; |
UNGCPRO; |
10395 |
dpyinfo->height = HeightOfScreen (dpyinfo->screen); |
dpyinfo->height = HeightOfScreen (dpyinfo->screen); |
10396 |
dpyinfo->width = WidthOfScreen (dpyinfo->screen); |
dpyinfo->width = WidthOfScreen (dpyinfo->screen); |
10397 |
dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen); |
dpyinfo->root_window = RootWindowOfScreen (dpyinfo->screen); |
10398 |
|
dpyinfo->client_leader_window = 0; |
10399 |
dpyinfo->grabbed = 0; |
dpyinfo->grabbed = 0; |
10400 |
dpyinfo->reference_count = 0; |
dpyinfo->reference_count = 0; |
10401 |
dpyinfo->icon_bitmap_id = -1; |
dpyinfo->icon_bitmap_id = -1; |
10420 |
dpyinfo->x_focus_event_frame = 0; |
dpyinfo->x_focus_event_frame = 0; |
10421 |
dpyinfo->x_highlight_frame = 0; |
dpyinfo->x_highlight_frame = 0; |
10422 |
dpyinfo->image_cache = make_image_cache (); |
dpyinfo->image_cache = make_image_cache (); |
10423 |
|
dpyinfo->wm_type = X_WMTYPE_UNKNOWN; |
10424 |
|
|
10425 |
|
/* See if we can construct pixel values from RGB values. */ |
10426 |
|
dpyinfo->red_bits = dpyinfo->blue_bits = dpyinfo->green_bits = 0; |
10427 |
|
dpyinfo->red_offset = dpyinfo->blue_offset = dpyinfo->green_offset = 0; |
10428 |
|
|
10429 |
|
if (dpyinfo->visual->class == TrueColor) |
10430 |
|
{ |
10431 |
|
get_bits_and_offset (dpyinfo->visual->red_mask, |
10432 |
|
&dpyinfo->red_bits, &dpyinfo->red_offset); |
10433 |
|
get_bits_and_offset (dpyinfo->visual->blue_mask, |
10434 |
|
&dpyinfo->blue_bits, &dpyinfo->blue_offset); |
10435 |
|
get_bits_and_offset (dpyinfo->visual->green_mask, |
10436 |
|
&dpyinfo->green_bits, &dpyinfo->green_offset); |
10437 |
|
} |
10438 |
|
|
10439 |
/* See if a private colormap is requested. */ |
/* See if a private colormap is requested. */ |
10440 |
if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) |
if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) |
10441 |
{ |
{ |
10480 |
= XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); |
= XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); |
10481 |
dpyinfo->Xatom_wm_window_moved |
dpyinfo->Xatom_wm_window_moved |
10482 |
= XInternAtom (dpyinfo->display, "WM_MOVED", False); |
= XInternAtom (dpyinfo->display, "WM_MOVED", False); |
10483 |
|
dpyinfo->Xatom_wm_client_leader |
10484 |
|
= XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); |
10485 |
dpyinfo->Xatom_editres |
dpyinfo->Xatom_editres |
10486 |
= XInternAtom (dpyinfo->display, "Editres", False); |
= XInternAtom (dpyinfo->display, "Editres", False); |
10487 |
dpyinfo->Xatom_CLIPBOARD |
dpyinfo->Xatom_CLIPBOARD |
10617 |
XSynchronize (dpyinfo->display, True); |
XSynchronize (dpyinfo->display, True); |
10618 |
} |
} |
10619 |
|
|
10620 |
|
{ |
10621 |
|
Lisp_Object value; |
10622 |
|
value = display_x_get_resource (dpyinfo, |
10623 |
|
build_string ("useXIM"), |
10624 |
|
build_string ("UseXIM"), |
10625 |
|
Qnil, Qnil); |
10626 |
|
#ifdef USE_XIM |
10627 |
|
if (STRINGP (value) |
10628 |
|
&& (!strcmp (XSTRING (value)->data, "false") |
10629 |
|
|| !strcmp (XSTRING (value)->data, "off"))) |
10630 |
|
use_xim = 0; |
10631 |
|
#else |
10632 |
|
if (STRINGP (value) |
10633 |
|
&& (!strcmp (XSTRING (value)->data, "true") |
10634 |
|
|| !strcmp (XSTRING (value)->data, "on"))) |
10635 |
|
use_xim = 1; |
10636 |
|
#endif |
10637 |
|
} |
10638 |
|
|
10639 |
|
#ifdef HAVE_X_SM |
10640 |
|
/* Only do this for the first display. */ |
10641 |
|
if (x_initialized == 1) |
10642 |
|
x_session_initialize (dpyinfo); |
10643 |
|
#endif |
10644 |
|
|
10645 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
10646 |
|
|
10647 |
return dpyinfo; |
return dpyinfo; |
10654 |
x_delete_display (dpyinfo) |
x_delete_display (dpyinfo) |
10655 |
struct x_display_info *dpyinfo; |
struct x_display_info *dpyinfo; |
10656 |
{ |
{ |
10657 |
|
int i; |
10658 |
|
|
10659 |
delete_keyboard_wait_descriptor (dpyinfo->connection); |
delete_keyboard_wait_descriptor (dpyinfo->connection); |
10660 |
|
|
10661 |
/* Discard this display from x_display_name_list and x_display_list. |
/* Discard this display from x_display_name_list and x_display_list. |
10707 |
xim_close_dpy (dpyinfo); |
xim_close_dpy (dpyinfo); |
10708 |
#endif |
#endif |
10709 |
|
|
10710 |
|
/* Free the font names in the font table. */ |
10711 |
|
for (i = 0; i < dpyinfo->n_fonts; i++) |
10712 |
|
if (dpyinfo->font_table[i].name) |
10713 |
|
{ |
10714 |
|
if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) |
10715 |
|
xfree (dpyinfo->font_table[i].full_name); |
10716 |
|
xfree (dpyinfo->font_table[i].name); |
10717 |
|
} |
10718 |
|
|
10719 |
|
if (dpyinfo->font_table->font_encoder) |
10720 |
|
xfree (dpyinfo->font_table->font_encoder); |
10721 |
|
|
10722 |
xfree (dpyinfo->font_table); |
xfree (dpyinfo->font_table); |
10723 |
xfree (dpyinfo->x_id_name); |
xfree (dpyinfo->x_id_name); |
10724 |
xfree (dpyinfo->color_cells); |
xfree (dpyinfo->color_cells); |
10869 |
#endif /* SIGWINCH */ |
#endif /* SIGWINCH */ |
10870 |
|
|
10871 |
signal (SIGPIPE, x_connection_signal); |
signal (SIGPIPE, x_connection_signal); |
|
|
|
|
#ifdef HAVE_X_SM |
|
|
x_session_initialize (); |
|
|
#endif |
|
10872 |
} |
} |
10873 |
|
|
10874 |
|
|
10971 |
} |
} |
10972 |
|
|
10973 |
#endif /* HAVE_X_WINDOWS */ |
#endif /* HAVE_X_WINDOWS */ |
10974 |
|
|
10975 |
|
/* arch-tag: 6d4e4cb7-abc1-4302-9585-d84dcfb09d0f |
10976 |
|
(do not change this comment) */ |