summaryrefslogtreecommitdiff
path: root/gdk/linux-fb/gdkwindow-fb.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2000-11-25 15:44:35 +0000
committerAlexander Larsson <alexl@src.gnome.org>2000-11-25 15:44:35 +0000
commit1c805555ce2bbac4b5f0362b3750d050c766912f (patch)
tree78d5fee0dc26f1c31b445f97877f07ba4618a247 /gdk/linux-fb/gdkwindow-fb.c
parentf8cec46535dbb5de832b55e6d2126bcfd6ec20c1 (diff)
downloadgtk+-1c805555ce2bbac4b5f0362b3750d050c766912f.tar.gz
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.
Diffstat (limited to 'gdk/linux-fb/gdkwindow-fb.c')
-rw-r--r--gdk/linux-fb/gdkwindow-fb.c70
1 files changed, 17 insertions, 53 deletions
diff --git a/gdk/linux-fb/gdkwindow-fb.c b/gdk/linux-fb/gdkwindow-fb.c
index f7d300d389..ddca101eae 100644
--- a/gdk/linux-fb/gdkwindow-fb.c
+++ b/gdk/linux-fb/gdkwindow-fb.c
@@ -120,12 +120,10 @@ _gdk_windowing_window_init (void)
GdkCursor *cursor;
GdkWindowObject *private;
- cursor = gdk_cursor_new (GDK_LEFT_PTR);
-
attr.width = gdk_screen_width ();
attr.height = gdk_screen_height ();
attr.window_type = GDK_WINDOW_ROOT;
- attr.cursor = cursor;
+ 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);
@@ -137,8 +135,14 @@ _gdk_windowing_window_init (void)
GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->lim_y = attr.height;
_gdk_fb_screen_gc = gdk_gc_new (gdk_parent_root);
-
+
gdk_fb_drawable_clear (gdk_parent_root);
+
+ /* 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);
}
GdkWindow*
@@ -264,6 +268,8 @@ _gdk_windowing_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
+ _gdk_selection_window_destroyed (window);
+
#if 0
GdkWindowObject *private;
GdkWindowObject *temp_private;
@@ -764,26 +770,6 @@ recompute_drawable (GdkDrawable *drawable)
recompute_abs_positions (drawable, 0, 0, 0, 0, INT_MAX, INT_MAX);
}
-/* You can thank g_list_insert_sorted and GCompareFunc for these */
-static gint static_dx_hack, static_dy_hack;
-
-static gint
-compare_draw_rects (gconstpointer a, gconstpointer b)
-{
- const GdkRegionBox *ba = a, *bb = b;
-
- if (static_dy_hack > 0 && ba->y1 < bb->y1)
- return 1;
- if (static_dy_hack < 0 && ba->y1 > bb->y1)
- return 1;
- if (static_dx_hack > 0 && ba->x1 < bb->x1)
- return 1;
- if (static_dx_hack < 0 && ba->x1 > bb->x1)
- return 1;
-
- return -1;
-}
-
void
gdk_fb_window_move_resize (GdkWindow *window,
gint x,
@@ -794,6 +780,7 @@ gdk_fb_window_move_resize (GdkWindow *window,
{
GdkWindowObject *private;
gint dx, dy, dw, dh;
+ gint i, draw_dir;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -832,9 +819,7 @@ gdk_fb_window_move_resize (GdkWindow *window,
if (send_expose_events)
{
GdkRegion *new_region, *region;
- int i;
gboolean handle_cursor = FALSE;
- GList *rects, *ltmp, *next;
new_region = gdk_fb_clip_region (GDK_DRAWABLE_IMPL (window), NULL, TRUE, FALSE);
@@ -853,26 +838,14 @@ gdk_fb_window_move_resize (GdkWindow *window,
}
gdk_fb_drawing_context_init (&fbdc, GDK_DRAWABLE_IMPL (gdk_parent_root), NULL, FALSE, FALSE);
- g_print ("[%p] %ld rect +[%d, %d] move [%d, %d] from [%d, %d] to [%d, %d]\n",
- window,
- region->numRects,
- region->rects[0].x2 - region->rects[0].x1,
- region->rects[0].y2 - region->rects[0].y1,
- dx, dy,
- region->rects[0].x1 - dx,
- region->rects[0].y1 - dy,
- region->rects[0].x1,
- region->rects[0].y1);
- static_dx_hack = dx;
- static_dy_hack = dy;
-
- for (rects = NULL, i = 0; i < region->numRects; i++)
- rects = g_list_insert_sorted (rects, &region->rects[i], compare_draw_rects);
-
- for (ltmp = rects; ltmp; ltmp = next)
+ 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)
{
- GdkRegionBox *reg = ltmp->data;
+ GdkRegionBox *reg = &region->rects[i];
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(gdk_parent_root),
_gdk_fb_screen_gc,
@@ -884,8 +857,6 @@ gdk_fb_window_move_resize (GdkWindow *window,
(reg->y1),
(reg->x2 - reg->x1),
(reg->y2 - reg->y1));
- next = ltmp->next;
- g_list_free_1 (ltmp);
}
gdk_fb_drawing_context_finalize (&fbdc);
}
@@ -894,13 +865,6 @@ gdk_fb_window_move_resize (GdkWindow *window,
gdk_region_subtract (new_region, region);
gdk_region_destroy (region);
-#if 0
- g_print("Redraw region enclosed by [%d, %d] +[%d, %d]\n",
- new_region->extents.x1, new_region->extents.y1,
- new_region->extents.x2 - new_region->extents.x1,
- new_region->extents.y2 - new_region->extents.y1);
-#endif
-
gdk_window_invalidate_region_clear (gdk_parent_root, new_region);
if (handle_cursor)
gdk_fb_cursor_unhide ();