Start implementing display/screen closing scheme; keep a flag for whether

Thu Aug  1 11:26:03 2002  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
	Start implementing display/screen closing scheme; keep a
	flag for whether displays and screens are closed,
	call g_object_run_dispose(). Remove public gdk_screen_close().

	* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
	dispose() methods; move appropriate parts of the finalize
	there.

	* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
	gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
	gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
	gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
	Start of making everything correctly ignore operations
	when a display has been closed.

	* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
	Handle decorations == NULL.

	* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
	Remove unnecessary hash table creation.

	* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
	Fix up gdk_device_get_history - handle events, n_events == NULL,
	etc.

	* gdk/x11/gdkproperty-x11.c (gdk_property_get):
	Handle failure better.

	* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
	Handle failure better, handle data == NULL, move docs
	here, remove an excess round trip by asking for
	all selection data at once.

	* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
	  gdk/{x11,win32}/gdkmain-{x11,win32}.c	gdk/gdkdisplay.c: Move
	gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
	gdk_display_set_sm_client_id() to display-independent part of GDK.

	* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
	into the right place.
This commit is contained in:
Owen Taylor
2002-08-01 15:28:40 +00:00
committed by Owen Taylor
parent d202b55bc0
commit e5ae081ebe
32 changed files with 710 additions and 262 deletions

View File

@ -171,6 +171,25 @@ gdk_device_set_axis_use (GdkDevice *device,
}
}
/**
* gdk_device_get_history:
* @device: a #GdkDevice
* @window: the window with respect to which which the event coordinates will be reported
* @start: starting timestamp for range of events to return
* @stop: ending timestamp for the range of events to return
* @events: location to store a newly-allocated array of #GdkTimeCoord, or %NULL
* @n_events: location to store the length of @events, or %NULL
*
* Obtains the motion history for a device; given a starting and
* ending timestamp, return all events in the motion history for
* the device in the given range of time. Some windowing systems
* do not support motion history, in which case, %FALSE will
* be returned. (This is not distinguishable from the case where
* motion history is supported and no events were found.)
*
* Return value: %TRUE if the windowing system supports motion history and
* at least one event was found.
**/
gboolean
gdk_device_get_history (GdkDevice *device,
GdkWindow *window,
@ -179,31 +198,26 @@ gdk_device_get_history (GdkDevice *device,
GdkTimeCoord ***events,
gint *n_events)
{
GdkTimeCoord **coords;
GdkTimeCoord **coords = NULL;
gboolean result = FALSE;
int tmp_n_events = 0;
int i;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (events != NULL, FALSE);
g_return_val_if_fail (n_events != NULL, FALSE);
*n_events = 0;
*events = NULL;
if (GDK_WINDOW_DESTROYED (window))
return FALSE;
if (GDK_IS_CORE (device))
/* Nothing */ ;
else if (GDK_IS_CORE (device))
{
XTimeCoord *xcoords;
xcoords = XGetMotionEvents (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
start, stop, n_events);
start, stop, &tmp_n_events);
if (xcoords)
{
coords = _gdk_device_allocate_history (device, *n_events);
for (i=0; i<*n_events; i++)
coords = _gdk_device_allocate_history (device, tmp_n_events);
for (i=0; i<tmp_n_events; i++)
{
coords[i]->time = xcoords[i].time;
coords[i]->axes[0] = xcoords[i].x;
@ -212,14 +226,22 @@ gdk_device_get_history (GdkDevice *device,
XFree (xcoords);
*events = coords;
return TRUE;
result = TRUE;
}
else
return FALSE;
result = FALSE;
}
else
return _gdk_device_get_history (device, window, start, stop, events, n_events);
result = _gdk_device_get_history (device, window, start, stop, &coords, &tmp_n_events);
if (n_events)
*n_events = tmp_n_events;
if (events)
*events = coords;
else if (coords)
gdk_device_free_history (coords, tmp_n_events);
return result;
}
GdkTimeCoord **