Mercurial > emacs
comparison src/xterm.c @ 51897:535ddb6daa07
(x_bitmap_icon,x_wm_set_icon_pixmap): Modify to add mask, and use the Gtk+
function gtk_window_icon_from_file if available.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sun, 13 Jul 2003 17:27:51 +0000 |
parents | 7003a80a49ec |
children | 610a102ed36c |
comparison
equal
deleted
inserted
replaced
51896:b0d51b510fb5 | 51897:535ddb6daa07 |
---|---|
532 x_draw_vertical_window_border (w, x, y0, y1) | 532 x_draw_vertical_window_border (w, x, y0, y1) |
533 struct window *w; | 533 struct window *w; |
534 int x, y0, y1; | 534 int x, y0, y1; |
535 { | 535 { |
536 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 536 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
537 | 537 |
538 XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 538 XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
539 f->output_data.x->normal_gc, x, y0, x, y1); | 539 f->output_data.x->normal_gc, x, y0, x, y1); |
540 } | 540 } |
541 | 541 |
542 /* End update of window W (which is equal to updated_window). | 542 /* End update of window W (which is equal to updated_window). |
3986 struct window *w; | 3986 struct window *w; |
3987 | 3987 |
3988 x_send_scroll_bar_event (window_being_scrolled, | 3988 x_send_scroll_bar_event (window_being_scrolled, |
3989 scroll_bar_end_scroll, 0, 0); | 3989 scroll_bar_end_scroll, 0, 0); |
3990 w = XWINDOW (window_being_scrolled); | 3990 w = XWINDOW (window_being_scrolled); |
3991 | 3991 |
3992 if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging)) | 3992 if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging)) |
3993 { | 3993 { |
3994 XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; | 3994 XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; |
3995 /* The thumb size is incorrect while dragging: fix it. */ | 3995 /* The thumb size is incorrect while dragging: fix it. */ |
3996 set_vertical_scroll_bar (w); | 3996 set_vertical_scroll_bar (w); |
6723 #else /* not USE_GTK */ | 6723 #else /* not USE_GTK */ |
6724 /* If there is a pending resize for fullscreen, don't | 6724 /* If there is a pending resize for fullscreen, don't |
6725 do this one, the right one will come later. | 6725 do this one, the right one will come later. |
6726 The toolkit version doesn't seem to need this, but we | 6726 The toolkit version doesn't seem to need this, but we |
6727 need to reset it below. */ | 6727 need to reset it below. */ |
6728 int dont_resize | 6728 int dont_resize |
6729 = ((f->want_fullscreen & FULLSCREEN_WAIT) | 6729 = ((f->want_fullscreen & FULLSCREEN_WAIT) |
6730 && f->new_text_cols != 0); | 6730 && f->new_text_cols != 0); |
6731 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); | 6731 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); |
6732 int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width); | 6732 int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width); |
6733 | 6733 |
7462 int bitmap_id; | 7462 int bitmap_id; |
7463 | 7463 |
7464 if (FRAME_X_WINDOW (f) == 0) | 7464 if (FRAME_X_WINDOW (f) == 0) |
7465 return 1; | 7465 return 1; |
7466 | 7466 |
7467 /* Free up our existing icon bitmap if any. */ | 7467 /* Free up our existing icon bitmap and mask if any. */ |
7468 if (f->output_data.x->icon_bitmap > 0) | 7468 if (f->output_data.x->icon_bitmap > 0) |
7469 x_destroy_bitmap (f, f->output_data.x->icon_bitmap); | 7469 x_destroy_bitmap (f, f->output_data.x->icon_bitmap); |
7470 f->output_data.x->icon_bitmap = 0; | 7470 f->output_data.x->icon_bitmap = 0; |
7471 | 7471 |
7472 if (STRINGP (file)) | 7472 if (STRINGP (file)) |
7473 bitmap_id = x_create_bitmap_from_file (f, file); | 7473 { |
7474 #ifdef USE_GTK | |
7475 /* Use gtk_window_set_icon_from_file() if available, | |
7476 It's not restricted to bitmaps */ | |
7477 if (!xg_set_icon(f, file)) | |
7478 return 0; | |
7479 #endif /* USE_GTK */ | |
7480 bitmap_id = x_create_bitmap_from_file (f, file); | |
7481 x_create_bitmap_mask(f, bitmap_id); | |
7482 } | |
7474 else | 7483 else |
7475 { | 7484 { |
7476 /* Create the GNU bitmap if necessary. */ | 7485 /* Create the GNU bitmap and mask if necessary. */ |
7477 if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0) | 7486 if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0) |
7478 FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id | 7487 { |
7479 = x_create_bitmap_from_data (f, gnu_bits, | 7488 FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id |
7480 gnu_width, gnu_height); | 7489 = x_create_bitmap_from_data (f, gnu_bits, |
7481 | 7490 gnu_width, gnu_height); |
7482 /* The first time we create the GNU bitmap, | 7491 x_create_bitmap_mask(f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); |
7492 } | |
7493 | |
7494 /* The first time we create the GNU bitmap and mask, | |
7483 this increments the ref-count one extra time. | 7495 this increments the ref-count one extra time. |
7484 As a result, the GNU bitmap is never freed. | 7496 As a result, the GNU bitmap and mask are never freed. |
7485 That way, we don't have to worry about allocating it again. */ | 7497 That way, we don't have to worry about allocating it again. */ |
7486 x_reference_bitmap (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); | 7498 x_reference_bitmap (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); |
7487 | 7499 |
7488 bitmap_id = FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id; | 7500 bitmap_id = FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id; |
7489 } | 7501 } |
9294 void | 9306 void |
9295 x_wm_set_icon_pixmap (f, pixmap_id) | 9307 x_wm_set_icon_pixmap (f, pixmap_id) |
9296 struct frame *f; | 9308 struct frame *f; |
9297 int pixmap_id; | 9309 int pixmap_id; |
9298 { | 9310 { |
9299 Pixmap icon_pixmap; | 9311 Pixmap icon_pixmap, icon_mask; |
9300 | 9312 |
9301 #ifndef USE_X_TOOLKIT | 9313 #ifndef USE_X_TOOLKIT |
9302 Window window = FRAME_OUTER_WINDOW (f); | 9314 Window window = FRAME_OUTER_WINDOW (f); |
9303 #endif | 9315 #endif |
9304 | 9316 |
9305 if (pixmap_id > 0) | 9317 if (pixmap_id > 0) |
9306 { | 9318 { |
9307 icon_pixmap = x_bitmap_pixmap (f, pixmap_id); | 9319 icon_pixmap = x_bitmap_pixmap (f, pixmap_id); |
9308 f->output_data.x->wm_hints.icon_pixmap = icon_pixmap; | 9320 f->output_data.x->wm_hints.icon_pixmap = icon_pixmap; |
9321 icon_mask = x_bitmap_mask (f, pixmap_id); | |
9322 f->output_data.x->wm_hints.icon_mask = icon_mask; | |
9309 } | 9323 } |
9310 else | 9324 else |
9311 { | 9325 { |
9312 /* It seems there is no way to turn off use of an icon pixmap. | 9326 /* It seems there is no way to turn off use of an icon pixmap. |
9313 The following line does it, only if no icon has yet been created, | 9327 The following line does it, only if no icon has yet been created, |
9316 but that doesn't work, and the X consortium said it isn't the | 9330 but that doesn't work, and the X consortium said it isn't the |
9317 right thing at all. Since there is no way to win, | 9331 right thing at all. Since there is no way to win, |
9318 best to explicitly give up. */ | 9332 best to explicitly give up. */ |
9319 #if 0 | 9333 #if 0 |
9320 f->output_data.x->wm_hints.icon_pixmap = None; | 9334 f->output_data.x->wm_hints.icon_pixmap = None; |
9335 f->output_data.x->wm_hints.icon_mask = None; | |
9321 #else | 9336 #else |
9322 return; | 9337 return; |
9323 #endif | 9338 #endif |
9324 } | 9339 } |
9325 | 9340 |
9327 | 9342 |
9328 { | 9343 { |
9329 Arg al[1]; | 9344 Arg al[1]; |
9330 XtSetArg (al[0], XtNiconPixmap, icon_pixmap); | 9345 XtSetArg (al[0], XtNiconPixmap, icon_pixmap); |
9331 XtSetValues (f->output_data.x->widget, al, 1); | 9346 XtSetValues (f->output_data.x->widget, al, 1); |
9347 XtSetArg (al[0], XtNiconMask, icon_mask); | |
9348 XtSetValues (f->output_data.x->widget, al, 1); | |
9332 } | 9349 } |
9333 | 9350 |
9334 #else /* not USE_X_TOOLKIT */ | 9351 #else /* not USE_X_TOOLKIT */ |
9335 | 9352 |
9336 f->output_data.x->wm_hints.flags |= IconPixmapHint; | 9353 f->output_data.x->wm_hints.flags |= (IconPixmapHint | IconMaskHint); |
9337 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); | 9354 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); |
9338 | 9355 |
9339 #endif /* not USE_X_TOOLKIT */ | 9356 #endif /* not USE_X_TOOLKIT */ |
9340 } | 9357 } |
9341 | 9358 |
10521 if (STRINGP (value) | 10538 if (STRINGP (value) |
10522 && (!strcmp (SDATA (value), "true") | 10539 && (!strcmp (SDATA (value), "true") |
10523 || !strcmp (SDATA (value), "on"))) | 10540 || !strcmp (SDATA (value), "on"))) |
10524 XSynchronize (dpyinfo->display, True); | 10541 XSynchronize (dpyinfo->display, True); |
10525 } | 10542 } |
10526 | 10543 |
10527 { | 10544 { |
10528 Lisp_Object value; | 10545 Lisp_Object value; |
10529 value = display_x_get_resource (dpyinfo, | 10546 value = display_x_get_resource (dpyinfo, |
10530 build_string ("useXIM"), | 10547 build_string ("useXIM"), |
10531 build_string ("UseXIM"), | 10548 build_string ("UseXIM"), |