Set prelit_control to META_FRAME_CONTROL_NONE.

2002-02-12  Anders Carlsson  <andersca@gnu.org>

	* src/frames.c (meta_frames_manage_window): Set prelit_control
	to META_FRAME_CONTROL_NONE.
	(meta_frames_update_prelit_control): New function for setting
	the prelit control.
	(meta_frames_paint_to_drawable): Set prelight state.
	(meta_frames_enter_notify_event): Update prelit control.
	(meta_frames_leave_notify_event): Likewise.
	(meta_frames_motion_notify_event): Likewise.

	* src/frames.h (struct _MetaUIFrame): add prelit_control.
This commit is contained in:
Anders Carlsson 2002-02-12 05:01:22 +00:00 committed by Anders Carlsson
parent 28cae9c995
commit 0ca04ed7aa
3 changed files with 70 additions and 4 deletions

View File

@ -1,5 +1,16 @@
2002-02-12 Anders Carlsson <andersca@gnu.org>
* src/frames.c (meta_frames_manage_window): Set prelit_control
to META_FRAME_CONTROL_NONE.
(meta_frames_update_prelit_control): New function for setting
the prelit control.
(meta_frames_paint_to_drawable): Set prelight state.
(meta_frames_enter_notify_event): Update prelit control.
(meta_frames_leave_notify_event): Likewise.
(meta_frames_motion_notify_event): Likewise.
* src/frames.h (struct _MetaUIFrame): add prelit_control.
* src/window.c (update_mwm_hints): and MWM_FUNC_ALL
with hints->functions instead of hints->flags.

View File

@ -408,6 +408,7 @@ meta_frames_manage_window (MetaFrames *frames,
frame->text_height = -1;
frame->title = NULL;
frame->expose_delayed = FALSE;
frame->prelit_control = META_FRAME_CONTROL_NONE;
meta_core_grab_buttons (gdk_display, frame->xwindow);
@ -1089,6 +1090,32 @@ meta_frames_button_release_event (GtkWidget *widget,
return TRUE;
}
static void
meta_frames_update_prelit_control (MetaFrames *frames,
MetaUIFrame *frame,
MetaFrameControl control)
{
MetaFrameControl old_control;
/* Only prelight buttons */
if (control != META_FRAME_CONTROL_MENU &&
control != META_FRAME_CONTROL_MINIMIZE &&
control != META_FRAME_CONTROL_MAXIMIZE &&
control != META_FRAME_CONTROL_DELETE)
control = META_FRAME_CONTROL_NONE;
if (control == frame->prelit_control)
return;
/* Save the old control so we can unprelight it */
old_control = frame->prelit_control;
frame->prelit_control = control;
redraw_control (frames, frame, old_control);
redraw_control (frames, frame, control);
}
static gboolean
meta_frames_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event)
@ -1125,6 +1152,9 @@ meta_frames_motion_notify_event (GtkWidget *widget,
control = get_control (frames, frame, x, y);
/* Update prelit control */
meta_frames_update_prelit_control (frames, frame, control);
cursor = META_CURSOR_DEFAULT;
switch (control)
@ -1246,7 +1276,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
widget = GTK_WIDGET (frames);
/* note, prelight not implemented yet */
i = 0;
while (i < META_BUTTON_TYPE_LAST)
{
@ -1255,6 +1284,24 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
++i;
}
/* Set prelight state */
switch (frame->prelit_control)
{
case META_FRAME_CONTROL_MENU:
button_states[META_BUTTON_TYPE_MENU] = META_BUTTON_STATE_PRELIGHT;
break;
case META_FRAME_CONTROL_MINIMIZE:
button_states[META_BUTTON_TYPE_MINIMIZE] = META_BUTTON_STATE_PRELIGHT;
break;
case META_FRAME_CONTROL_MAXIMIZE:
button_states[META_BUTTON_TYPE_MAXIMIZE] = META_BUTTON_STATE_PRELIGHT;
break;
case META_FRAME_CONTROL_DELETE:
button_states[META_BUTTON_TYPE_CLOSE] = META_BUTTON_STATE_PRELIGHT;
break;
default:
}
grab_frame = meta_core_get_grab_frame (gdk_display);
if (frame->xwindow == grab_frame)
@ -1316,6 +1363,7 @@ meta_frames_enter_notify_event (GtkWidget *widget,
{
MetaUIFrame *frame;
MetaFrames *frames;
MetaFrameControl control;
frames = META_FRAMES (widget);
@ -1323,6 +1371,9 @@ meta_frames_enter_notify_event (GtkWidget *widget,
if (frame == NULL)
return FALSE;
control = get_control (frames, frame, event->x, event->y);
meta_frames_update_prelit_control (frames, frame, control);
return TRUE;
}
@ -1339,6 +1390,8 @@ meta_frames_leave_notify_event (GtkWidget *widget,
if (frame == NULL)
return FALSE;
meta_frames_update_prelit_control (frames, frame, META_FRAME_CONTROL_NONE);
clear_tip (frames);
meta_core_set_screen_cursor (gdk_display,

View File

@ -71,6 +71,8 @@ struct _MetaUIFrame
int text_height;
char *title; /* NULL once we have a layout */
guint expose_delayed : 1;
MetaFrameControl prelit_control;
};
struct _MetaFrames