Fix missed equal_pos => option for --with-xinput=gxi. (Which is broken
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com> * gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option for --with-xinput=gxi. (Which is broken anyways, but oh well...) (#51973) * gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free in case where there is no current event. (#51889) * gtk/gtkwindow.[ch]: Handle focus for the case of PointerRoot (no window manager) by using algorithm taken from xterm.
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
Mon Mar 5 16:38:15 2001 Owen Taylor <otaylor@redhat.com>
|
||||
Wed Mar 14 23:38:23 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdk.c (gdk_init_check): Fix missed equal_pos => option
|
||||
for --with-xinput=gxi. (Which is broken anyways, but
|
||||
oh well...)
|
||||
|
||||
* gtk/gtkeditable.c (gtk_editable_get_event_time): Fix excess free
|
||||
in case where there is no current event.
|
||||
|
||||
* gtk/gtkwindow.[ch]: Handle focus for the case of
|
||||
PointerRoot (no window manager) by using algorithm taken
|
||||
from xterm.
|
||||
|
||||
Fri Mar 9 22:32:32 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): Only
|
||||
check the ignore_enter flag for the menu shell that
|
||||
|
||||
@@ -337,7 +337,7 @@ gdk_init_check (int *argc,
|
||||
option = get_option (argv, *argc, &i);
|
||||
|
||||
if (option)
|
||||
gdk_input_gxid_port = atoi (equal_pos + 1);
|
||||
gdk_input_gxid_port = atoi (option);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_XIM
|
||||
|
||||
@@ -831,34 +831,37 @@ gtk_editable_get_event_time (GtkEditable *editable)
|
||||
event = gtk_get_current_event();
|
||||
|
||||
if (event)
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
tm = event->motion.time; break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
tm = event->button.time; break;
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
tm = event->key.time; break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
tm = event->crossing.time; break;
|
||||
case GDK_PROPERTY_NOTIFY:
|
||||
tm = event->property.time; break;
|
||||
case GDK_SELECTION_CLEAR:
|
||||
case GDK_SELECTION_REQUEST:
|
||||
case GDK_SELECTION_NOTIFY:
|
||||
tm = event->selection.time; break;
|
||||
case GDK_PROXIMITY_IN:
|
||||
case GDK_PROXIMITY_OUT:
|
||||
tm = event->proximity.time; break;
|
||||
default: /* use current time */
|
||||
break;
|
||||
}
|
||||
gdk_event_free(event);
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
tm = event->motion.time; break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
tm = event->button.time; break;
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
tm = event->key.time; break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
tm = event->crossing.time; break;
|
||||
case GDK_PROPERTY_NOTIFY:
|
||||
tm = event->property.time; break;
|
||||
case GDK_SELECTION_CLEAR:
|
||||
case GDK_SELECTION_REQUEST:
|
||||
case GDK_SELECTION_NOTIFY:
|
||||
tm = event->selection.time; break;
|
||||
case GDK_PROXIMITY_IN:
|
||||
case GDK_PROXIMITY_OUT:
|
||||
tm = event->proximity.time; break;
|
||||
default: /* use current time */
|
||||
break;
|
||||
}
|
||||
|
||||
gdk_event_free(event);
|
||||
}
|
||||
|
||||
return tm;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ typedef struct {
|
||||
GtkWindowLastGeometryInfo last;
|
||||
} GtkWindowGeometryInfo;
|
||||
|
||||
#define GTK_WINDOW_HAS_FOCUS(window) \
|
||||
((window)->window_has_focus || (window)->window_has_pointer_focus)
|
||||
|
||||
static void gtk_window_class_init (GtkWindowClass *klass);
|
||||
static void gtk_window_init (GtkWindow *window);
|
||||
static void gtk_window_set_arg (GtkObject *object,
|
||||
@@ -926,6 +929,9 @@ gtk_window_hide (GtkWidget *widget)
|
||||
gtk_grab_remove (widget);
|
||||
}
|
||||
|
||||
/* The algorithm used for window_has_pointer_focus is taken
|
||||
* from the XTerm code.
|
||||
*/
|
||||
static GdkFilterReturn
|
||||
gtk_window_focus_filter (GdkXEvent *xevent,
|
||||
GdkEvent *event,
|
||||
@@ -933,40 +939,65 @@ gtk_window_focus_filter (GdkXEvent *xevent,
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (data);
|
||||
XEvent *xev = (XEvent *)xevent;
|
||||
|
||||
if (xev->xany.type == FocusIn)
|
||||
GdkEvent extra_event;
|
||||
|
||||
switch (xev->xany.type)
|
||||
{
|
||||
switch (xev->xfocus.detail)
|
||||
case FocusIn:
|
||||
{
|
||||
switch (xev->xfocus.detail)
|
||||
{
|
||||
case NotifyAncestor:
|
||||
case NotifyNonlinear:
|
||||
case NotifyVirtual:
|
||||
case NotifyNonlinearVirtual:
|
||||
window->window_has_focus = TRUE;
|
||||
break;
|
||||
case NotifyPointer:
|
||||
window->window_has_pointer_focus = TRUE;
|
||||
break;
|
||||
case NotifyInferior:
|
||||
case NotifyPointerRoot:
|
||||
case NotifyDetailNone:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FocusOut:
|
||||
{
|
||||
switch (xev->xfocus.detail)
|
||||
{
|
||||
case NotifyAncestor:
|
||||
case NotifyNonlinear:
|
||||
case NotifyVirtual:
|
||||
case NotifyNonlinearVirtual:
|
||||
window->window_has_focus = FALSE;
|
||||
break;
|
||||
case NotifyPointer:
|
||||
window->window_has_pointer_focus = FALSE;
|
||||
break;
|
||||
case NotifyInferior:
|
||||
case NotifyPointerRoot:
|
||||
case NotifyDetailNone:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
if (xev->xcrossing.detail != NotifyInferior &&
|
||||
xev->xcrossing.focus && !window->window_has_focus)
|
||||
{
|
||||
case NotifyAncestor:
|
||||
case NotifyNonlinear:
|
||||
case NotifyVirtual:
|
||||
case NotifyNonlinearVirtual:
|
||||
window->window_has_focus = TRUE;
|
||||
break;
|
||||
case NotifyInferior:
|
||||
case NotifyPointer:
|
||||
case NotifyPointerRoot:
|
||||
case NotifyDetailNone:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (xev->xany.type == FocusOut)
|
||||
{
|
||||
switch (xev->xfocus.detail)
|
||||
{
|
||||
case NotifyAncestor:
|
||||
case NotifyNonlinear:
|
||||
case NotifyVirtual:
|
||||
case NotifyNonlinearVirtual:
|
||||
window->window_has_focus = FALSE;
|
||||
break;
|
||||
case NotifyInferior:
|
||||
case NotifyPointer:
|
||||
case NotifyPointerRoot:
|
||||
case NotifyDetailNone:
|
||||
break;
|
||||
window->window_has_pointer_focus = (xev->xany.type == EnterNotify) ? TRUE : FALSE;
|
||||
|
||||
extra_event.type = GDK_FOCUS_CHANGE;
|
||||
extra_event.focus_change.window = GTK_WIDGET (window)->window;
|
||||
extra_event.focus_change.send_event = FALSE;
|
||||
extra_event.focus_change.in = window->window_has_pointer_focus;
|
||||
|
||||
gdk_event_put (&extra_event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
@@ -1517,7 +1548,7 @@ gtk_window_real_set_focus (GtkWindow *window,
|
||||
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
|
||||
}
|
||||
|
||||
if (window->window_has_focus)
|
||||
if (GTK_WINDOW_HAS_FOCUS (window))
|
||||
{
|
||||
event.type = GDK_FOCUS_CHANGE;
|
||||
event.window = window->focus_widget->window;
|
||||
@@ -1541,7 +1572,7 @@ gtk_window_real_set_focus (GtkWindow *window,
|
||||
GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
|
||||
}
|
||||
|
||||
if (window->window_has_focus)
|
||||
if (GTK_WINDOW_HAS_FOCUS (window))
|
||||
{
|
||||
event.type = GDK_FOCUS_CHANGE;
|
||||
event.window = window->focus_widget->window;
|
||||
|
||||
@@ -81,6 +81,12 @@ struct _GtkWindow
|
||||
/* Set if the window, or any descendent of it, has the focus
|
||||
*/
|
||||
guint window_has_focus : 1;
|
||||
|
||||
/* Set if !window_has_focus, but events are being sent to the
|
||||
* window because the pointer is in it. (Typically, no window
|
||||
* manager is running.
|
||||
*/
|
||||
guint window_has_pointer_focus : 1;
|
||||
};
|
||||
|
||||
struct _GtkWindowClass
|
||||
|
||||
Reference in New Issue
Block a user