gtk/gdk/linux-fb/gdkwindow-fb.c

1576 lines
39 KiB
C
Raw Normal View History

2000-05-31 21:50:38 +00:00
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
2000-05-31 21:50:38 +00:00
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
2000-05-31 21:50:38 +00:00
*
* You should have received a copy of the GNU Lesser General Public
2000-05-31 21:50:38 +00:00
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
2000-05-31 21:50:38 +00:00
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "gdk.h"
#include "config.h"
#include "gdkwindow.h"
#include "gdkinputprivate.h"
#include "gdkprivate-fb.h"
#include "gdkinternals.h"
#include <limits.h>
static gpointer parent_class = NULL;
2000-05-31 21:50:38 +00:00
static void recompute_drawable (GdkDrawable *drawable);
2000-05-31 21:50:38 +00:00
static void
g_free_2nd (gpointer a, gpointer b, gpointer data)
2000-05-31 21:50:38 +00:00
{
g_free (b);
2000-05-31 21:50:38 +00:00
}
static void
gdk_window_impl_fb_finalize (GObject *object)
2000-05-31 21:50:38 +00:00
{
GdkWindowFBData *fbd = GDK_WINDOW_FBDATA (object);
2000-05-31 21:50:38 +00:00
if (GDK_WINDOW_P (fbd->drawable_data.wrapper)->mapped)
gdk_window_hide (fbd->drawable_data.wrapper);
2000-05-31 21:50:38 +00:00
if (fbd->cursor)
gdk_cursor_unref (fbd->cursor);
2000-05-31 21:50:38 +00:00
if (fbd->properties)
2000-05-31 21:50:38 +00:00
{
g_hash_table_foreach (fbd->properties, g_free_2nd, NULL);
g_hash_table_destroy (fbd->properties);
2000-05-31 21:50:38 +00:00
}
G_OBJECT_CLASS (parent_class)->finalize (object);
2000-05-31 21:50:38 +00:00
}
static void
gdk_window_impl_fb_class_init (GdkWindowFBClass *klass)
2000-05-31 21:50:38 +00:00
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
/* GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); */
2000-05-31 21:50:38 +00:00
parent_class = g_type_class_peek_parent (klass);
2000-05-31 21:50:38 +00:00
object_class->finalize = gdk_window_impl_fb_finalize;
}
2000-05-31 21:50:38 +00:00
static void
gdk_window_impl_fb_init (GdkWindowFBData *impl)
{
impl->drawable_data.depth = gdk_display->modeinfo.bits_per_pixel;
impl->drawable_data.colormap = gdk_colormap_get_system ();
impl->event_mask = GDK_STRUCTURE_MASK;
}
2000-05-31 21:50:38 +00:00
GType
_gdk_window_impl_get_type (void)
{
static GType object_type = 0;
2000-05-31 21:50:38 +00:00
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkWindowFBClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_window_impl_fb_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkWindowFBData),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_window_impl_fb_init,
};
object_type = g_type_register_static (gdk_drawable_impl_fb_get_type(),
"GdkWindowFB",
&object_info,
0);
}
return object_type;
2000-05-31 21:50:38 +00:00
}
void
_gdk_windowing_window_init (void)
2000-05-31 21:50:38 +00:00
{
GdkWindowAttr attr;
2000-05-31 21:50:38 +00:00
GdkCursor *cursor;
GdkWindowObject *private;
attr.width = gdk_screen_width ();
attr.height = gdk_screen_height ();
attr.window_type = GDK_WINDOW_ROOT;
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
attr.cursor = NULL;
attr.event_mask = GDK_EXPOSURE_MASK;
attr.wclass = GDK_INPUT_OUTPUT;
gdk_parent_root = gdk_window_new (NULL, &attr, GDK_WA_CURSOR);
private = (GdkWindowObject *)gdk_parent_root;
2000-05-31 21:50:38 +00:00
private->mapped = TRUE;
2000-05-31 21:50:38 +00:00
GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->lim_x = attr.width;
GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->lim_y = attr.height;
_gdk_fb_screen_gc = gdk_gc_new (gdk_parent_root);
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
gdk_fb_drawable_clear (gdk_parent_root);
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
/* Must be done after root is created, since gdk_cursor_new()
* references gdk_parent_root.
*/
cursor = gdk_cursor_new (GDK_LEFT_PTR);
gdk_window_set_cursor (gdk_parent_root, cursor);
2000-05-31 21:50:38 +00:00
}
GdkWindow*
gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask)
{
GdkWindow *window;
GdkWindowObject *private;
GdkWindowObject *parent_private;
2000-05-31 21:50:38 +00:00
GdkVisual *visual;
GdkWindowFBData *impl;
2000-05-31 21:50:38 +00:00
int x, y, depth;
g_return_val_if_fail (attributes != NULL, NULL);
if (!parent || attributes->window_type != GDK_WINDOW_CHILD)
parent = gdk_parent_root;
parent_private = (GdkWindowObject*) parent;
2000-05-31 21:50:38 +00:00
window = (GdkWindow *)g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *)window;
2000-05-31 21:50:38 +00:00
private->parent = parent_private;
2000-05-31 21:50:38 +00:00
if (attributes_mask & GDK_WA_X)
x = attributes->x;
else
x = 0;
if (attributes_mask & GDK_WA_Y)
y = attributes->y;
else
y = 0;
gdk_window_set_events (window, attributes->event_mask);
2000-05-31 21:50:38 +00:00
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
else
visual = gdk_visual_get_system ();
2000-05-31 21:50:38 +00:00
impl = (GdkWindowFBData *)private->impl;
impl->drawable_data.wrapper = window;
2000-05-31 21:50:38 +00:00
private->x = x;
private->y = y;
impl->drawable_data.width = (attributes->width > 1) ? (attributes->width) : (1);
impl->drawable_data.height = (attributes->height > 1) ? (attributes->height) : (1);
private->window_type = impl->drawable_data.window_type = attributes->window_type;
impl->drawable_data.mem = gdk_display->fbmem;
impl->drawable_data.rowstride = gdk_display->sinfo.line_length;
2000-05-31 21:50:38 +00:00
gdk_window_move_resize (window, x, y,
impl->drawable_data.width, impl->drawable_data.height);
2000-05-31 21:50:38 +00:00
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
depth = visual->depth;
private->input_only = FALSE;
private->depth = impl->drawable_data.depth;
2000-05-31 21:50:38 +00:00
if ((attributes_mask & GDK_WA_COLORMAP) &&
attributes->colormap)
impl->drawable_data.colormap = attributes->colormap;
else
impl->drawable_data.colormap = gdk_colormap_get_system ();
2000-05-31 21:50:38 +00:00
switch (impl->drawable_data.window_type)
2000-05-31 21:50:38 +00:00
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
default:
2000-05-31 21:50:38 +00:00
break;
case GDK_WINDOW_ROOT:
if (gdk_parent_root)
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
2000-05-31 21:50:38 +00:00
break;
case GDK_DRAWABLE_PIXMAP:
g_error ("cannot make windows of type GDK_DRAWABLE_PIXMAP (use gdk_pixmap_new)");
2000-05-31 21:50:38 +00:00
break;
}
}
else
{
depth = 0;
private->input_only = TRUE;
impl->level = 10000;
impl->drawable_data.colormap = NULL;
2000-05-31 21:50:38 +00:00
}
gdk_drawable_ref (window);
if (impl->drawable_data.colormap)
gdk_colormap_ref (impl->drawable_data.colormap);
2000-05-31 21:50:38 +00:00
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
if (parent_private)
{
parent_private->children = g_list_prepend (parent_private->children, window);
if (parent_private->children->next)
impl->level = GDK_WINDOW_FBDATA (GDK_WINDOW_P (parent_private->children->next->data)->impl)->level + 1;
}
2000-05-31 21:50:38 +00:00
return window;
}
/* Call this function when you want a window and all its children to
* disappear. When xdestroy is true, a request to destroy the XWindow
* is sent out. When it is false, it is assumed that the XWindow has
* been or will be destroyed by destroying some ancestor of this
* window.
*/
void
_gdk_windowing_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
2000-05-31 21:50:38 +00:00
{
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
_gdk_selection_window_destroyed (window);
#if 0
GdkWindowObject *private;
GdkWindowObject *temp_private;
2000-05-31 21:50:38 +00:00
GdkWindow *temp_window;
GList *children;
GList *tmp;
gboolean our_destroy = !foreign_destroy;
g_return_if_fail (window != NULL);
private = (GdkWindowObject*) window;
2000-05-31 21:50:38 +00:00
switch (private->window_type)
2000-05-31 21:50:38 +00:00
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
case GDK_WINDOW_FOREIGN:
if (!private->destroyed)
2000-05-31 21:50:38 +00:00
{
if (private->parent)
{
GdkWindowObject *parent_private = (GdkWindowObject *)private->parent;
2000-05-31 21:50:38 +00:00
if (parent_private->children)
parent_private->children = g_list_remove (parent_private->children, window);
}
if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && private->bg_pixmap != GDK_NO_BG)
2000-05-31 21:50:38 +00:00
{
gdk_pixmap_unref (private->bg_pixmap);
private->bg_pixmap = NULL;
}
2000-05-31 21:50:38 +00:00
if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN)
{
children = tmp = private->children;
private->children = NULL;
while (tmp)
{
temp_window = tmp->data;
tmp = tmp->next;
temp_private = (GdkWindowObject*) temp_window;
2000-05-31 21:50:38 +00:00
if (temp_private)
_gdk_windowing_window_destroy (temp_window, !FALSE,
!our_destroy);
}
g_list_free (children);
}
if (private->extension_events != 0)
gdk_input_window_destroy (window);
if (private->filters)
{
tmp = private->filters;
while (tmp)
{
g_free (tmp->data);
tmp = tmp->next;
}
g_list_free (private->filters);
private->filters = NULL;
}
if (private->window_type == GDK_WINDOW_FOREIGN)
2000-05-31 21:50:38 +00:00
{
if (our_destroy && (private->parent != NULL))
{
/* It's somebody elses window, but in our heirarchy,
* so reparent it to the root window, and then send
* it a delete event, as if we were a WM
*/
gdk_error_trap_push ();
gdk_window_hide (window);
gdk_window_reparent (window, NULL, 0, 0);
gdk_flush ();
gdk_error_trap_pop ();
}
}
if (private->colormap)
gdk_colormap_unref (private->colormap);
2000-05-31 21:50:38 +00:00
private->mapped = FALSE;
private->drawable.destroyed = TRUE;
}
break;
case GDK_WINDOW_ROOT:
g_error ("attempted to destroy root window");
break;
case GDK_WINDOW_PIXMAP:
g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
break;
}
#endif
2000-05-31 21:50:38 +00:00
}
/* This function is called when the XWindow is really gone. */
static gboolean
all_parents_shown (GdkWindowObject *private)
2000-05-31 21:50:38 +00:00
{
while (private->mapped)
2000-05-31 21:50:38 +00:00
{
if (private->parent)
private = (GdkWindowObject *)private->parent;
2000-05-31 21:50:38 +00:00
else
return TRUE;
}
return FALSE;
}
static void
send_map_events (GdkWindowObject *private, gboolean is_map)
2000-05-31 21:50:38 +00:00
{
GList *l;
GdkWindow *parent = (GdkWindow *)private->parent;
2000-05-31 21:50:38 +00:00
g_assert (is_map);
if (!private->mapped)
2000-05-31 21:50:38 +00:00
return;
if (is_map)
gdk_event_make ((GdkWindow *)private, GDK_MAP, TRUE);
2000-05-31 21:50:38 +00:00
if (private->input_only)
2000-05-31 21:50:38 +00:00
return;
if (!parent)
2000-05-31 21:50:38 +00:00
parent = (GdkWindow *)private;
if (((GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x > GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_x) ||
(GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y > GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_y) ||
(GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x < GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_x) ||
(GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y < GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_y)))
2000-05-31 21:50:38 +00:00
return;
if (is_map)
gdk_window_clear ((GdkWindow *)private);
2000-05-31 21:50:38 +00:00
#if 0
event = gdk_event_new ();
2000-05-31 21:50:38 +00:00
event->expose.type = GDK_EXPOSE;
event->expose.window = gdk_window_ref ((GdkWindow *)private);
if (GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x > GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_x)
2000-05-31 21:50:38 +00:00
event->expose.area.x = 0;
else
event->expose.area.x = GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_x - GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x;
2000-05-31 21:50:38 +00:00
if (GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y > GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_y)
2000-05-31 21:50:38 +00:00
event->expose.area.y = 0;
else
event->expose.area.y = GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_y - GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y;
event->expose.area.width = MIN (GDK_DRAWABLE_IMPL_FBDATA (private)->width,
GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x - GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x);
event->expose.area.height = MIN (GDK_DRAWABLE_IMPL_FBDATA (private)->height,
GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y - GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y);
if (event->expose.area.width > 0 &&
event->expose.area.height > 0)
2000-05-31 21:50:38 +00:00
{
gdk_event_queue_append (event);
2000-05-31 21:50:38 +00:00
}
else
gdk_event_free (event);
#endif
for (l = private->children; l; l = l->next)
send_map_events (l->data, is_map);
2000-05-31 21:50:38 +00:00
}
/* Cut & paste versions of the stuff in gdkwindow.c, with the addition of clearing the newly exposed region. */
2000-05-31 21:50:38 +00:00
void
gdk_window_invalidate_region_clear(GdkWindow *window,
GdkRegion *region)
2000-05-31 21:50:38 +00:00
{
int i;
GdkWindowObject *private = GDK_WINDOW_P (window);
if (private->input_only || !private->mapped)
return;
if (private->bg_pixmap != GDK_NO_BG)
for (i = 0; i < region->numRects; i++)
gdk_window_clear_area (window,
region->rects[i].x1,
region->rects[i].y1,
region->rects[i].x2 - region->rects[i].x1,
region->rects[i].y2 - region->rects[i].y1);
gdk_window_invalidate_region (window, region, FALSE);
{
GList *tmp_list;
GdkRectangle child_rect;
GdkRegion *child_region;
tmp_list = private->children;
while (tmp_list)
{
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (!child->input_only)
{
gint width, height;
gdk_drawable_get_size (GDK_DRAWABLE (child),
&width, &height);
child_rect.x = child->x;
child_rect.y = child->y;
child_rect.width = width;
child_rect.height = height;
child_region = gdk_region_rectangle (&child_rect);
gdk_region_intersect (child_region, region);
if (!gdk_region_empty (child_region))
{
gdk_region_offset (child_region, - child_rect.x, - child_rect.y);
gdk_window_invalidate_region_clear ((GdkWindow *)child, child_region);
}
gdk_region_destroy (child_region);
}
}
}
2000-05-31 21:50:38 +00:00
}
void
gdk_window_invalidate_rect_clear (GdkWindow *window,
GdkRectangle *rect)
2000-05-31 21:50:38 +00:00
{
GdkWindowObject *private = GDK_WINDOW_P (window);
2000-05-31 21:50:38 +00:00
if (private->input_only || !private->mapped)
return;
2000-05-31 21:50:38 +00:00
if (GDK_WINDOW_P (window)->bg_pixmap != GDK_NO_BG)
gdk_window_clear_area (window, rect->x, rect->y, rect->width, rect->height);
gdk_window_invalidate_rect (window, rect, FALSE);
{
GList *tmp_list;
GdkRectangle child_rect, new_rect;
tmp_list = private->children;
while (tmp_list)
{
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (!child->input_only)
{
gint width, height;
width = GDK_DRAWABLE_IMPL_FBDATA (child)->width;
height = GDK_DRAWABLE_IMPL_FBDATA (child)->height;
child_rect.x = child->x;
child_rect.y = child->y;
child_rect.width = width;
child_rect.height = height;
if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
{
new_rect.x -= child_rect.x;
new_rect.y -= child_rect.y;
gdk_window_invalidate_rect_clear ((GdkWindow *)child, &new_rect);
}
}
}
}
}
2000-05-31 21:50:38 +00:00
void
gdk_fb_redraw_all (void)
{
GdkRectangle r;
r.x = r.y = 0;
r.width = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->width;
r.height = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->height;
gdk_window_invalidate_rect_clear (gdk_parent_root, &r);
gdk_window_process_all_updates ();
2000-05-31 21:50:38 +00:00
}
GdkWindow *
gdk_fb_find_common_ancestor (GdkWindow *win1,
GdkWindow *win2)
{
GdkWindowObject *tmp;
GList *path1 = NULL, *path2 = NULL;
GList *list1, *list2;
tmp = GDK_WINDOW_OBJECT (win1);
while (tmp)
{
path1 = g_list_prepend(path1, tmp);
tmp = tmp->parent;
}
tmp = GDK_WINDOW_OBJECT (win2);
while (tmp)
{
path2 = g_list_prepend(path2, tmp);
tmp = tmp->parent;
}
list1 = path1;
list2 = path2;
tmp = NULL;
while (list1 && list2 && (list1->data == list2->data))
{
tmp = (GdkWindowObject *)list1->data;
list1 = g_list_next (list1);
list2 = g_list_next (list2);
}
g_list_free (path1);
g_list_free (path2);
return GDK_WINDOW (tmp);
}
2000-05-31 21:50:38 +00:00
void
gdk_window_show (GdkWindow *window)
{
GdkWindowObject *private;
GdkWindow *mousewin;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
private = (GdkWindowObject*) window;
2000-05-31 21:50:38 +00:00
if (!private->destroyed && !private->mapped)
2000-05-31 21:50:38 +00:00
{
private->mapped = TRUE;
if (all_parents_shown ((GdkWindowObject *)private->parent))
2000-05-31 21:50:38 +00:00
{
GdkRectangle rect;
recompute_drawable ((GdkDrawable *)window);
send_map_events (private, TRUE);
2000-05-31 21:50:38 +00:00
mousewin = gdk_window_at_pointer (NULL, NULL);
gdk_fb_window_send_crossing_events (mousewin,
GDK_CROSSING_NORMAL);
2000-05-31 21:50:38 +00:00
if (private->input_only)
return;
2000-05-31 21:50:38 +00:00
rect.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
rect.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
rect.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - rect.x;
rect.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - rect.y;
gdk_window_invalidate_rect_clear (gdk_parent_root, &rect);
}
2000-05-31 21:50:38 +00:00
}
}
void
gdk_window_hide (GdkWindow *window)
{
GdkWindowObject *private;
GdkWindow *mousewin;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
private = (GdkWindowObject*) window;
2000-05-31 21:50:38 +00:00
if (!private->destroyed && private->mapped)
2000-05-31 21:50:38 +00:00
{
GdkEvent *event;
GdkRectangle r;
gboolean do_hide;
2000-05-31 21:50:38 +00:00
event = gdk_event_make (window, GDK_UNMAP, TRUE);
2000-05-31 21:50:38 +00:00
r.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
r.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - r.x;
r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - r.y;
2000-05-31 21:50:38 +00:00
private->mapped = FALSE;
if (private->parent == GDK_WINDOW_P(gdk_parent_root))
gdk_fb_drawable_clear(gdk_parent_root);
2000-05-31 21:50:38 +00:00
mousewin = gdk_window_at_pointer (NULL, NULL);
gdk_fb_window_send_crossing_events (mousewin,
GDK_CROSSING_NORMAL);
do_hide = gdk_fb_cursor_need_hide (&r);
if (do_hide)
gdk_fb_cursor_hide ();
if (window == _gdk_fb_pointer_grab_window)
gdk_pointer_ungrab (GDK_CURRENT_TIME);
if (window == _gdk_fb_keyboard_grab_window)
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
gdk_window_invalidate_rect_clear (gdk_parent_root, &r);
if (do_hide)
gdk_fb_cursor_unhide ();
2000-05-31 21:50:38 +00:00
}
}
void
gdk_window_withdraw (GdkWindow *window)
{
gdk_window_hide (window);
2000-05-31 21:50:38 +00:00
}
void
gdk_window_move (GdkWindow *window,
gint x,
gint y)
{
GdkWindowObject *private = (GdkWindowObject *)window;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
gdk_window_move_resize (window, x, y,
GDK_DRAWABLE_IMPL_FBDATA (private)->width,
GDK_DRAWABLE_IMPL_FBDATA (private)->height);
2000-05-31 21:50:38 +00:00
}
void
gdk_window_resize (GdkWindow *window,
gint width,
gint height)
{
GdkWindowObject *private;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
private = (GdkWindowObject*) window;
2000-05-31 21:50:38 +00:00
if (width < 1)
width = 1;
if (height < 1)
height = 1;
gdk_window_move_resize (window, private->x, private->y, width, height);
2000-05-31 21:50:38 +00:00
}
static void
recompute_abs_positions(GdkDrawable *drawable,
gint parent_x, gint parent_y,
2000-05-31 21:50:38 +00:00
gint parent_llim_x, gint parent_llim_y,
gint parent_lim_x, gint parent_lim_y)
{
GList *l;
if (GDK_IS_WINDOW (drawable))
2000-05-31 21:50:38 +00:00
{
GdkWindowObject *private = GDK_WINDOW_P (drawable);
int x, y;
2000-05-31 21:50:38 +00:00
if (!private->mapped)
2000-05-31 21:50:38 +00:00
return;
GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x = parent_x + private->x;
GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y = parent_y + private->y;
x = MAX (parent_llim_x, GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x);
x = MIN (x, parent_lim_x);
GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x = x;
y = MAX (parent_llim_y, GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y);
y = MIN (y, parent_lim_y);
GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y = y;
x = MIN (parent_lim_x,
GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x + GDK_DRAWABLE_IMPL_FBDATA (private)->width);
x = MAX (x, GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x);
GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x = x;
y = MIN (parent_lim_y,
GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y + GDK_DRAWABLE_IMPL_FBDATA (private)->height);
y = MAX (y, GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y);
GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y = y;
g_assert (GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x <= GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x);
g_assert (GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y <= GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y);
for (l = private->children; l; l = l->next)
recompute_abs_positions (l->data,
GDK_DRAWABLE_IMPL_FBDATA (private)->abs_x,
GDK_DRAWABLE_IMPL_FBDATA (private)->abs_y,
GDK_DRAWABLE_IMPL_FBDATA (private)->llim_x,
GDK_DRAWABLE_IMPL_FBDATA (private)->llim_y,
GDK_DRAWABLE_IMPL_FBDATA (private)->lim_x,
GDK_DRAWABLE_IMPL_FBDATA (private)->lim_y);
2000-05-31 21:50:38 +00:00
}
else
{
GDK_DRAWABLE_IMPL_FBDATA (drawable)->abs_x = 0;
GDK_DRAWABLE_IMPL_FBDATA (drawable)->abs_y = 0;
GDK_DRAWABLE_IMPL_FBDATA (drawable)->llim_x = 0;
GDK_DRAWABLE_IMPL_FBDATA (drawable)->llim_y = 0;
GDK_DRAWABLE_IMPL_FBDATA (drawable)->lim_x = GDK_DRAWABLE_IMPL_FBDATA (drawable)->width;
GDK_DRAWABLE_IMPL_FBDATA (drawable)->lim_y = GDK_DRAWABLE_IMPL_FBDATA (drawable)->height;
2000-05-31 21:50:38 +00:00
}
}
static void
recompute_drawable (GdkDrawable *drawable)
2000-05-31 21:50:38 +00:00
{
if (GDK_IS_WINDOW (drawable))
2000-05-31 21:50:38 +00:00
{
GdkWindowObject *private = GDK_WINDOW_P (drawable);
2000-05-31 21:50:38 +00:00
GdkWindow *parent;
parent = (GdkWindow *)private->parent;
if (!parent)
2000-05-31 21:50:38 +00:00
parent = gdk_parent_root;
recompute_abs_positions (drawable,
GDK_DRAWABLE_IMPL_FBDATA (parent)->abs_x,
GDK_DRAWABLE_IMPL_FBDATA (parent)->abs_y,
GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_x,
GDK_DRAWABLE_IMPL_FBDATA (parent)->llim_y,
GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_x,
GDK_DRAWABLE_IMPL_FBDATA (parent)->lim_y);
2000-05-31 21:50:38 +00:00
}
else
recompute_abs_positions (drawable, 0, 0, 0, 0, INT_MAX, INT_MAX);
2000-05-31 21:50:38 +00:00
}
void
gdk_fb_window_move_resize (GdkWindow *window,
gint x,
gint y,
gint width,
gint height,
gboolean send_expose_events)
2000-05-31 21:50:38 +00:00
{
GdkWindowObject *private;
gint dx, dy, dw, dh;
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
gint i, draw_dir;
GdkEvent *event;
GdkWindow *mousewin;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (width < 1)
width = 1;
if (height < 1)
height = 1;
private = (GdkWindowObject*) window;
2000-05-31 21:50:38 +00:00
if (!private->destroyed)
2000-05-31 21:50:38 +00:00
{
2000-08-07 03:26:05 +00:00
GdkRegion *old_region = NULL;
if (private->input_only)
send_expose_events = FALSE;
if (private->mapped && send_expose_events)
old_region = gdk_fb_clip_region (GDK_DRAWABLE_IMPL(window), NULL, TRUE, FALSE);
dx = x - private->x;
dy = y - private->y;
dw = width - GDK_DRAWABLE_IMPL_FBDATA (private)->width;
dh = height - GDK_DRAWABLE_IMPL_FBDATA (private)->height;
2000-05-31 21:50:38 +00:00
private->x = x;
private->y = y;
GDK_DRAWABLE_IMPL_FBDATA (private)->width = width;
GDK_DRAWABLE_IMPL_FBDATA (private)->height = height;
2000-05-31 21:50:38 +00:00
if (private->mapped)
2000-05-31 21:50:38 +00:00
{
recompute_drawable ((GdkDrawable *)window);
2000-05-31 21:50:38 +00:00
if (send_expose_events)
{
GdkRegion *new_region, *region;
gboolean handle_cursor = FALSE;
2000-05-31 21:50:38 +00:00
new_region = gdk_fb_clip_region (GDK_DRAWABLE_IMPL (window), NULL, TRUE, FALSE);
2000-05-31 21:50:38 +00:00
region = gdk_region_copy (old_region);
gdk_region_offset (region, dx, dy);
gdk_region_intersect (region, new_region);
if (region->numRects)
{
GdkFBDrawingContext fbdc;
if (gdk_fb_cursor_region_need_hide (region))
{
gdk_fb_cursor_hide ();
handle_cursor = TRUE;
}
gdk_fb_drawing_context_init (&fbdc, GDK_DRAWABLE_IMPL (gdk_parent_root), NULL, FALSE, FALSE);
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
draw_dir = 1;
if ((dy>0) || ((dy==0) && (dx>0)))
draw_dir = -1;
for (i=(draw_dir>0)?0:region->numRects-1;i >= 0 && i < region->numRects; i+=draw_dir)
{
Huge GtkFB patch with lots of small bugfixes and initial selections implementation. 2000-11-23 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkselection-fb.c: Initial selection implementation. * gtk/gtkselection.c: if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up requestor in gtk_selection_request. * gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c: Added gdk_selection_property atom. * gdk/linux-fb/gdkprivate-fb.h: Export _gdk_selection_window_destroyed. Removed mask_off_x/y from GdkCursorPrivateFB. Removed hbearing, added top, left to PangoFBGlyphInfo. * gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy): Call _gdk_selection_window_destroyed (_gdk_windowing_window_init): Don't call gdk_cursor_new() before the root window has been created. (static_dx_hack, static_dy_hack, compare_draw_rects, gdk_fb_window_move_resize): Remove unnecessary sort of rectangles in region. They are already sorted. Instead just traverse them in reverse if draw_direction < 0. * gdk/linux-fb/gdkinput-ps2.c (send_button_event): Double-clicks must be sent after the normal button_press. (gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up. * gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll): Pass _gdk_fb_screen_gc instead of NULL. * gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check): Initialize gdk_selection_property. (gdk_event_make): Remove unused code. * gdk/linux-fb/gdkcursor-fb.c: Make the pixmap for the cursor the same size as the mask. Also remove the mask_off_x/y fields in GdkCursorPrivateFB and combine _gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap() Now the whole cursor is visible. * gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3): Fix bug where xdest+height instead of ydest+height was used to calculate if the source and dest overlapped. This fixes the redraw bug when the main window in testgtk was scrolled when partially covered by a tall window. Copy rectangles in region in order depending on draw_direction. Also moved the draw_direction flipping of start_y and end_y into the gc functions, as this might not be what all of them want. (gdk_fb_draw_lines): Support dashed lines. (gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning so that the text is positioned correctly (was 1 pixel high). gdk/linux-fb/gdkgc-fb.c: Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where all lines were drawn a pixel to short. Also checked the default of the rest of the values, and they're the same as X now. * gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info): Clean up pixel positioning of the glyphs. Just use bgy->top and bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5 to all divisions to get correct rounding behaviour. * gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic, gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24): Moved start_y/end_y flip into draw_drawable implementations. Flip also x rendering when draw_direction < 0. Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
GdkRegionBox *reg = &region->rects[i];
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(gdk_parent_root),
_gdk_fb_screen_gc,
GDK_DRAWABLE_IMPL(gdk_parent_root),
&fbdc,
(reg->x1 - dx),
(reg->y1 - dy),
(reg->x1),
(reg->y1),
(reg->x2 - reg->x1),
(reg->y2 - reg->y1));
}
gdk_fb_drawing_context_finalize (&fbdc);
}
gdk_region_union (new_region, old_region);
gdk_region_subtract (new_region, region);
gdk_region_destroy (region);
gdk_window_invalidate_region_clear (gdk_parent_root, new_region);
if (handle_cursor)
gdk_fb_cursor_unhide ();
gdk_region_destroy (old_region);
gdk_region_destroy (new_region);
}
/* Send GdkEventConfigure for toplevel windows */
if (private->window_type != GDK_WINDOW_CHILD)
{
event = gdk_event_make (window, GDK_CONFIGURE, TRUE);
if (event)
{
event->configure.x = private->x;
event->configure.y = private->y;
event->configure.width = GDK_DRAWABLE_IMPL_FBDATA (private)->width;
event->configure.height = GDK_DRAWABLE_IMPL_FBDATA (private)->height;
}
}
/* The window the pointer is in might have changed */
mousewin = gdk_window_at_pointer (NULL, NULL);
gdk_fb_window_send_crossing_events (mousewin,
GDK_CROSSING_NORMAL);
2000-05-31 21:50:38 +00:00
}
}
}
void
gdk_window_move_resize (GdkWindow *window,
gint x,
gint y,
gint width,
gint height)
{
gdk_fb_window_move_resize (window, x, y, width, height, TRUE);
}
2000-05-31 21:50:38 +00:00
void
gdk_window_reparent (GdkWindow *window,
GdkWindow *new_parent,
gint x,
gint y)
{
GdkWindowObject *window_private;
GdkWindowObject *parent_private;
GdkWindowObject *old_parent_private;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (new_parent != NULL);
g_return_if_fail (GDK_IS_WINDOW (new_parent));
if (!new_parent)
new_parent = gdk_parent_root;
window_private = (GdkWindowObject*) window;
old_parent_private = (GdkWindowObject*)window_private->parent;
parent_private = (GdkWindowObject*) new_parent;
2000-05-31 21:50:38 +00:00
g_assert(GDK_DRAWABLE_IMPL_FBDATA (window_private)->colormap);
2000-05-31 21:50:38 +00:00
window_private->parent = (GdkWindowObject *)new_parent;
2000-05-31 21:50:38 +00:00
if (old_parent_private)
old_parent_private->children = g_list_remove (old_parent_private->children, window);
parent_private->children = g_list_prepend (parent_private->children, window);
if (window_private->mapped)
{
GdkRectangle r;
GdkRegion *region;
r.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
r.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - r.x;
r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - r.y;
region = gdk_region_rectangle (&r);
recompute_drawable ((GdkDrawable *)window);
r.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
r.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
r.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - r.x;
r.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - r.y;
gdk_region_union_with_rect (region, &r);
gdk_window_invalidate_region_clear (gdk_parent_root, region);
gdk_region_destroy (region);
}
2000-05-31 21:50:38 +00:00
}
void
_gdk_windowing_window_clear_area (GdkWindow *window,
gint x,
gint y,
gint width,
gint height)
{
GdkPixmap *bgpm;
GdkWindow *relto;
if (GDK_WINDOW_P (window)->input_only)
2000-05-31 21:50:38 +00:00
return;
bgpm = GDK_WINDOW_P (window)->bg_pixmap;
#if 0
for (relto = window; bgpm == GDK_PARENT_RELATIVE_BG && relto; relto = (GdkWindow *)GDK_WINDOW_P(relto)->parent)
bgpm = GDK_WINDOW_P (relto)->bg_pixmap;
#endif
2000-05-31 21:50:38 +00:00
if (bgpm && bgpm != GDK_NO_BG)
2000-05-31 21:50:38 +00:00
{
int curx, cury;
int xtrans, ytrans;
int xstep, ystep;
GdkFBDrawingContext fbdc;
2000-05-31 21:50:38 +00:00
return; /* Don't bother doing this - gtk+ will do it itself using GC tiles. If removing this line,
then also remove the #if 0 stuff */
2000-05-31 21:50:38 +00:00
gdk_fb_drawing_context_init (&fbdc, window, NULL, FALSE, TRUE);
xtrans = GDK_DRAWABLE_IMPL_FBDATA (relto)->abs_x - GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
ytrans = GDK_DRAWABLE_IMPL_FBDATA (relto)->abs_y - GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
2000-05-31 21:50:38 +00:00
for (cury = y - ytrans; cury < (y - ytrans + height); cury += ystep)
2000-05-31 21:50:38 +00:00
{
int drawh = cury % GDK_DRAWABLE_FBDATA (bgpm)->height;
ystep = GDK_DRAWABLE_FBDATA (bgpm)->height - drawh;
2000-05-31 21:50:38 +00:00
for(curx = x - xtrans; curx < (x - xtrans + width); curx += xstep)
{
int draww = curx % GDK_DRAWABLE_IMPL_FBDATA (bgpm)->width;
xstep = GDK_DRAWABLE_IMPL_FBDATA (bgpm)->width - draww;
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL (window),
_gdk_fb_screen_gc,
GDK_DRAWABLE_IMPL (bgpm),
&fbdc,
draww, drawh,
curx + xtrans, cury + ytrans,
xstep, ystep);
2000-05-31 21:50:38 +00:00
}
}
gdk_fb_drawing_context_finalize (&fbdc);
2000-05-31 21:50:38 +00:00
}
else if (!bgpm)
gdk_fb_draw_rectangle (GDK_DRAWABLE_IMPL (window), _gdk_fb_screen_gc, TRUE, x, y, width, height);
2000-05-31 21:50:38 +00:00
}
/* What's the diff? */
void
_gdk_windowing_window_clear_area_e (GdkWindow *window,
gint x,
gint y,
gint width,
gint height)
{
_gdk_windowing_window_clear_area (window, x, y, width, height);
2000-05-31 21:50:38 +00:00
}
static gint
compare_window_levels (gconstpointer a, gconstpointer b)
2000-05-31 21:50:38 +00:00
{
return (GDK_WINDOW_IMPL_FBDATA (b)->level - GDK_WINDOW_IMPL_FBDATA (a)->level);
2000-05-31 21:50:38 +00:00
}
/* Child list is sorted bottom-to-top */
static void
gdk_window_resort_children (GdkWindow *win)
2000-05-31 21:50:38 +00:00
{
GdkWindowObject *private = GDK_WINDOW_P(win);
2000-05-31 21:50:38 +00:00
private->children = g_list_sort (private->children, compare_window_levels);
2000-05-31 21:50:38 +00:00
/* Now the fun part - redraw */
if (GDK_WINDOW_P (win)->parent)
{
gdk_window_invalidate_rect (win, NULL, TRUE);
}
2000-05-31 21:50:38 +00:00
}
void
gdk_window_raise (GdkWindow *window)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_WINDOW_IMPL_FBDATA (window)->level++;
2000-05-31 21:50:38 +00:00
if (GDK_WINDOW_P (window)->parent)
gdk_window_resort_children ((GdkWindow *)GDK_WINDOW_P (window)->parent);
2000-05-31 21:50:38 +00:00
}
void
gdk_window_lower (GdkWindow *window)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_WINDOW_IMPL_FBDATA (window)->level--;
2000-05-31 21:50:38 +00:00
if (GDK_WINDOW_P(window)->parent)
gdk_window_resort_children ((GdkWindow *)GDK_WINDOW_P (window)->parent);
2000-05-31 21:50:38 +00:00
}
void
gdk_window_set_hints (GdkWindow *window,
gint x,
gint y,
gint min_width,
gint min_height,
gint max_width,
gint max_height,
gint flags)
{
}
void
gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
}
void
gdk_window_set_title (GdkWindow *window,
const gchar *title)
{
}
void
gdk_window_set_role (GdkWindow *window,
const gchar *role)
{
}
void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
GDK_WINDOW_IMPL_FBDATA (window)->level = GDK_WINDOW_IMPL_FBDATA (parent)->level + 1;
2000-05-31 21:50:38 +00:00
}
void
gdk_window_set_background (GdkWindow *window,
GdkColor *color)
{
GdkWindowObject *private = (GdkWindowObject *)window;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
private->bg_color = *color;
if (private->bg_pixmap &&
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG)
{
gdk_pixmap_unref (private->bg_pixmap);
private->bg_pixmap = NULL;
}
}
void
gdk_window_set_back_pixmap (GdkWindow *window,
GdkPixmap *pixmap,
gboolean parent_relative)
{
GdkWindowObject *private = (GdkWindowObject *)window;
2000-05-31 21:50:38 +00:00
GdkPixmap *old_pixmap;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (pixmap == NULL || !parent_relative);
old_pixmap = private->bg_pixmap;
if (parent_relative)
{
private->bg_pixmap = GDK_PARENT_RELATIVE_BG;
}
else
{
if (pixmap)
{
gdk_pixmap_ref (pixmap);
private->bg_pixmap = pixmap;
}
else
{
private->bg_pixmap = GDK_NO_BG;
}
}
if (old_pixmap &&
old_pixmap != GDK_PARENT_RELATIVE_BG &&
old_pixmap != GDK_NO_BG)
gdk_pixmap_unref (old_pixmap);
}
void
gdk_window_set_cursor (GdkWindow *window,
GdkCursor *cursor)
{
GdkCursor *old_cursor = GDK_WINDOW_IMPL_FBDATA(window)->cursor;
GdkRectangle window_reg;
2000-05-31 21:50:38 +00:00
GDK_WINDOW_IMPL_FBDATA (window)->cursor = cursor ? gdk_cursor_ref (cursor) : NULL;
2000-05-31 21:50:38 +00:00
if (old_cursor)
gdk_cursor_unref (old_cursor);
window_reg.x = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_x;
window_reg.y = GDK_DRAWABLE_IMPL_FBDATA (window)->llim_y;
window_reg.width = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_x - window_reg.x;
window_reg.height = GDK_DRAWABLE_IMPL_FBDATA (window)->lim_y - window_reg.y;
if (gdk_fb_cursor_need_hide (&window_reg))
gdk_fb_cursor_reset ();
2000-05-31 21:50:38 +00:00
}
void
gdk_window_get_geometry (GdkWindow *window,
gint *x,
gint *y,
gint *width,
gint *height,
gint *depth)
{
GdkWindowObject *private = (GdkWindowObject *)window;
2000-05-31 21:50:38 +00:00
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
if (!window)
window = gdk_parent_root;
if (!private->destroyed)
2000-05-31 21:50:38 +00:00
{
if (x)
*x = private->x;
if (y)
*y = private->y;
if (width)
*width = GDK_DRAWABLE_IMPL_FBDATA (window)->width;
2000-05-31 21:50:38 +00:00
if (height)
*height = GDK_DRAWABLE_IMPL_FBDATA (window)->height;
2000-05-31 21:50:38 +00:00
if (depth)
*depth = gdk_display->modeinfo.bits_per_pixel;
}
}
gboolean
gdk_window_get_origin (GdkWindow *window,
gint *x,
gint *y)
{
g_return_val_if_fail (window != NULL, 0);
if (x)
*x = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
2000-05-31 21:50:38 +00:00
if (y)
*y = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
2000-05-31 21:50:38 +00:00
return TRUE;
}
gboolean
gdk_window_get_deskrelative_origin (GdkWindow *window,
gint *x,
gint *y)
{
gint tx = 0;
gint ty = 0;
gboolean return_val;
g_return_val_if_fail (window != NULL, 0);
if (!GDK_WINDOW_DESTROYED (window))
2000-05-31 21:50:38 +00:00
{
tx = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_x;
ty = GDK_DRAWABLE_IMPL_FBDATA (window)->abs_y;
2000-05-31 21:50:38 +00:00
return_val = TRUE;
}
else
return_val = FALSE;
if (x)
*x = tx;
if (y)
*y = ty;
return return_val;
}
void
gdk_window_get_root_origin (GdkWindow *window,
gint *x,
gint *y)
{
gdk_window_get_deskrelative_origin (window, x, y);
2000-05-31 21:50:38 +00:00
}
GdkWindow*
gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkWindow *return_val;
int winx = 0;
int winy = 0;
int x_int, y_int;
GdkModifierType my_mask;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = gdk_parent_root;
gdk_window_get_root_origin (window, &x_int, &y_int);
gdk_input_get_mouseinfo (&winx, &winy, &my_mask);
2000-05-31 21:50:38 +00:00
winx -= x_int;
winy -= y_int;
if (x)
*x = winx;
if (y)
*y = winy;
if (mask)
*mask = my_mask;
return_val = NULL;
if ((winx >= 0) && (winx < GDK_DRAWABLE_IMPL_FBDATA (window)->width) &&
(winy >= 0) && (winy < GDK_DRAWABLE_IMPL_FBDATA (window)->height))
2000-05-31 21:50:38 +00:00
{
GdkWindowObject *private;
GdkWindowObject *sub;
2000-05-31 21:50:38 +00:00
int subx = winx, suby = winy;
for (private = sub = (GdkWindowObject *)window; sub; private = sub)
2000-05-31 21:50:38 +00:00
{
GList *ltmp;
for (ltmp = private->children; ltmp; ltmp = ltmp->next)
2000-05-31 21:50:38 +00:00
{
sub = ltmp->data;
if (!sub->mapped)
2000-05-31 21:50:38 +00:00
continue;
if (subx >= sub->x &&
(subx < (GDK_DRAWABLE_IMPL_FBDATA (sub)->width + sub->x)) &&
(suby >= sub->y) &&
(suby < (GDK_DRAWABLE_IMPL_FBDATA (sub)->height + sub->y)))
2000-05-31 21:50:38 +00:00
{
subx -= sub->x;
suby -= sub->y;
break;
}
}
if (!ltmp)
2000-05-31 21:50:38 +00:00
{
sub = NULL;
break;
}
}
return_val = (GdkWindow *)private;
}
if (!return_val)
2000-05-31 21:50:38 +00:00
return_val = gdk_parent_root;
return return_val;
}
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
{
gint rx, ry;
GdkWindow *retval = gdk_window_get_pointer (NULL, win_x, win_y, NULL);
2000-05-31 21:50:38 +00:00
if (retval)
2000-05-31 21:50:38 +00:00
{
gdk_window_get_origin (retval, &ry, &rx);
if (win_x)
2000-05-31 21:50:38 +00:00
(*win_x) -= rx;
if (win_y)
2000-05-31 21:50:38 +00:00
(*win_y) -= ry;
}
return retval;
}
GdkEventMask
gdk_window_get_events (GdkWindow *window)
{
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
if (GDK_WINDOW_DESTROYED (window))
2000-05-31 21:50:38 +00:00
return 0;
else
return GDK_WINDOW_IMPL_FBDATA (window)->event_mask;
2000-05-31 21:50:38 +00:00
}
void
gdk_window_set_events (GdkWindow *window,
GdkEventMask event_mask)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (!GDK_WINDOW_DESTROYED (window))
GDK_WINDOW_IMPL_FBDATA (window)->event_mask = event_mask;
2000-05-31 21:50:38 +00:00
}
void
gdk_window_add_colormap_windows (GdkWindow *window)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
}
/*
* This needs the X11 shape extension.
* If not available, shaped windows will look
* ugly, but programs still work. Stefan Wille
*/
void
gdk_window_shape_combine_mask (GdkWindow *window,
GdkBitmap *mask,
gint x, gint y)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
}
void
gdk_window_set_override_redirect (GdkWindow *window,
gboolean override_redirect)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
}
void
gdk_window_set_icon (GdkWindow *window,
GdkWindow *icon_window,
GdkPixmap *pixmap,
GdkBitmap *mask)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
}
void
gdk_window_set_icon_name (GdkWindow *window,
const gchar * name)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
}
void
gdk_window_set_group (GdkWindow *window,
GdkWindow *leader)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (leader != NULL);
g_return_if_fail (GDK_IS_WINDOW (leader));
/* N/A */
}
void
gdk_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
}
void
gdk_window_set_functions (GdkWindow *window,
GdkWMFunction functions)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
/* N/A */
}
void
gdk_window_set_child_shapes (GdkWindow *window)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
}
void
gdk_window_merge_child_shapes (GdkWindow *window)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
}
/*************************************************************
* gdk_window_set_static_gravities:
* Set the bit gravity of the given window to static,
* and flag it so all children get static subwindow
* gravity.
* arguments:
* window: window for which to set static gravity
* use_static: Whether to turn static gravity on or off.
* results:
* Does the XServer support static gravity?
*************************************************************/
gboolean
gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
{
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
return TRUE;
}
void
_gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
*x_offset = *y_offset = 0;
}
gboolean
_gdk_windowing_window_queue_antiexpose (GdkWindow *window,
GdkRegion *area)
{
return FALSE;
}