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>
* src/display.c (event_callback): make Alt+button2 do a resize

View File

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

View File

@ -29,7 +29,8 @@
ButtonPressMask | ButtonReleaseMask | \
PointerMotionMask | PointerMotionHintMask | \
EnterWindowMask | LeaveWindowMask | \
FocusChangeMask)
FocusChangeMask | \
ColormapChangeMask)
void
meta_window_ensure_frame (MetaWindow *window)
@ -303,8 +304,18 @@ meta_frame_sync_to_window (MetaFrame *frame,
frame->rect.height);
if (need_resize)
meta_ui_reset_frame_bg (frame->window->screen->ui,
frame->xwindow);
{
meta_ui_reset_frame_bg (frame->window->screen->ui,
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

View File

@ -636,6 +636,8 @@ meta_frames_set_title (MetaFrames *frames,
frame = meta_frames_lookup_window (frames, xwindow);
g_assert (frame);
g_free (frame->title);
frame->title = g_strdup (title);
@ -648,6 +650,21 @@ meta_frames_set_title (MetaFrames *frames,
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
show_tip_now (MetaFrames *frames)
@ -731,7 +748,7 @@ show_tip_now (MetaFrames *frames)
#ifdef HAVE_GTK_MULTIHEAD
screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames)));
#else
screen_number = XScreenNumberOfScreen (DefaultScreen (gdk_display));
screen_number = DefaultScreen (gdk_display);
#endif
meta_fixed_tip_show (gdk_display,
screen_number,

View File

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

View File

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

View File

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

View File

@ -316,7 +316,8 @@ meta_window_new (MetaDisplay *display, Window xwindow,
window->depth = attrs.depth;
window->xvisual = attrs.visual;
window->colormap = attrs.colormap;
window->title = NULL;
window->icon_name = NULL;
window->icon = NULL;
@ -3393,6 +3394,11 @@ meta_window_notify_focus (MetaWindow *window,
g_list_prepend (window->display->mru_list, window);
if (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 ||
@ -3421,6 +3427,11 @@ meta_window_notify_focus (MetaWindow *window,
window->has_focus = FALSE;
if (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;
int depth;
Visual *xvisual;
Colormap colormap;
char *desc; /* used in debug spew */
char *title;