DefaultScreen() returns the screen number not Screen*

2002-05-09  Havoc Pennington  <hp@redhat.com>

	* src/frames.c (show_tip_now): DefaultScreen() returns the screen
	number not Screen*

	* src/frame.c (meta_frame_sync_to_window): immediately repaint
	frame whenever we resize it, if we're inside a grab operation.

	* src/frames.c (meta_frames_repaint_frame): new function

	* src/window.c (meta_window_new): initialize window's colormap
	(meta_window_notify_focus): install the colormap for a window when
	it gets focus, uninstall on unfocus.

	* src/window.h (struct _MetaWindow): store window's colormap

	* src/display.c (event_callback): note changes to window colormap

	* src/frame.c (EVENT_MASK): add ColormapChangeMask
This commit is contained in:
Havoc Pennington 2002-05-09 22:34:00 +00:00 committed by Havoc Pennington
parent 6d2c558bd8
commit 912afb6e6b
9 changed files with 80 additions and 5 deletions

View File

@ -1,3 +1,23 @@
2002-05-09 Havoc Pennington <hp@redhat.com>
* src/frames.c (show_tip_now): DefaultScreen() returns the screen
number not Screen*
* src/frame.c (meta_frame_sync_to_window): immediately repaint
frame whenever we resize it, if we're inside a grab operation.
* src/frames.c (meta_frames_repaint_frame): new function
* src/window.c (meta_window_new): initialize window's colormap
(meta_window_notify_focus): install the colormap for a window when
it gets focus, uninstall on unfocus.
* src/window.h (struct _MetaWindow): store window's colormap
* src/display.c (event_callback): note changes to window colormap
* src/frame.c (EVENT_MASK): add ColormapChangeMask
2002-05-09 Havoc Pennington <hp@redhat.com> 2002-05-09 Havoc Pennington <hp@redhat.com>
* src/display.c (event_callback): make Alt+button2 do a resize * src/display.c (event_callback): make Alt+button2 do a resize

View File

@ -1248,6 +1248,8 @@ event_callback (XEvent *event,
case SelectionNotify: case SelectionNotify:
break; break;
case ColormapNotify: case ColormapNotify:
if (window && !frame_was_receiver)
window->colormap = event->xcolormap.colormap;
break; break;
case ClientMessage: case ClientMessage:
if (window) if (window)

View File

@ -29,7 +29,8 @@
ButtonPressMask | ButtonReleaseMask | \ ButtonPressMask | ButtonReleaseMask | \
PointerMotionMask | PointerMotionHintMask | \ PointerMotionMask | PointerMotionHintMask | \
EnterWindowMask | LeaveWindowMask | \ EnterWindowMask | LeaveWindowMask | \
FocusChangeMask) FocusChangeMask | \
ColormapChangeMask)
void void
meta_window_ensure_frame (MetaWindow *window) meta_window_ensure_frame (MetaWindow *window)
@ -303,8 +304,18 @@ meta_frame_sync_to_window (MetaFrame *frame,
frame->rect.height); frame->rect.height);
if (need_resize) if (need_resize)
{
meta_ui_reset_frame_bg (frame->window->screen->ui, meta_ui_reset_frame_bg (frame->window->screen->ui,
frame->xwindow); frame->xwindow);
/* If we're interactively resizing the frame, repaint
* it immediately so we don't start to lag.
*/
if (frame->window->display->grab_window ==
frame->window)
meta_ui_repaint_frame (frame->window->screen->ui,
frame->xwindow);
}
} }
void void

View File

@ -636,6 +636,8 @@ meta_frames_set_title (MetaFrames *frames,
frame = meta_frames_lookup_window (frames, xwindow); frame = meta_frames_lookup_window (frames, xwindow);
g_assert (frame);
g_free (frame->title); g_free (frame->title);
frame->title = g_strdup (title); frame->title = g_strdup (title);
@ -648,6 +650,21 @@ meta_frames_set_title (MetaFrames *frames,
gdk_window_invalidate_rect (frame->window, NULL, FALSE); gdk_window_invalidate_rect (frame->window, NULL, FALSE);
} }
void
meta_frames_repaint_frame (MetaFrames *frames,
Window xwindow)
{
GtkWidget *widget;
MetaUIFrame *frame;
widget = GTK_WIDGET (frames);
frame = meta_frames_lookup_window (frames, xwindow);
g_assert (frame);
gdk_window_process_updates (frame->window, TRUE);
}
static void static void
show_tip_now (MetaFrames *frames) show_tip_now (MetaFrames *frames)
@ -731,7 +748,7 @@ show_tip_now (MetaFrames *frames)
#ifdef HAVE_GTK_MULTIHEAD #ifdef HAVE_GTK_MULTIHEAD
screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames))); screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames)));
#else #else
screen_number = XScreenNumberOfScreen (DefaultScreen (gdk_display)); screen_number = DefaultScreen (gdk_display);
#endif #endif
meta_fixed_tip_show (gdk_display, meta_fixed_tip_show (gdk_display,
screen_number, screen_number,

View File

@ -109,6 +109,9 @@ void meta_frames_set_title (MetaFrames *frames,
Window xwindow, Window xwindow,
const char *title); const char *title);
void meta_frames_repaint_frame (MetaFrames *frames,
Window xwindow);
void meta_frames_get_geometry (MetaFrames *frames, void meta_frames_get_geometry (MetaFrames *frames,
Window xwindow, Window xwindow,
int *top_height, int *bottom_height, int *top_height, int *bottom_height,

View File

@ -216,6 +216,13 @@ meta_ui_unflicker_frame_bg (MetaUI *ui,
target_width, target_height); target_width, target_height);
} }
void
meta_ui_repaint_frame (MetaUI *ui,
Window xwindow)
{
meta_frames_repaint_frame (ui->frames, xwindow);
}
void void
meta_ui_reset_frame_bg (MetaUI *ui, meta_ui_reset_frame_bg (MetaUI *ui,
Window xwindow) Window xwindow)

View File

@ -80,6 +80,9 @@ void meta_ui_set_frame_title (MetaUI *ui,
Window xwindow, Window xwindow,
const char *title); const char *title);
void meta_ui_repaint_frame (MetaUI *ui,
Window xwindow);
MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui, MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui,
Window client_xwindow, Window client_xwindow,
MetaMenuOp ops, MetaMenuOp ops,

View File

@ -316,6 +316,7 @@ meta_window_new (MetaDisplay *display, Window xwindow,
window->depth = attrs.depth; window->depth = attrs.depth;
window->xvisual = attrs.visual; window->xvisual = attrs.visual;
window->colormap = attrs.colormap;
window->title = NULL; window->title = NULL;
window->icon_name = NULL; window->icon_name = NULL;
@ -3393,6 +3394,11 @@ meta_window_notify_focus (MetaWindow *window,
g_list_prepend (window->display->mru_list, window); g_list_prepend (window->display->mru_list, window);
if (window->frame) if (window->frame)
meta_frame_queue_draw (window->frame); meta_frame_queue_draw (window->frame);
meta_error_trap_push (window->display);
XInstallColormap (window->display->xdisplay,
window->colormap);
meta_error_trap_pop (window->display);
} }
} }
else if (event->type == FocusOut || else if (event->type == FocusOut ||
@ -3421,6 +3427,11 @@ meta_window_notify_focus (MetaWindow *window,
window->has_focus = FALSE; window->has_focus = FALSE;
if (window->frame) if (window->frame)
meta_frame_queue_draw (window->frame); meta_frame_queue_draw (window->frame);
meta_error_trap_push (window->display);
XUninstallColormap (window->display->xdisplay,
window->colormap);
meta_error_trap_pop (window->display);
} }
} }

View File

@ -55,6 +55,7 @@ struct _MetaWindow
MetaFrame *frame; MetaFrame *frame;
int depth; int depth;
Visual *xvisual; Visual *xvisual;
Colormap colormap;
char *desc; /* used in debug spew */ char *desc; /* used in debug spew */
char *title; char *title;