Mercurial > emacs
comparison src/xterm.c @ 109160:f8660b83cdbf
Fix whitespace to follow coding guidelines.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 07 Jul 2010 11:45:28 +0200 |
parents | 004119b4b62e |
children | 750db9f3e6d8 |
comparison
equal
deleted
inserted
replaced
109159:3e9fdeb960d1 | 109160:f8660b83cdbf |
---|---|
479 unsigned long opac; | 479 unsigned long opac; |
480 | 480 |
481 if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc) | 481 if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc) |
482 /* Since the WM decoration lies under the FRAME_OUTER_WINDOW, | 482 /* Since the WM decoration lies under the FRAME_OUTER_WINDOW, |
483 we must treat the former instead of the latter. */ | 483 we must treat the former instead of the latter. */ |
484 win = FRAME_X_OUTPUT(f)->parent_desc; | 484 win = FRAME_X_OUTPUT (f)->parent_desc; |
485 | 485 |
486 if (dpyinfo->x_highlight_frame == f) | 486 if (dpyinfo->x_highlight_frame == f) |
487 alpha = f->alpha[0]; | 487 alpha = f->alpha[0]; |
488 else | 488 else |
489 alpha = f->alpha[1]; | 489 alpha = f->alpha[1]; |
508 Atom actual; | 508 Atom actual; |
509 int rc, format; | 509 int rc, format; |
510 unsigned long n, left; | 510 unsigned long n, left; |
511 | 511 |
512 x_catch_errors (dpy); | 512 x_catch_errors (dpy); |
513 rc = XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False), | 513 rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), |
514 0L, 1L, False, XA_CARDINAL, | 514 0L, 1L, False, XA_CARDINAL, |
515 &actual, &format, &n, &left, | 515 &actual, &format, &n, &left, |
516 &data); | 516 &data); |
517 | 517 |
518 if (rc == Success && actual != None) | 518 if (rc == Success && actual != None) |
519 if (*(unsigned long *)data == opac) | 519 if (*(unsigned long *)data == opac) |
520 { | 520 { |
521 XFree ((void *) data); | 521 XFree ((void *) data); |
2257 raised_p = s->img->relief > 0; | 2257 raised_p = s->img->relief > 0; |
2258 } | 2258 } |
2259 | 2259 |
2260 extra = s->face->id == TOOL_BAR_FACE_ID | 2260 extra = s->face->id == TOOL_BAR_FACE_ID |
2261 ? XINT (Vtool_bar_button_margin) : 0; | 2261 ? XINT (Vtool_bar_button_margin) : 0; |
2262 | 2262 |
2263 x0 = x - thick - extra; | 2263 x0 = x - thick - extra; |
2264 y0 = y - thick - extra; | 2264 y0 = y - thick - extra; |
2265 x1 = x + s->slice.width + thick - 1 + extra; | 2265 x1 = x + s->slice.width + thick - 1 + extra; |
2266 y1 = y + s->slice.height + thick - 1 + extra; | 2266 y1 = y + s->slice.height + thick - 1 + extra; |
2267 | 2267 |
2877 #if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) | 2877 #if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) |
2878 /* Make sure scroll bars are redrawn. As they aren't redrawn by | 2878 /* Make sure scroll bars are redrawn. As they aren't redrawn by |
2879 redisplay, do it here. */ | 2879 redisplay, do it here. */ |
2880 gtk_widget_queue_draw (FRAME_GTK_WIDGET (f)); | 2880 gtk_widget_queue_draw (FRAME_GTK_WIDGET (f)); |
2881 #endif | 2881 #endif |
2882 | 2882 |
2883 XFlush (FRAME_X_DISPLAY (f)); | 2883 XFlush (FRAME_X_DISPLAY (f)); |
2884 | 2884 |
2885 UNBLOCK_INPUT; | 2885 UNBLOCK_INPUT; |
2886 } | 2886 } |
2887 | 2887 |
3084 | 3084 |
3085 static void | 3085 static void |
3086 XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) | 3086 XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) |
3087 { | 3087 { |
3088 BLOCK_INPUT; | 3088 BLOCK_INPUT; |
3089 if (invisible) | 3089 if (invisible) |
3090 { | 3090 { |
3091 if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) | 3091 if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) |
3092 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3092 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
3093 FRAME_X_DISPLAY_INFO (f)->invisible_cursor); | 3093 FRAME_X_DISPLAY_INFO (f)->invisible_cursor); |
3094 } | 3094 } |
4551 | 4551 |
4552 /* Allocate them, if necessary. */ | 4552 /* Allocate them, if necessary. */ |
4553 if (f->output_data.x->scroll_bar_top_shadow_pixel == -1) | 4553 if (f->output_data.x->scroll_bar_top_shadow_pixel == -1) |
4554 { | 4554 { |
4555 pixel = f->output_data.x->scroll_bar_background_pixel; | 4555 pixel = f->output_data.x->scroll_bar_background_pixel; |
4556 if (pixel != -1) | 4556 if (pixel != -1) |
4557 { | 4557 { |
4558 if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), | 4558 if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), |
4559 FRAME_X_COLORMAP (f), | 4559 FRAME_X_COLORMAP (f), |
4560 &pixel, 1.2, 0x8000)) | 4560 &pixel, 1.2, 0x8000)) |
4561 pixel = -1; | 4561 pixel = -1; |
4563 } | 4563 } |
4564 } | 4564 } |
4565 if (f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) | 4565 if (f->output_data.x->scroll_bar_bottom_shadow_pixel == -1) |
4566 { | 4566 { |
4567 pixel = f->output_data.x->scroll_bar_background_pixel; | 4567 pixel = f->output_data.x->scroll_bar_background_pixel; |
4568 if (pixel != -1) | 4568 if (pixel != -1) |
4569 { | 4569 { |
4570 if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), | 4570 if (!x_alloc_lighter_color (f, FRAME_X_DISPLAY (f), |
4571 FRAME_X_COLORMAP (f), | 4571 FRAME_X_COLORMAP (f), |
4572 &pixel, 0.6, 0x4000)) | 4572 &pixel, 0.6, 0x4000)) |
4573 pixel = -1; | 4573 pixel = -1; |
5727 *finish = X_EVENT_NORMAL; | 5727 *finish = X_EVENT_NORMAL; |
5728 | 5728 |
5729 EVENT_INIT (inev.ie); | 5729 EVENT_INIT (inev.ie); |
5730 inev.ie.kind = NO_EVENT; | 5730 inev.ie.kind = NO_EVENT; |
5731 inev.ie.arg = Qnil; | 5731 inev.ie.arg = Qnil; |
5732 | 5732 |
5733 if (pending_event_wait.eventtype == event.type) | 5733 if (pending_event_wait.eventtype == event.type) |
5734 pending_event_wait.eventtype = 0; /* Indicates we got it. */ | 5734 pending_event_wait.eventtype = 0; /* Indicates we got it. */ |
5735 | 5735 |
5736 switch (event.type) | 5736 switch (event.type) |
5737 { | 5737 { |
5738 case ClientMessage: | 5738 case ClientMessage: |
5739 { | 5739 { |
5740 if (event.xclient.message_type | 5740 if (event.xclient.message_type |
6650 { | 6650 { |
6651 xg_frame_resized (f, event.xconfigure.width, | 6651 xg_frame_resized (f, event.xconfigure.width, |
6652 event.xconfigure.height); | 6652 event.xconfigure.height); |
6653 f = 0; | 6653 f = 0; |
6654 } | 6654 } |
6655 #endif | 6655 #endif |
6656 if (f) | 6656 if (f) |
6657 { | 6657 { |
6658 #ifndef USE_X_TOOLKIT | 6658 #ifndef USE_X_TOOLKIT |
6659 #ifndef USE_GTK | 6659 #ifndef USE_GTK |
6660 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); | 6660 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); |
8384 XSETFRAME (frame, f); | 8384 XSETFRAME (frame, f); |
8385 | 8385 |
8386 set_wm_state (frame, 0, fs, NULL); | 8386 set_wm_state (frame, 0, fs, NULL); |
8387 set_wm_state (frame, 0, fh, NULL); | 8387 set_wm_state (frame, 0, fh, NULL); |
8388 set_wm_state (frame, 0, fw, NULL); | 8388 set_wm_state (frame, 0, fw, NULL); |
8389 | 8389 |
8390 /* If there are _NET_ atoms we assume we have extended window manager | 8390 /* If there are _NET_ atoms we assume we have extended window manager |
8391 hints. */ | 8391 hints. */ |
8392 switch (f->want_fullscreen) | 8392 switch (f->want_fullscreen) |
8393 { | 8393 { |
8394 case FULLSCREEN_BOTH: | 8394 case FULLSCREEN_BOTH: |
8457 x_uncatch_errors (); | 8457 x_uncatch_errors (); |
8458 | 8458 |
8459 for (i = 0; i < actual_size; ++i) | 8459 for (i = 0; i < actual_size; ++i) |
8460 { | 8460 { |
8461 Atom a = ((Atom*)tmp_data)[i]; | 8461 Atom a = ((Atom*)tmp_data)[i]; |
8462 if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) | 8462 if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) |
8463 { | 8463 { |
8464 if (value == FULLSCREEN_HEIGHT) | 8464 if (value == FULLSCREEN_HEIGHT) |
8465 value = FULLSCREEN_MAXIMIZED; | 8465 value = FULLSCREEN_MAXIMIZED; |
8466 else | 8466 else |
8467 value = FULLSCREEN_WIDTH; | 8467 value = FULLSCREEN_WIDTH; |
8478 else if (a == dpyinfo->Xatom_net_wm_state_sticky) | 8478 else if (a == dpyinfo->Xatom_net_wm_state_sticky) |
8479 sticky = 1; | 8479 sticky = 1; |
8480 } | 8480 } |
8481 | 8481 |
8482 lval = Qnil; | 8482 lval = Qnil; |
8483 switch (value) | 8483 switch (value) |
8484 { | 8484 { |
8485 case FULLSCREEN_WIDTH: | 8485 case FULLSCREEN_WIDTH: |
8486 lval = Qfullwidth; | 8486 lval = Qfullwidth; |
8487 break; | 8487 break; |
8488 case FULLSCREEN_HEIGHT: | 8488 case FULLSCREEN_HEIGHT: |
8493 break; | 8493 break; |
8494 case FULLSCREEN_MAXIMIZED: | 8494 case FULLSCREEN_MAXIMIZED: |
8495 lval = Qmaximized; | 8495 lval = Qmaximized; |
8496 break; | 8496 break; |
8497 } | 8497 } |
8498 | 8498 |
8499 store_frame_param (f, Qfullscreen, lval); | 8499 store_frame_param (f, Qfullscreen, lval); |
8500 store_frame_param (f, Qsticky, sticky ? Qt : Qnil); | 8500 store_frame_param (f, Qsticky, sticky ? Qt : Qnil); |
8501 | 8501 |
8502 if (tmp_data) XFree (tmp_data); | 8502 if (tmp_data) XFree (tmp_data); |
8503 UNBLOCK_INPUT; | 8503 UNBLOCK_INPUT; |
8531 width = x_display_pixel_width (dpyinfo); | 8531 width = x_display_pixel_width (dpyinfo); |
8532 break; | 8532 break; |
8533 case FULLSCREEN_HEIGHT: | 8533 case FULLSCREEN_HEIGHT: |
8534 height = x_display_pixel_height (dpyinfo); | 8534 height = x_display_pixel_height (dpyinfo); |
8535 } | 8535 } |
8536 | 8536 |
8537 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) | 8537 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height) |
8538 { | 8538 { |
8539 change_frame_size (f, height, width, 0, 1, 0); | 8539 change_frame_size (f, height, width, 0, 1, 0); |
8540 SET_FRAME_GARBAGED (f); | 8540 SET_FRAME_GARBAGED (f); |
8541 cancel_mouse_face (f); | 8541 cancel_mouse_face (f); |
8659 BLOCK_INPUT; | 8659 BLOCK_INPUT; |
8660 interrupt_input_blocked = level; | 8660 interrupt_input_blocked = level; |
8661 | 8661 |
8662 FD_ZERO (&fds); | 8662 FD_ZERO (&fds); |
8663 FD_SET (fd, &fds); | 8663 FD_SET (fd, &fds); |
8664 | 8664 |
8665 EMACS_GET_TIME (time_now); | 8665 EMACS_GET_TIME (time_now); |
8666 EMACS_SUB_TIME (tmo, tmo_at, time_now); | 8666 EMACS_SUB_TIME (tmo, tmo_at, time_now); |
8667 | 8667 |
8668 if (EMACS_TIME_NEG_P (tmo) || select (fd+1, &fds, NULL, NULL, &tmo) == 0) | 8668 if (EMACS_TIME_NEG_P (tmo) || select (fd+1, &fds, NULL, NULL, &tmo) == 0) |
8669 break; /* Timeout */ | 8669 break; /* Timeout */ |
8749 BLOCK_INPUT; | 8749 BLOCK_INPUT; |
8750 | 8750 |
8751 if (NILP (tip_frame) || XFRAME (tip_frame) != f) | 8751 if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
8752 { | 8752 { |
8753 int r, c; | 8753 int r, c; |
8754 | 8754 |
8755 /* When the frame is maximized/fullscreen or running under for | 8755 /* When the frame is maximized/fullscreen or running under for |
8756 example Xmonad, x_set_window_size_1 will be a no-op. | 8756 example Xmonad, x_set_window_size_1 will be a no-op. |
8757 In that case, the right thing to do is extend rows/cols to | 8757 In that case, the right thing to do is extend rows/cols to |
8758 the current frame size. We do that first if x_set_window_size_1 | 8758 the current frame size. We do that first if x_set_window_size_1 |
8759 turns out to not be a no-op (there is no way to know). | 8759 turns out to not be a no-op (there is no way to know). |
9788 { | 9788 { |
9789 if (!strstr (message, "g_set_prgname")) | 9789 if (!strstr (message, "g_set_prgname")) |
9790 fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); | 9790 fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); |
9791 } | 9791 } |
9792 #endif | 9792 #endif |
9793 | 9793 |
9794 /* Open a connection to X display DISPLAY_NAME, and return | 9794 /* Open a connection to X display DISPLAY_NAME, and return |
9795 the structure that describes the open display. | 9795 the structure that describes the open display. |
9796 If we cannot contact the display, return null. */ | 9796 If we cannot contact the display, return null. */ |
9797 | 9797 |
9798 struct x_display_info * | 9798 struct x_display_info * |
10209 = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); | 10209 = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); |
10210 dpyinfo->Xatom_net_wm_icon_name | 10210 dpyinfo->Xatom_net_wm_icon_name |
10211 = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); | 10211 = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); |
10212 dpyinfo->Xatom_net_wm_name | 10212 dpyinfo->Xatom_net_wm_name |
10213 = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); | 10213 = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); |
10214 | 10214 |
10215 dpyinfo->cut_buffers_initialized = 0; | 10215 dpyinfo->cut_buffers_initialized = 0; |
10216 | 10216 |
10217 dpyinfo->x_dnd_atoms_size = 8; | 10217 dpyinfo->x_dnd_atoms_size = 8; |
10218 dpyinfo->x_dnd_atoms_length = 0; | 10218 dpyinfo->x_dnd_atoms_length = 0; |
10219 dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) | 10219 dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms) |
10338 if (t->type == output_x_window && t->display_info.x == dpyinfo) | 10338 if (t->type == output_x_window && t->display_info.x == dpyinfo) |
10339 { | 10339 { |
10340 #ifdef HAVE_X_SM | 10340 #ifdef HAVE_X_SM |
10341 /* Close X session management when we close its display. */ | 10341 /* Close X session management when we close its display. */ |
10342 if (t->id == 1 && x_session_have_connection ()) | 10342 if (t->id == 1 && x_session_have_connection ()) |
10343 x_session_close(); | 10343 x_session_close (); |
10344 #endif | 10344 #endif |
10345 delete_terminal (t); | 10345 delete_terminal (t); |
10346 break; | 10346 break; |
10347 } | 10347 } |
10348 | 10348 |