Fix a lost refcount in the case where we get a duplicate back from the X
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix a lost refcount in the case where we get a duplicate back from the X server. * gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable): Set success[] for all colors when allocation of colors cells via XAllocColorCells succeeds. * gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private): Don't match against colors cells allocated writeable.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix
|
||||||
|
a lost refcount in the case where we get a duplicate
|
||||||
|
back from the X server.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable):
|
||||||
|
Set success[] for all colors when allocation of colors
|
||||||
|
cells via XAllocColorCells succeeds.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
Don't match against colors cells allocated writeable.
|
||||||
|
|
||||||
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix
|
||||||
|
a lost refcount in the case where we get a duplicate
|
||||||
|
back from the X server.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable):
|
||||||
|
Set success[] for all colors when allocation of colors
|
||||||
|
cells via XAllocColorCells succeeds.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
Don't match against colors cells allocated writeable.
|
||||||
|
|
||||||
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix
|
||||||
|
a lost refcount in the case where we get a duplicate
|
||||||
|
back from the X server.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable):
|
||||||
|
Set success[] for all colors when allocation of colors
|
||||||
|
cells via XAllocColorCells succeeds.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
Don't match against colors cells allocated writeable.
|
||||||
|
|
||||||
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix
|
||||||
|
a lost refcount in the case where we get a duplicate
|
||||||
|
back from the X server.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable):
|
||||||
|
Set success[] for all colors when allocation of colors
|
||||||
|
cells via XAllocColorCells succeeds.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
Don't match against colors cells allocated writeable.
|
||||||
|
|
||||||
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix
|
||||||
|
a lost refcount in the case where we get a duplicate
|
||||||
|
back from the X server.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable):
|
||||||
|
Set success[] for all colors when allocation of colors
|
||||||
|
cells via XAllocColorCells succeeds.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
Don't match against colors cells allocated writeable.
|
||||||
|
|
||||||
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 8 21:29:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc1): Fix
|
||||||
|
a lost refcount in the case where we get a duplicate
|
||||||
|
back from the X server.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_writeable):
|
||||||
|
Set success[] for all colors when allocation of colors
|
||||||
|
cells via XAllocColorCells succeeds.
|
||||||
|
|
||||||
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
Don't match against colors cells allocated writeable.
|
||||||
|
|
||||||
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
Sun Dec 8 21:22:46 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors_private):
|
||||||
|
|||||||
@ -758,6 +758,7 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
|
|||||||
{
|
{
|
||||||
XFreeColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap,
|
XFreeColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap,
|
||||||
&xcolor.pixel, 1, 0);
|
&xcolor.pixel, 1, 0);
|
||||||
|
private->info[ret->pixel].ref_count++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -825,6 +826,7 @@ gdk_colormap_alloc_colors_writeable (GdkColormap *colormap,
|
|||||||
for (i=0; i<ncolors; i++)
|
for (i=0; i<ncolors; i++)
|
||||||
{
|
{
|
||||||
colors[i].pixel = pixels[i];
|
colors[i].pixel = pixels[i];
|
||||||
|
success[i] = TRUE;
|
||||||
private->info[pixels[i]].ref_count++;
|
private->info[pixels[i]].ref_count++;
|
||||||
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
|
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
|
||||||
}
|
}
|
||||||
@ -896,7 +898,7 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap,
|
|||||||
|
|
||||||
gchar *available = g_new (gchar, colormap->size);
|
gchar *available = g_new (gchar, colormap->size);
|
||||||
for (i = 0; i < colormap->size; i++)
|
for (i = 0; i < colormap->size; i++)
|
||||||
available[i] = TRUE;
|
available[i] = !(private->info[i].flags & GDK_COLOR_WRITEABLE);
|
||||||
|
|
||||||
for (i=0; i<ncolors; i++)
|
for (i=0; i<ncolors; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -659,6 +659,26 @@ get_real_window (XEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
static const char notify_modes[][18] = {
|
||||||
|
"NotifyNormal",
|
||||||
|
"NotifyGrab",
|
||||||
|
"NotifyUngrab",
|
||||||
|
"NotifyWhileGrabbed"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char notify_details[][22] = {
|
||||||
|
"NotifyAncestor",
|
||||||
|
"NotifyVirtual",
|
||||||
|
"NotifyInferior",
|
||||||
|
"NotifyNonlinear",
|
||||||
|
"NotifyNonlinearVirtual",
|
||||||
|
"NotifyPointer",
|
||||||
|
"NotifyPointerRoot",
|
||||||
|
"NotifyDetailNone"
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_event_translate (GdkDisplay *display,
|
gdk_event_translate (GdkDisplay *display,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
@ -1034,10 +1054,10 @@ gdk_event_translate (GdkDisplay *display,
|
|||||||
if (window &&
|
if (window &&
|
||||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
|
GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
|
||||||
xevent->xcrossing.detail != NotifyInferior &&
|
xevent->xcrossing.detail != NotifyInferior &&
|
||||||
xevent->xcrossing.focus && !window_impl->has_focus)
|
xevent->xcrossing.focus && !window_impl->has_focus_window)
|
||||||
{
|
{
|
||||||
gboolean had_focus = HAS_FOCUS (window_impl);
|
gboolean had_focus = HAS_FOCUS (window_impl);
|
||||||
|
|
||||||
window_impl->has_pointer_focus = TRUE;
|
window_impl->has_pointer_focus = TRUE;
|
||||||
|
|
||||||
if (HAS_FOCUS (window_impl) != had_focus)
|
if (HAS_FOCUS (window_impl) != had_focus)
|
||||||
@ -1129,12 +1149,12 @@ gdk_event_translate (GdkDisplay *display,
|
|||||||
if (window &&
|
if (window &&
|
||||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
|
GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
|
||||||
xevent->xcrossing.detail != NotifyInferior &&
|
xevent->xcrossing.detail != NotifyInferior &&
|
||||||
xevent->xcrossing.focus && !window_impl->has_focus)
|
xevent->xcrossing.focus && !window_impl->has_focus_window)
|
||||||
{
|
{
|
||||||
gboolean had_focus = HAS_FOCUS (window_impl);
|
gboolean had_focus = HAS_FOCUS (window_impl);
|
||||||
|
|
||||||
window_impl->has_pointer_focus = FALSE;
|
window_impl->has_pointer_focus = FALSE;
|
||||||
|
|
||||||
if (HAS_FOCUS (window_impl) != had_focus)
|
if (HAS_FOCUS (window_impl) != had_focus)
|
||||||
generate_focus_event (window, FALSE);
|
generate_focus_event (window, FALSE);
|
||||||
}
|
}
|
||||||
@ -1207,7 +1227,10 @@ gdk_event_translate (GdkDisplay *display,
|
|||||||
*/
|
*/
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
GDK_NOTE (EVENTS,
|
GDK_NOTE (EVENTS,
|
||||||
g_message ("focus in:\t\twindow: %ld", xevent->xfocus.window));
|
g_message ("focus in:\t\twindow: %ld, detail: %s, mode: %s",
|
||||||
|
xevent->xfocus.window,
|
||||||
|
notify_details[xevent->xfocus.detail],
|
||||||
|
notify_modes[xevent->xfocus.mode]));
|
||||||
|
|
||||||
if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
|
if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
|
||||||
{
|
{
|
||||||
@ -1223,6 +1246,7 @@ gdk_event_translate (GdkDisplay *display,
|
|||||||
* window, so we pay attention to NotifyGrab
|
* window, so we pay attention to NotifyGrab
|
||||||
* NotifyUngrab, and ignore NotifyWhileGrabbed
|
* NotifyUngrab, and ignore NotifyWhileGrabbed
|
||||||
*/
|
*/
|
||||||
|
window_impl->has_focus_window = TRUE;
|
||||||
if (xevent->xfocus.mode != NotifyWhileGrabbed)
|
if (xevent->xfocus.mode != NotifyWhileGrabbed)
|
||||||
window_impl->has_focus = TRUE;
|
window_impl->has_focus = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -1246,8 +1270,11 @@ gdk_event_translate (GdkDisplay *display,
|
|||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
GDK_NOTE (EVENTS,
|
GDK_NOTE (EVENTS,
|
||||||
g_message ("focus out:\t\twindow: %ld", xevent->xfocus.window));
|
g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s",
|
||||||
|
xevent->xfocus.window,
|
||||||
|
notify_details[xevent->xfocus.detail],
|
||||||
|
notify_modes[xevent->xfocus.mode]));
|
||||||
|
|
||||||
if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
|
if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD)
|
||||||
{
|
{
|
||||||
gboolean had_focus = HAS_FOCUS (window_impl);
|
gboolean had_focus = HAS_FOCUS (window_impl);
|
||||||
@ -1258,6 +1285,7 @@ gdk_event_translate (GdkDisplay *display,
|
|||||||
case NotifyNonlinear:
|
case NotifyNonlinear:
|
||||||
case NotifyVirtual:
|
case NotifyVirtual:
|
||||||
case NotifyNonlinearVirtual:
|
case NotifyNonlinearVirtual:
|
||||||
|
window_impl->has_focus_window = FALSE;
|
||||||
if (xevent->xfocus.mode != NotifyWhileGrabbed)
|
if (xevent->xfocus.mode != NotifyWhileGrabbed)
|
||||||
window_impl->has_focus = FALSE;
|
window_impl->has_focus = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -73,11 +73,15 @@ struct _GdkWindowImplX11
|
|||||||
|
|
||||||
GdkXPositionInfo position_info;
|
GdkXPositionInfo position_info;
|
||||||
|
|
||||||
/* Set if the window, or any descendent of it, has the focus
|
/* Set if the window, or any descendent of it, is the focus window
|
||||||
|
*/
|
||||||
|
guint has_focus_window : 1;
|
||||||
|
|
||||||
|
/* Set if has_focus_window and the focus isn't grabbed elsewhere.
|
||||||
*/
|
*/
|
||||||
guint has_focus : 1;
|
guint has_focus : 1;
|
||||||
|
|
||||||
/* Set if !window_has_focus, but events are being sent to the
|
/* Set if !window->has_focus_window, but events are being sent to the
|
||||||
* window because the pointer is in it. (Typically, no window
|
* window because the pointer is in it. (Typically, no window
|
||||||
* manager is running.
|
* manager is running.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user