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.
This commit is contained in:
Alexander Larsson 2000-11-25 15:44:35 +00:00 committed by Alexander Larsson
parent f8cec46535
commit 1c805555ce
21 changed files with 988 additions and 189 deletions

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -1,3 +1,74 @@
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.
Wed Nov 22 14:11:19 GMT 2000 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml:

View File

@ -191,15 +191,69 @@ static struct {
{xterm_mask_bits, xterm_mask_width, xterm_mask_height, xterm_mask_x_hot, xterm_mask_y_hot}
};
static GdkCursor *
_gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y,
gint mask_off_x,
gint mask_off_y)
GdkCursor*
gdk_cursor_new (GdkCursorType cursor_type)
{
GdkPixmap *tmp_pm, *pm, *mask;
if (cursor_type >= sizeof(stock_cursors)/sizeof(stock_cursors[0]))
return NULL;
pm = stock_cursors[cursor_type].pm;
if (!pm)
{
GdkGC *copy_gc;
char *data;
tmp_pm = gdk_bitmap_create_from_data (gdk_parent_root,
stock_cursors[cursor_type].bits,
stock_cursors[cursor_type].width,
stock_cursors[cursor_type].height);
data = g_malloc0 (((stock_cursors[cursor_type+1].width+7)/8) * stock_cursors[cursor_type+1].height);
pm = gdk_bitmap_create_from_data (gdk_parent_root,
data,
stock_cursors[cursor_type+1].width,
stock_cursors[cursor_type+1].height);
copy_gc = gdk_gc_new (pm);
gdk_draw_drawable(pm,
copy_gc,
tmp_pm,
0, 0,
stock_cursors[cursor_type+1].hotx - stock_cursors[cursor_type].hotx,
stock_cursors[cursor_type+1].hoty - stock_cursors[cursor_type].hoty,
stock_cursors[cursor_type].width,
stock_cursors[cursor_type].height);
gdk_pixmap_unref (tmp_pm);
g_free (data);
gdk_gc_unref (copy_gc);
stock_cursors[cursor_type].pm = pm;
gdk_pixmap_ref (pm);
}
mask = stock_cursors[cursor_type+1].pm;
if (!mask)
{
mask = stock_cursors[cursor_type+1].pm = gdk_bitmap_create_from_data (gdk_parent_root,
stock_cursors[cursor_type+1].bits,
stock_cursors[cursor_type+1].width,
stock_cursors[cursor_type+1].height);
gdk_pixmap_ref (mask);
}
return gdk_cursor_new_from_pixmap (pm, mask, NULL, NULL,
stock_cursors[cursor_type+1].hotx,
stock_cursors[cursor_type+1].hoty);
}
GdkCursor*
gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y)
{
GdkCursorPrivateFB *private;
GdkCursor *cursor;
@ -214,58 +268,10 @@ _gdk_cursor_new_from_pixmap (GdkPixmap *source,
private->mask = gdk_pixmap_ref (mask);
private->hot_x = x;
private->hot_y = y;
private->mask_off_x = mask_off_x;
private->mask_off_y = mask_off_y;
return cursor;
}
GdkCursor*
gdk_cursor_new (GdkCursorType cursor_type)
{
GdkPixmap *pm, *mask;
if (cursor_type >= sizeof(stock_cursors)/sizeof(stock_cursors[0]))
return NULL;
pm = stock_cursors[cursor_type].pm;
if (!pm)
{
pm = stock_cursors[cursor_type].pm = gdk_bitmap_create_from_data (gdk_parent_root,
stock_cursors[cursor_type].bits,
stock_cursors[cursor_type].width,
stock_cursors[cursor_type].height);
gdk_pixmap_ref (pm);
}
mask = stock_cursors[cursor_type+1].pm;
if (!mask)
{
mask = stock_cursors[cursor_type+1].pm = gdk_bitmap_create_from_data (gdk_parent_root,
stock_cursors[cursor_type+1].bits,
stock_cursors[cursor_type+1].width,
stock_cursors[cursor_type+1].height);
gdk_pixmap_ref (mask);
}
return _gdk_cursor_new_from_pixmap (pm, mask, NULL, NULL,
stock_cursors[cursor_type].hotx,
stock_cursors[cursor_type].hoty,
(stock_cursors[cursor_type].hotx - stock_cursors[cursor_type+1].hotx) * 1,
(stock_cursors[cursor_type].hoty - stock_cursors[cursor_type+1].hoty) * 1);
}
GdkCursor*
gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y)
{
return _gdk_cursor_new_from_pixmap (source, mask, fg, bg, x, y, 0, 0);
}
void
_gdk_cursor_destroy (GdkCursor *cursor)
{

View File

@ -529,9 +529,9 @@ gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
destb.x1 = xdest;
destb.y1 = ydest;
destb.x2 = xdest + width;
destb.y2 = xdest + height;
destb.y2 = ydest + height;
if (EXTENTCHECK (&srcb, &destb) && ydest > ysrc)
if (EXTENTCHECK (&srcb, &destb) && ((ydest > ysrc) || ((ydest == ysrc) && (xdest > xsrc))))
draw_direction = -1;
}
@ -590,28 +590,16 @@ gdk_fb_draw_drawable_3 (GdkDrawable *drawable,
src_x_off = (src_private->abs_x + xsrc) - (private->abs_x + xdest);
src_y_off = (src_private->abs_y + ysrc) - (private->abs_y + ydest);
for(i = 0; i < real_clip_region->numRects; i++)
for (i = (draw_direction>0)?0:real_clip_region->numRects-1; i >= 0 && i < real_clip_region->numRects; i+=draw_direction)
{
GdkRegionBox *cur = &real_clip_region->rects[i];
int start_y, end_y;
if (draw_direction > 0)
{
start_y = cur->y1;
end_y = cur->y2;
}
else
{
start_y = cur->y2 - 1;
end_y = cur->y1 - 1;
}
(*draw_func) (drawable,
gc,
src,
dc,
start_y,
end_y,
cur->y1,
cur->y2,
cur->x1,
cur->x2,
src_x_off,
@ -835,10 +823,23 @@ gdk_fb_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
if (GDK_GC_FBDATA (gc)->values.line_width > 0)
miWideLine (drawable, gc, 0, npoints, points);
GdkGCFBData *private;
private = GDK_GC_FBDATA (gc);
if (private->values.line_width > 0)
{
if (private->dash_list)
miWideDash (drawable, gc, 0, npoints, points);
else
miWideLine (drawable, gc, 0, npoints, points);
}
else
miZeroLine (drawable, gc, 0, npoints, points);
{
if (private->dash_list)
miZeroDashLine (drawable, gc, 0, npoints, points);
else
miZeroLine (drawable, gc, 0, npoints, points);
}
}
static void
@ -856,7 +857,7 @@ gdk_fb_draw_segments (GdkDrawable *drawable,
pts[0].y = segs[i].y1;
pts[1].x = segs[i].x2;
pts[1].y = segs[i].y2;
gdk_fb_draw_lines (drawable, gc, pts, 2);
}
}
@ -897,22 +898,18 @@ gdk_fb_draw_glyphs (GdkDrawable *drawable,
/* Fake its existence as a pixmap */
pango_fb_font_set_size (font);
for (i = xpos = 0; i < glyphs->num_glyphs; i++)
{
PangoFBGlyphInfo *pgi;
int this_wid;
pgi = pango_fb_font_get_glyph_info (font, glyphs->glyphs[i].glyph);
this_wid = (xpos + glyphs->glyphs[i].geometry.width)/PANGO_SCALE;
gdk_fb_draw_drawable_3 (drawable, gc, (GdkPixmap *)&pgi->fbd,
&fbdc,
0, 0,
x + (xpos + glyphs->glyphs[i].geometry.x_offset)/PANGO_SCALE,
y + glyphs->glyphs[i].geometry.y_offset / PANGO_SCALE
+ pgi->hbearing,
this_wid, pgi->fbd.drawable_data.height);
x + PANGO_PIXELS (xpos) + pgi->left , y - pgi->top + 1,
pgi->fbd.drawable_data.width, pgi->fbd.drawable_data.height);
xpos += glyphs->glyphs[i].geometry.width;
}

View File

@ -20,5 +20,6 @@ extern const char *gdk_progclass;
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) (xid))
#define gdk_font_lookup(xid) ((GdkFont*) (xid))
extern GdkAtom gdk_selection_property;
#endif /* GDKFB_H */

View File

@ -90,6 +90,7 @@ _gdk_fb_gc_new (GdkDrawable *drawable,
gdk_fb_gc_set_values (gc, values, values_mask);
private->values.cap_style = GDK_CAP_BUTT;
return gc;
}

View File

@ -41,7 +41,7 @@ gdk_window_scroll (GdkWindow *window,
gdk_region_destroy (tmp_region);
gdk_fb_draw_drawable_2 (GDK_DRAWABLE_IMPL(window),
NULL,
_gdk_fb_screen_gc,
GDK_DRAWABLE_IMPL(window),
dest_rect.x - dx,
dest_rect.y - dy,

View File

@ -40,3 +40,4 @@ GdkFBWindow *gdk_root_window = NULL;
GdkFBDisplay *gdk_display = NULL;
GdkCursor *_gdk_fb_pointer_grab_cursor;
GdkGC *_gdk_fb_screen_gc = NULL;
GdkAtom gdk_selection_property;

View File

@ -185,11 +185,12 @@ send_button_event (MouseDevice *mouse,
}
#endif
gdk_event_queue_append (event);
/* For double-clicks */
if (press_event)
gdk_event_button_generate (event);
gdk_event_queue_append (event);
}
static GdkPixmap *last_contents = NULL;
@ -260,7 +261,11 @@ void
gdk_fb_cursor_unhide()
{
GdkFBDrawingContext *mydc = gdk_fb_cursor_dc;
GdkCursorPrivateFB *last_private;
GdkDrawableFBData *pixmap_last;
last_private = GDK_CURSOR_FB (last_cursor);
pixmap_last = GDK_DRAWABLE_IMPL_FBDATA (last_private->cursor);
cursor_visibility_count++;
g_assert (cursor_visibility_count <= 1);
if (cursor_visibility_count < 1)
@ -272,15 +277,15 @@ gdk_fb_cursor_unhide()
if (last_cursor)
{
if (!last_contents ||
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width > GDK_DRAWABLE_IMPL_FBDATA (last_contents)->width ||
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height > GDK_DRAWABLE_IMPL_FBDATA (last_contents)->height)
pixmap_last->width > GDK_DRAWABLE_IMPL_FBDATA (last_contents)->width ||
pixmap_last->height > GDK_DRAWABLE_IMPL_FBDATA (last_contents)->height)
{
if (last_contents)
gdk_pixmap_unref (last_contents);
last_contents = gdk_pixmap_new (gdk_parent_root,
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width,
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height,
pixmap_last->width,
pixmap_last->height,
GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->depth);
}
@ -291,25 +296,26 @@ gdk_fb_cursor_unhide()
last_location.x,
last_location.y,
0, 0,
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width,
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height,
pixmap_last->width,
pixmap_last->height,
TRUE, FALSE);
last_contents_size.x = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width;
last_contents_size.y = GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height;
gdk_gc_set_clip_mask (cursor_gc, GDK_CURSOR_FB (last_cursor)->mask);
last_contents_size.x = pixmap_last->width;
last_contents_size.y = pixmap_last->height;
gdk_gc_set_clip_mask (cursor_gc, last_private->mask);
gdk_gc_set_clip_origin (cursor_gc,
last_location.x + GDK_CURSOR_FB (last_cursor)->mask_off_x,
last_location.y + GDK_CURSOR_FB (last_cursor)->mask_off_y);
last_location.x,
last_location.y);
gdk_fb_cursor_dc_reset ();
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL(gdk_parent_root),
gdk_fb_draw_drawable_3 (GDK_DRAWABLE_IMPL (gdk_parent_root),
cursor_gc,
GDK_DRAWABLE_IMPL (GDK_CURSOR_FB (last_cursor)->cursor),
GDK_DRAWABLE_IMPL (last_private->cursor),
mydc,
0, 0,
last_location.x, last_location.y,
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->width,
GDK_DRAWABLE_IMPL_FBDATA (GDK_CURSOR_FB (last_cursor)->cursor)->height);
pixmap_last->width,
pixmap_last->height);
}
else
gdk_fb_cursor_invalidate ();

View File

@ -547,6 +547,8 @@ _gdk_windowing_init_check (int argc, char **argv)
gdk_initialized = TRUE;
gdk_selection_property = gdk_atom_intern ("GDK_SELECTION", FALSE);
return TRUE;
}
@ -987,14 +989,9 @@ gdk_event_make (GdkWindow *window,
if (evmask & type_masks[type])
{
GdkEvent *event = gdk_event_new ();
#if 0
guint32 the_time = g_latest_time.tv_sec * 1000 + g_latest_time.tv_usec / 1000;
#else
guint32 the_time;
the_time = gdk_fb_get_time ();
#endif
event->any.type = type;
event->any.window = gdk_window_ref (window);

View File

@ -477,7 +477,7 @@ pango_fb_font_get_glyph_info (PangoFont *font, PangoGlyph glyph)
PangoRectangle *my_logical_rect, *my_ink_rect;
FT_Face ftf;
gboolean free_buffer = FALSE;
ftf = fbf->ftf;
pango_fb_font_set_size (font);
@ -511,6 +511,8 @@ pango_fb_font_get_glyph_info (PangoFont *font, PangoGlyph glyph)
g_error ("Glyph render failed");
renderme = &bgy->bitmap;
pgi->top = bgy->top;
pgi->left = bgy->left;
free_buffer = TRUE;
}
else
@ -542,21 +544,19 @@ pango_fb_font_get_glyph_info (PangoFont *font, PangoGlyph glyph)
my_logical_rect = &pgi->extents[1];
{
my_ink_rect->width = (PANGO_SCALE * g->metrics.width) >> 6;
my_ink_rect->height = (PANGO_SCALE * g->metrics.height) >> 6;
my_ink_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX) >> 6);
my_ink_rect->y = - ((PANGO_SCALE * g->metrics.horiBearingY) >> 6);
my_ink_rect->width = (PANGO_SCALE * g->metrics.width + 32) >> 6;
my_ink_rect->height = (PANGO_SCALE * g->metrics.height + 32) >> 6;
my_ink_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX + 32) >> 6);
my_ink_rect->y = - ((PANGO_SCALE * g->metrics.horiBearingY + 32) >> 6);
}
{
my_logical_rect->width = (PANGO_SCALE * g->metrics.horiAdvance) >> 6;
my_logical_rect->height = (PANGO_SCALE * ftf->size->metrics.height) >> 6;
my_logical_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX) >> 6);
my_logical_rect->y = - ((PANGO_SCALE * ftf->size->metrics.ascender) >> 6);
my_logical_rect->width = (PANGO_SCALE * g->metrics.horiAdvance + 32) >> 6;
my_logical_rect->height = (PANGO_SCALE * ftf->size->metrics.height + 32) >> 6;
my_logical_rect->x = - ((PANGO_SCALE * g->metrics.horiBearingX + 32) >> 6);
my_logical_rect->y = - ((PANGO_SCALE * ftf->size->metrics.ascender + 32) >> 6);
}
pgi->hbearing = ((-g->metrics.horiBearingY) >> 6);
g_hash_table_insert (fbf->glyph_info, GUINT_TO_POINTER(glyph), pgi);
return pgi;
@ -680,7 +680,7 @@ pango_fb_font_set_size (PangoFont *font)
if (PANGO_FB_FONT (font)->desc.size != GPOINTER_TO_UINT (fbf->ftf->generic.data))
{
fbf->ftf->generic.data = GUINT_TO_POINTER (PANGO_FB_FONT (font)->desc.size);
FT_Set_Char_Size (fbf->ftf, 0, (PANGO_FB_FONT (font)->desc.size << 6)/PANGO_SCALE, 72, 72);
FT_Set_Char_Size (fbf->ftf, 0, PANGO_PIXELS (PANGO_FB_FONT (font)->desc.size << 6), 72, 72);
}
}
@ -721,8 +721,8 @@ pango_fb_font_get_metrics (PangoFont *font,
if (metrics)
{
metrics->ascent = ftf->size->metrics.ascender * PANGO_SCALE >> 6;
metrics->descent = ftf->size->metrics.descender * PANGO_SCALE >> 6;
metrics->ascent = (ftf->size->metrics.ascender * PANGO_SCALE + 32) >> 6;
metrics->descent = (ftf->size->metrics.descender * PANGO_SCALE + 32) >> 6;
}
}

View File

@ -144,7 +144,6 @@ typedef struct {
GdkCursor base;
GdkPixmap *cursor, *mask;
int hot_x, hot_y;
int mask_off_x, mask_off_y;
} GdkCursorPrivateFB;
typedef struct {
@ -252,6 +251,7 @@ GType gdk_gc_fb_get_type (void) G_GNUC_CONST;
/* Routines from gdkgeometry-fb.c */
void _gdk_window_init_position (GdkWindow *window);
void _gdk_selection_window_destroyed (GdkWindow *window);
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
@ -403,7 +403,7 @@ struct _PangoFBFont
typedef struct {
PangoRectangle extents[2];
GdkPixmapFBData fbd;
int hbearing;
int top, left;
} PangoFBGlyphInfo;
GType pango_fb_font_get_type (void) G_GNUC_CONST;

View File

@ -701,9 +701,25 @@ gdk_fb_draw_drawable_generic (GdkDrawable *drawable,
GdkDrawableFBData *private = GDK_DRAWABLE_FBDATA (drawable);
int cur_x, cur_y;
for (cur_y = start_y; cur_y*draw_direction < end_y*draw_direction; cur_y+=draw_direction)
if (draw_direction < 0)
{
for (cur_x = start_x; cur_x < end_x; cur_x++)
int tmp;
tmp = start_y;
start_y = end_y;
end_y = tmp;
start_y--;
end_y--;
tmp = start_x;
start_x = end_x;
end_x = tmp;
start_x--;
end_x--;
}
for (cur_y = start_y; cur_y != end_y; cur_y+=draw_direction)
{
for (cur_x = start_x; cur_x != end_x; cur_x+=draw_direction)
{
GdkColor spot;
@ -851,8 +867,18 @@ gdk_fb_draw_drawable_memmove (GdkDrawable *drawable,
guchar *srcmem = src_private->mem;
int linelen = (end_x - start_x)*(depth>>3);
gint cur_y;
for(cur_y = start_y; cur_y*draw_direction < end_y*draw_direction; cur_y += draw_direction)
if (draw_direction < 0)
{
int tmp;
tmp = start_y;
start_y = end_y;
end_y = tmp;
start_y--;
end_y--;
}
for(cur_y = start_y; cur_y != end_y; cur_y += draw_direction)
{
memmove (dc->mem + (cur_y * dc->rowstride) + start_x*(depth>>3),
srcmem + ((cur_y + src_y_off)*src_rowstride) + (start_x + src_x_off)*(depth>>3),
@ -893,10 +919,26 @@ gdk_fb_draw_drawable_aa_24 (GdkDrawable *drawable,
fg_r = fg.red >> 8;
fg_g = fg.green >> 8;
fg_b = fg.blue >> 8;
for (y = start_y; y*draw_direction < end_y*draw_direction; y+=draw_direction)
if (draw_direction < 0)
{
for (x = start_x; x < end_x; x++)
int tmp;
tmp = start_y;
start_y = end_y;
end_y = tmp;
start_y--;
end_y--;
tmp = start_x;
start_x = end_x;
end_x = tmp;
start_x--;
end_x--;
}
for (y = start_y; y != end_y; y+=draw_direction)
{
for (x = start_x; x != end_x; x+=draw_direction)
{
grayval = smem[x + src_x_off + (y + src_y_off) * src_rowstride];
@ -1119,7 +1161,7 @@ _gdk_fb_gc_calc_state (GdkGC *gc,
break;
}
}
if (!gc_private->values.clip_mask &&
!gc_private->values.tile &&
!gc_private->values.stipple &&

View File

@ -32,18 +32,88 @@
#include "gdkprivate-fb.h"
typedef struct _OwnerInfo OwnerInfo;
struct _OwnerInfo
{
GdkAtom selection;
GdkWindow *owner;
};
GSList *owner_list;
/* When a window is destroyed we check if it is the owner
* of any selections. This is somewhat inefficient, but
* owner_list is typically short, and it is a low memory,
* low code solution
*/
void
_gdk_selection_window_destroyed (GdkWindow *window)
{
GSList *tmp_list = owner_list;
while (tmp_list)
{
OwnerInfo *info = tmp_list->data;
tmp_list = tmp_list->next;
if (info->owner == window)
{
owner_list = g_slist_remove (owner_list, info);
g_free (info);
}
}
}
gint
gdk_selection_owner_set (GdkWindow *owner,
GdkAtom selection,
guint32 time,
gint send_event)
{
return FALSE;
GSList *tmp_list;
OwnerInfo *info;
tmp_list = owner_list;
while (tmp_list)
{
info = tmp_list->data;
if (info->selection == selection)
{
owner_list = g_slist_remove (owner_list, info);
g_free (info);
break;
}
tmp_list = tmp_list->next;
}
if (owner)
{
info = g_new (OwnerInfo, 1);
info->owner = owner;
info->selection = selection;
owner_list = g_slist_prepend (owner_list, info);
}
return TRUE;
}
GdkWindow*
gdk_selection_owner_get (GdkAtom selection)
{
OwnerInfo *info;
GSList *tmp_list;
tmp_list = owner_list;
while (tmp_list)
{
info = tmp_list->data;
if (info->selection == selection)
{
return info->owner;
}
tmp_list = tmp_list->next;
}
return NULL;
}
@ -53,6 +123,33 @@ gdk_selection_convert (GdkWindow *requestor,
GdkAtom target,
guint32 time)
{
GdkEvent *event;
GdkWindow *owner;
owner = gdk_selection_owner_get (selection);
if (owner)
{
event = gdk_event_make (owner, GDK_SELECTION_REQUEST, TRUE);
if (event)
{
event->selection.requestor = requestor;
event->selection.selection = selection;
event->selection.target = target;
event->selection.property = gdk_selection_property;
}
}
else
{
/* If no owner for the specified selection exists, the X server
* generates a SelectionNotify event to the requestor with property None.
*/
gdk_selection_send_notify ((guint32)requestor,
selection,
target,
GDK_NONE,
0);
}
}
gint
@ -61,10 +158,46 @@ gdk_selection_property_get (GdkWindow *requestor,
GdkAtom *ret_type,
gint *ret_format)
{
guchar *t = NULL;
GdkAtom prop_type;
gint prop_format;
gint prop_len;
g_return_val_if_fail (requestor != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
if (!gdk_property_get (requestor,
gdk_selection_property,
0/*AnyPropertyType?*/,
0, 0,
FALSE,
&prop_type, &prop_format, &prop_len,
&t))
{
*data = NULL;
return 0;
}
return 0;
if (ret_type)
*ret_type = prop_type;
if (ret_format)
*ret_format = prop_format;
if (!gdk_property_get (requestor,
gdk_selection_property,
0/*AnyPropertyType?*/,
0, prop_len + 1,
FALSE,
&prop_type, &prop_format, &prop_len,
&t))
{
*data = NULL;
return 0;
}
*data = t;
return prop_len;
}
@ -75,6 +208,16 @@ gdk_selection_send_notify (guint32 requestor,
GdkAtom property,
guint32 time)
{
GdkEvent *event;
event = gdk_event_make (gdk_window_lookup (requestor), GDK_SELECTION_NOTIFY, TRUE);
if (event)
{
event->selection.selection = selection;
event->selection.target = target;
event->selection.property = property;
event->selection.requestor = (GdkNativeWindow) requestor;
}
}
gint
@ -82,6 +225,7 @@ gdk_text_property_to_text_list (GdkAtom encoding, gint format,
const guchar *text, gint length,
gchar ***list)
{
g_warning ("gdk_text_property_to_text_list() not implemented\n");
return 0;
}
@ -89,6 +233,7 @@ void
gdk_free_text_list (gchar **list)
{
g_return_if_fail (list != NULL);
g_warning ("gdk_free_text_list() not implemented\n");
}
gint
@ -96,11 +241,13 @@ gdk_string_to_compound_text (const gchar *str,
GdkAtom *encoding, gint *format,
guchar **ctext, gint *length)
{
g_warning ("gdk_string_to_compound_text() not implemented\n");
return 0;
}
void gdk_free_compound_text (guchar *ctext)
{
g_warning ("gdk_free_compound_text() not implemented\n");
}
/**
@ -119,6 +266,7 @@ void gdk_free_compound_text (guchar *ctext)
gchar *
gdk_utf8_to_string_target (const gchar *str)
{
g_warning ("gdk_utf8_to_string_target() not implemented\n");
return 0;
}
@ -143,9 +291,80 @@ gdk_utf8_to_compound_text (const gchar *str,
guchar **ctext,
gint *length)
{
g_warning ("gdk_utf8_to_compound_text() not implemented\n");
return 0;
}
static gint
make_list (const gchar *text,
gint length,
gboolean latin1,
gchar ***list)
{
GSList *strings = NULL;
gint n_strings = 0;
gint i;
const gchar *p = text;
const gchar *q;
GSList *tmp_list;
GError *error = NULL;
while (p < text + length)
{
gchar *str;
q = p;
while (*q && q < text + length)
q++;
if (latin1)
{
str = g_convert (p, q - p,
"UTF-8", "ISO-8859-1",
NULL, NULL, &error);
if (!str)
{
g_warning ("Error converting selection from STRING: %s",
error->message);
g_error_free (error);
}
}
else
str = g_strndup (p, q - p);
if (str)
{
strings = g_slist_prepend (strings, str);
n_strings++;
}
p = q + 1;
}
if (list)
*list = g_new (gchar *, n_strings + 1);
(*list)[n_strings] = NULL;
i = n_strings;
tmp_list = strings;
while (tmp_list)
{
if (list)
(*list)[--i] = tmp_list->data;
else
g_free (tmp_list->data);
tmp_list = tmp_list->next;
}
g_slist_free (strings);
return n_strings;
}
/**
* gdk_text_property_to_utf8_list:
* @encoding: an atom representing the encoding of the text
@ -168,5 +387,71 @@ gdk_text_property_to_utf8_list (GdkAtom encoding,
gint length,
gchar ***list)
{
return 0;
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
if (encoding == GDK_TARGET_STRING)
{
return make_list ((gchar *)text, length, TRUE, list);
}
else if (encoding == gdk_atom_intern ("UTF8_STRING", FALSE))
{
return make_list ((gchar *)text, length, FALSE, list);
}
else
{
gchar **local_list;
gint local_count;
gint i;
gchar *charset = NULL;
gboolean need_conversion = !g_get_charset (&charset);
gint count = 0;
GError *error = NULL;
/* Probably COMPOUND text, we fall back to Xlib routines
*/
local_count = gdk_text_property_to_text_list (encoding,
format,
text,
length,
&local_list);
if (list)
*list = g_new (gchar *, local_count + 1);
for (i=0; i<local_count; i++)
{
/* list contains stuff in our default encoding
*/
if (need_conversion)
{
gchar *utf = g_convert (local_list[i], -1,
"UTF-8", charset,
NULL, NULL, &error);
if (utf)
{
if (list)
(*list)[count++] = utf;
else
g_free (utf);
}
else
{
g_warning ("Error converting to UTF-8 from '%s': %s",
charset, error->message);
g_error_free (error);
error = NULL;
}
}
else
{
if (list)
(*list)[count++] = g_strdup (local_list[i]);
}
}
gdk_free_text_list (local_list);
(*list)[count] = NULL;
return count;
}
}

View File

@ -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 ();

View File

@ -59,6 +59,8 @@
#include "x11/gdkx.h" /* For gdk_window_lookup() */
#elif defined (GDK_WINDOWING_WIN32)
#include "win32/gdkwin32.h" /* For gdk_window_lookup() */
#elif defined (GDK_WINDOWING_FB)
#include "linux-fb/gdkfb.h" /* For gdk_window_lookup() */
#elif defined (GDK_WINDOWING_NANOX)
#include "nanox/gdkprivate-nanox.h" /* For gdk_window_lookup() */
#endif
@ -980,7 +982,7 @@ gtk_selection_request (GtkWidget *widget,
/* Create GdkWindow structure for the requestor */
#if defined(GDK_WINDOWING_WIN32) || defined(GDK_WINDOWING_X11)
#if defined(GDK_WINDOWING_WIN32) || defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_FB)
info->requestor = gdk_window_lookup (event->requestor);
if (!info->requestor)
info->requestor = gdk_window_foreign_new (event->requestor);