Commit Graph

11556 Commits

Author SHA1 Message Date
Javier Jardón
cabc386252 docs: Improve reference crossing in GtkWidget docs 2010-10-11 05:04:20 +02:00
Xan Lopez
71b4d83144 Plug memory leak in GtkWindow
1,936 (112 direct, 1,824 indirect) bytes in 4 blocks are definitely lost in loss record 13,453 of 13,673
    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
    by 0x69615A1: cairo_region_create (cairo-region.c:196)
    by 0x683BFBF: gdk_cairo_region_create_from_surface (gdkcairo.c:455)
    by 0x670C882: set_grip_shape (gtkwindow.c:5020)
    by 0x670CFBF: resize_grip_create_window (gtkwindow.c:5271)
    by 0x670C466: gtk_window_realize (gtkwindow.c:4902)

Signed-off-by: Benjamin Otte <otte@redhat.com>
2010-10-11 02:33:25 +02:00
Javier Jardón
ee58c6c37d docs: Move documentation to inline comments: GtkScrolledWindow 2010-10-11 02:17:08 +02:00
Matthias Clasen
9d750ad13e Fix a problem with 'resize grip avoidance' in scrollbars
We need to be a little more careful when determining the overlap
between the new allocation and the grip area. This was causing
vertical scrollbars in evince to overlap with the grip.
2010-10-08 22:04:33 -04:00
Matthias Clasen
2f8f0d8eab Check for grip_window != NULL in gtk_window_draw
This is safer, since GtkWindow subclasses may override realize
and end up with has_resize_grip == TRUE, but grip_window still
being NULL - as is the case with GtkPlug.
2010-10-08 20:19:24 -04:00
William Jon McCann
f8b573766d Don't assume widgets are containers when walking the focus tree
This causes problems for links in labels.
2010-10-08 19:27:35 -04:00
Matthias Clasen
31a45c957c Fix grip window positioning
We need to position the grip window in size_allocate after all,
otherwise the grip ends up in the wrong place when the window
is realized early.

Also, avoid shadowing a variable.
2010-10-08 14:21:11 -04:00
Matthias Clasen
0ebf090d9e Don't show resize grips on override-redirect window 2010-10-08 14:01:46 -04:00
Matthias Clasen
9b9ccb56b1 Make GtkPaned use gtk_container_class_handle_border_width 2010-10-08 11:11:33 -04:00
Matthias Clasen
f7418b1652 Make GtkPaned use gtk_container_class_handle_border_width 2010-10-08 10:45:24 -04:00
Matthias Clasen
c113b8e229 Make GtkPathBar use gtk_container_class_handle_border_width 2010-10-08 10:27:00 -04:00
Tristan Van Berkom
5a7cfa7fb9 Migrated old GtkSizeRequestIface documentation to GtkWidget and added notes to gtk_widget_get_preferred_size(). 2010-10-08 23:18:05 +09:00
Tristan Van Berkom
3267cd08e9 Removed call to get_preferred_size (widget, NULL, NULL);
This was another case of making sure size-request was called
before other code was doing get_child_requisition(), now caching
is done via the same api so no need for that line.
2010-10-08 22:33:21 +09:00
Tristan Van Berkom
480b9f6b11 Removed needless initial size request of children
Old code was probably doing size-request on all children initially,
and then calling get_child_requisition() in other passes, now these
are cached after the first request anyway.
2010-10-08 22:33:21 +09:00
Tristan Van Berkom
c1e9f4a798 Removed needless size-requesting of children (child sizes are ignored at request time). 2010-10-08 22:33:21 +09:00
Matthias Clasen
2e98e37fe4 Make GtkTable use gtk_container_handle_border_width 2010-10-08 09:28:00 -04:00
Matthias Clasen
8ed725bad8 Get scrollbars out of the way of the window's resize grip
If there are both horizontal and vertical scrollbars, there is
an unused 'corner' into which the resize grip fits. Individual
scrollbars need to be shortened and moved to make room for the
resize grip.
2010-10-08 02:14:19 -04:00
Matthias Clasen
b04bceb47e Remove resize grip handling from GtkStatusbar
We remove the resize grip from GtkStatusbar, but keep the code
that makes the content avoid the grip, and adapt it to GtkWindow
grips.

The gtk_status_bar_set/get_has_resize_grip() functions and related
properties are removed.
2010-10-08 02:14:19 -04:00
Matthias Clasen
f9265ea3b8 Fix resize grip drawing in GtkAssistant
Chain up in the draw() implementation of GtkAssistant to let
GtkWindow draw the resize grip. This avoids black resize grips
in GtkAssistant windows.
2010-10-08 02:14:19 -04:00
Matthias Clasen
f6347baf64 Add resize grips to GtkWindow
Allow any window to display a resize grip, in the south-east or
south-west corner, depending on text direction. This is implemented
as a shaped window that gets overlayed on top of whatever content
is there. We add api that allows widgets to avoid the resize grip,
if desired.

The ::has-resize-grip property controls if a window may display
a resize grip. It will only be displayed if the window is resizable
and not maximized.

The size and visual appearance of the resize grip is under theme
control, using the resize-grip-width/height style properties and
the paint_resize_grip style function.
2010-10-08 02:14:10 -04:00
Tor Lillqvist
bbf189ca0d Gail needs _gtk_cell_renderer_calc_offset 2010-10-07 01:28:48 +03:00
Tor Lillqvist
e346d26f70 Make it compile again for Windows 2010-10-07 01:28:47 +03:00
Stef Walter
4196f56de9 Remove reference to hooks in gtk_about_dialog_set_website() docs.
Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-10-06 23:54:35 +02:00
Federico Mena Quintero
e17b9ae8ba Filechooser - In OPEN or SAVE mode, typing a plain folder name should switch to it
If you type 'subfolder/' and hit Enter, the file chooser will switch you to
it.  But if you type just 'subfolder' without the trailing slash, apps would
receive *that* filename (e.g. file:///foo/bar/subfolder) as the response, and
they would likely print an error that they can't open that file (as it is
a folder).  So, we change the file chooser's current folder to that subfolder
in this case.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
2010-10-06 13:10:16 -05:00
Benjamin Otte
e3e243688a widget: Fix GtkWidget::draw docs
width and height have been gone for a while...
2010-10-06 12:53:33 +02:00
Tristan Van Berkom
e1b00b52d2 Enhanced documentation description for GtkWrapBox (text by Murray Cumming). 2010-10-06 17:00:43 +09:00
Benjamin Otte
60655a36dc docs: Dn't mark all signals in GtkWidgetClass as private
They are meant to be overwritten by subclasses after all.
2010-10-05 23:25:53 +02:00
Benjamin Otte
04c630d0fd viewport: Clip contents properly when called via gtk_widget_draw() 2010-10-05 23:22:55 +02:00
Federico Mena Quintero
1d21668ecc Handle the case where you type /blah/nonexistent in SELECT_FOLDER mode
Previously name_entry_get_parent_info_cb() would fail as it doesn't handle SELECT_FOLDER.
Now we just make that function act the same as for CREATE_FOLDER mode.  In either
case, if you type "/blah/nonexistent" and hit Enter, you want a folder
with that name to be created (under the already-existing /blah).

Signed-off-by: Federico Mena Quintero <federico@novell.com>
2010-10-05 15:35:31 -05:00
Stephen Shaw
f7a20e35c1 Clarify the name of a callback
The old save_entry_get_info_cb() was misnamed; it is actually used
to see if a file's presumed parent *is* a folder.  So we rename
it to name_entry_get_parent_info_cb().

Signed-off-by: Federico Mena Quintero <federico@novell.com>
2010-10-05 15:35:31 -05:00
Stephen Shaw
2b348f9a48 bgo#629722 - file chooser should cope with typing a directory name and then Enter
file_exists_get_info_cb() used to let some actions fall through to
the code that checks for the file type of the selected file's parent
(e.g. to see if /foo/bar *is* indeed a folder if you type /foo/bar/baz).
However, we need to be more explicit for each file chooser action, as
in SELECT_FOLDER mode typing /foo/foldername and hitting Enter would not
give you an immediate selection, but rather the file chooser would
complain that it couldn't create that directory as it already exists.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
2010-10-05 15:35:30 -05:00
Javier Jardón
90d9bfe086 gtkmenu: Really fix menu code
Previous patch f0039aa2a4
is not correct as it try to fix a bug introduced in commit
3a10216dd0
2010-10-04 18:51:28 +02:00
Christian Persch
f0039aa2a4 Fix a crash in menu code
https://bugzilla.gnome.org/show_bug.cgi?id=631311
2010-10-04 10:36:43 -04:00
Matthias Clasen
21eae6b6f3 Make GdkRectangle arguments in GtkCellRenderer use const consistently
https://bugzilla.gnome.org/show_bug.cgi?id=630900
2010-10-04 10:23:55 -04:00
Javier Jardón
5a30dad531 docs: Move documentation to inline comments: GtkComboBox 2010-10-04 02:37:42 +02:00
Ignacio Casal Quinteiro
13c4c554ef Add missing vfuncs to gtknotebook. 2010-10-03 21:48:56 +02:00
Javier Jardón
bbd80b671a docs: Move documentation to inline comments: GtkNotebook 2010-10-03 20:21:48 +02:00
José Aliste
846f774642 textview: Fix clip usage
The previous code used cairo_clip_extents() and interpreted its
parameters wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=631203
2010-10-03 12:30:30 +02:00
Javier Jardón
2a9d299aa3 docs: Use gtk_widget_get_preferred_size() instead gtk_size_request_get_preferred_size()
GtkSizeRequest interface is now merged in GtkWidget
2010-10-03 03:42:31 +02:00
Javier Jardón
ccaf842919 docs: Move documentation to inline comments: GtkTooltip 2010-10-03 00:59:39 +02:00
Javier Jardón
3846988211 docs: Move documentation to inline comments: GtkToolbar 2010-10-03 00:30:25 +02:00
Garrett Regier
5fcf06bb91 docs: Move documentation to inline comments: GtkComboBoxEntry
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=617308

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-10-02 22:39:35 +02:00
Benjamin Otte
872ef111ec gdk: Make gdk_pixbuf_get_from_*() bindable
The ownership of the return value for gdk_pixbuf_get_from_window() and
gdk_pixbuf_get_from_surface() was determined by the first argument.

Because that is an ugly design and the functions are new to GTK3, we
decided to adapt them.
And that adaptation was quite easy since almost no one passses anything
but NULL as the first argument.
2010-10-02 03:08:24 +02:00
Matthias Clasen
e3957f559d GTK docs: Update width-for-height docs
Some places did not get updated after the recent rename-and-GtkWidget-merge.
2010-10-01 13:10:35 -04:00
Matthias Clasen
0bca60fdd3 GTK docs: various fixups 2010-10-01 13:05:12 -04:00
Matthias Clasen
8f91329900 Update for recent api changes 2010-10-01 07:09:28 -04:00
Jonh Wendell
0fa0e653d5 Initialize private structure 2010-09-30 16:56:11 -03:00
Benjamin Otte
f64e2df911 dnd: Fix gtk_drag_set_icon_surface() with translucent surfaces
The code for surfaces with alpha content was apparently untested and
screwed up the signs.
2010-09-30 16:25:44 +02:00
Benjamin Otte
c6e58f84ee trayicon: Use gdk_cairo_get_clip_rectangle() to simplify code 2010-09-30 15:50:52 +02:00
Benjamin Otte
7acb4d0502 docs: Add note about hot_x/y in gtk_drag_set_icon_surface() 2010-09-30 13:55:10 +02:00
Colin Walters
ad474edda8 introspection: Fix some annotation syntax 2010-09-29 10:45:04 -04:00
Benjamin Otte
14dc932fd1 gtk: Fix remaining mentions of gtk_container_propagate_expose()
That includes the gtkcontainer.h header file.

https://bugzilla.gnome.org/show_bug.cgi?id=630800
2010-09-29 14:14:20 +02:00
Javier Jardón
b072ea220c Remove unneded casts
As gtk_adjustment_new() returns a GtkAdjustment* now

https://bugzilla.gnome.org/show_bug.cgi?id=630731
2010-09-29 01:18:10 +02:00
Javier Jardón
42f480a537 gtk_adjustment_new() should return a GtkAdjustment*
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=630731
2010-09-29 01:18:10 +02:00
Benjamin Otte
948768c708 API: remove gtk_window_set_visual()
gtk_widget_set_visual() exists now and can be used instead.

This reverts commit 59b227e123.
2010-09-28 19:13:24 +02:00
Benjamin Otte
32c80ca6a9 trayicon: Use gtk_widget_set_visual() 2010-09-28 19:11:30 +02:00
Benjamin Otte
5ac6234815 API: gtk: Add gtk_widget_set_visual()
It turns out that the previous handling of just providing a way to set
visuals just on toplevels was not sufficient. In particular it
complicated the various implementations of the tray icon specification.
This patch reintroduces gtk_widget_set_visual() which behaves very
similar to GTK2's gtk_widget_set_colormap().

A future commit will remove the gtk_window_set_visual() function.
2010-09-28 19:11:21 +02:00
Benjamin Otte
d4fb25f6de widget: Fix compile warnings: missing return value 2010-09-28 18:33:23 +02:00
Benjamin Otte
65dee4e31b toolbar: Fix compilation warnings - missing cast 2010-09-28 18:26:23 +02:00
Benjamin Otte
de89fe501d treeview: Fix compilation warnings - missing cast 2010-09-28 18:26:05 +02:00
Benjamin Otte
69240d9824 offscreenwindow: Fix includes 2010-09-28 18:24:55 +02:00
Benjamin Otte
6c7daaf8b9 notebook: Fix compilation warnings - missing cast 2010-09-28 18:24:34 +02:00
Benjamin Otte
7adeca53b2 combobox: Fix compilation warnings - missing cast 2010-09-28 18:24:14 +02:00
Claudio Saavedra
e0f290278b Fix maintainer-clean
gtkimcontextsimpleseqs.h is not really autogenerated but shipped

https://bugzilla.gnome.org/show_bug.cgi?id=630708
2010-09-28 10:39:39 +03:00
Benjamin Otte
dec47f062e label: Fix rendering of rotated labels
gtk_paint_layout is utterly broken. Someone needs to fix it so we use
the cairo_t's matrix and don't juggle with both Pango and cairo matrices
everywhere.
2010-09-27 20:49:39 +02:00
Tristan Van Berkom
7047502d84 Fix erroneous usage of height-for-width apis in gtk_widget_real_adjust_size_allocation().
When fitting a widget into its allocation, the second dimension
is always dependent on the first, so gtk_widget_get_preferred_size()
cannot be used directly (because we want the natural height for
the allocated width, not the natural height for the natural width,
which is generally a smaller height than the height-for-minimum-width
or height-for-allocated-width).

Added test to testadjustsize to ensure proper behaviour.
2010-09-27 21:15:16 +09:00
Tristan Van Berkom
de0428fe52 Fixing documentation of gtk_widget_get_request_mode() 2010-09-27 15:11:27 +09:00
Matthias Clasen
d869a1e419 Remove GtkWidgetFlags 2010-09-26 22:18:46 -04:00
Matthias Clasen
f53ad33994 Remove GtkObject completely 2010-09-26 22:18:19 -04:00
Javier Jardón
eac1959d2c Move destroy signal to GtkWidget
Also make GtkWidget derive from GInitiallyUnowned
2010-09-26 22:18:18 -04:00
Javier Jardón
3b8184cfee Move classes that currently derive from GtkObject to GInitiallyUnowned 2010-09-26 22:18:13 -04:00
Javier Jardón
945e97e505 Move documentation to inline comments: GtkPaperSize 2010-09-27 03:49:49 +02:00
Tadej Borovšak
d947178e42 Update and expand GtkAccelMap API docs 2010-09-27 03:04:34 +02:00
Javier Jardón
e267ed84db Move documentation to inline comments: GtkAccelMap 2010-09-27 02:56:25 +02:00
Benjamin Otte
18e489fedd image: Fix up draw function
The previous port to the draw function was a tiny bit incomplete. This
patch should fix the remaining issues and remove unused variables.
2010-09-26 17:51:05 +02:00
Benjamin Otte
c34c05217c accellabel: Remove gtk_widget_is_drawable() check from draw vfunc 2010-09-26 15:11:46 +02:00
Benjamin Otte
41e6da4075 treeview: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:46 +02:00
Benjamin Otte
bc3d3e6cf4 spinbutton: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:46 +02:00
Benjamin Otte
92732ffea0 notebook: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:46 +02:00
Benjamin Otte
bd4545c03a menu: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:46 +02:00
Benjamin Otte
7a2010ae28 iconview: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:46 +02:00
Benjamin Otte
90beb8a514 entry: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:46 +02:00
Benjamin Otte
e13d93a707 calendar: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:45 +02:00
Benjamin Otte
19d1377494 textview: Use gtk_cairo_transform_to_window() 2010-09-26 15:11:45 +02:00
Benjamin Otte
0795f1e0c9 API: Add gtk_cairo_transform_to_window()
The function reverses the transform that GTK does before emitting a draw
event. So we can use it in "old" widgets to revert the coordinate system
properly.
2010-09-26 15:11:45 +02:00
Benjamin Otte
e66129015d cellrenderer: Merge GtkCellSizeRequest into GtkCellRenderer
This mostly goes to keep consistency with the changes to GtkSizeRequest
in the last patch, as GtkCellSizeRequest requires GtkCellRenderer and
GtkCellRenderer implements GtkCellSizeRequest there's no use in keeping
them separate.

This patch renames the functions:
gtk_cell_size_request_get_request_mode()
  => gtk_cell_renderer_get_request_mode()
gtk_cell_size_request_get_width()
  => gtk_cell_renderer_get_preferred_width()
gtk_cell_size_request_get_height()
  => gtk_cell_renderer_get_preferred_height()
gtk_cell_size_request_get_size()
  => gtk_cell_renderer_get_preferred_size()
gtk_cell_size_request_get_width_for_height()
  => gtk_cell_renderer_get_preferred_width_for_height()
gtk_cell_size_request_get_height_for_width()
  => gtk_cell_renderer_get_preferred_height_for_width()
... and moves the corresponding vfuncs to GtkCellRenderer.

The patch also renames the implementations of these functions in cell
renderers to include the word "preferrred".
2010-09-26 15:11:45 +02:00
Benjamin Otte
d9c9259861 Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.

Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.

So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
  gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
  gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.

The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
2010-09-26 15:11:45 +02:00
Benjamin Otte
ffa5587fb3 dnd-quartz: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
99eae4e208 window: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
64dddaf1fe widget: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
f999c8dc29 viewport: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
21d6aba620 treeview: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
e10f5e9ad5 textview: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
e25208825f testutils: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
f0c067063c spinbutton: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
fb43f590e9 plug: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
dca859dfa1 offscreenwindow: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
6eb6135e2d notebook: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
2743f0bdcd menu: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
a145deb083 iconview: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
2e5df3306a handlebox: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
34c6e35152 entry: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
7125712299 calendar: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +02:00
Benjamin Otte
5f57cede3c widget: Check the widget has an allocation in gtk_widget_draw()
Following the mailing list discussion, require that the widget does not
have a pending size_allocate when calling the draw function.

http://mail.gnome.org/archives/gtk-devel-list/2010-September/msg00214.html
and the associated thread explain this in more detail.
2010-09-26 15:11:43 +02:00
Benjamin Otte
b89920e203 API: Add gtk_widget_draw()
And here's the final patch that all the previous patches were about.
2010-09-26 15:11:43 +02:00
Benjamin Otte
1142c8bf18 API: gtk_cell_renderer_render_cairo() => gtk_cell_renderer_render() 2010-09-26 15:11:43 +02:00
Benjamin Otte
ec6e97be4d API: Remove gtk_cell_renderer_render()
The next commit will rename gtk_cell_renderer_render_cairo() to
gtk_cell_renderer_render() again
2010-09-26 15:11:43 +02:00
Benjamin Otte
67284a57de API: Get rid of gtk_draw_insertion_cursor()
and rename gtk_cairo_draw_insertion_cursor() to
gtk_draw_insertion_cursor().
2010-09-26 15:11:43 +02:00
Benjamin Otte
1d3f6b30b0 API: Rename gtk_cairo_paint_*() to gtk_paint_*()
Large patch, but just renaming.
Indentation should still mostly be correct because I took care of
keeping the indentation for this function name.
2010-09-26 15:11:42 +02:00
Benjamin Otte
70e6aba0d0 API: style: Remove old drawing functions 2010-09-26 15:11:42 +02:00
Benjamin Otte
326f887ae7 API: widget: Remove the expose event
gtk_widget_send_expose() now calls the draw function.
2010-09-26 15:11:42 +02:00
Benjamin Otte
9aa4f417d0 API: Remove gtk_container_propagate_expose()
Also, move the documentation to its replacement
gtk_widget_propagate_draw().
2010-09-26 15:11:42 +02:00
Benjamin Otte
7947b3faf8 container: Implement gtk_container_propagate_draw() without fallbacks
No more fallbacks to gtk_container_propagate_expose().
2010-09-26 15:11:42 +02:00
Benjamin Otte
45744d9a5f Change semantics of the draw signal
Previously, we tried to move the context's origin to the widget's top
left location, no matter what window the paint was happening on. Now we
only do that for child windows of the widget's window and leave the
context untouched for windows that the widget has created outside its
own hierarchy. In those casses, we also don't clip the context to
the widget's allocation.

Includes fixes to GtkHandlebox for this effect and fixes all known
issues with it.

These semantics assume that gtk_widget_draw() should only draw the parts
of a widget that are inside child windows and not draw stuff that is
located in completely different GdkWindows. In the handlebox case, it
means that it should only draw the handle when it is attached, but not
when it isn't. We'll likely need a special draw function for the
detached handlebox if we want to draw it.
2010-09-26 15:11:42 +02:00
Benjamin Otte
0acec382c8 widget: Clip drawing to the widget's allocation.
I've seen (and written) quite some widgets (and theme engines) that use
cairo_paint() to draw the background. So avoiding overdraw makes sense.

Also move all that setup into a _gtk_widget_draw_internal() function
that will be used by all functions that can be used by other functions
that draw widgets.
2010-09-26 15:11:42 +02:00
Benjamin Otte
0c285bad75 iconfactory: Initialize varibale to NULL in failure path
Otherwise we use random memory and that is not good.
2010-09-26 15:11:42 +02:00
Benjamin Otte
8929321cba image: Add a default case to switch statement to avoid gcc warnings 2010-09-26 15:11:42 +02:00
Benjamin Otte
3f10e45ea1 printunixdialog: Connect to draw vfunc 2010-09-26 15:11:40 +02:00
Benjamin Otte
d207fd05e5 printunixdialog: Connect to draw signal for collate callback 2010-09-26 15:11:40 +02:00
Benjamin Otte
b0f078ba43 dnd-quartz: Connect to draw func for dnd hilight 2010-09-26 15:11:40 +02:00
Benjamin Otte
729f80b554 dnd: Connect to raw func for drag hilight 2010-09-26 15:11:40 +02:00
Benjamin Otte
830cda9e32 colorsel: Connect to draw signal 2010-09-26 15:11:40 +02:00
Benjamin Otte
b717f1b265 filechooserentry: Connect to draw event 2010-09-26 15:11:40 +02:00
Benjamin Otte
8f2fdec7d6 colorbutton: Connect to draw event 2010-09-26 15:11:40 +02:00
Benjamin Otte
5f771c8a9f notebook: Connect to draw signal 2010-09-26 15:11:40 +02:00
Benjamin Otte
c54968e964 tooltip: Connect to draw signal 2010-09-26 15:11:40 +02:00
Benjamin Otte
bec11c352d toolitemgroup: Connect to draw signal 2010-09-26 15:11:40 +02:00
Benjamin Otte
a4bbe4da10 assistant: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
b0c5302115 trayicon: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
1b9f793311 window: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
15f48a818d window: Remove hack to set background
I can't see this having any effect in current code, but who knows...
2010-09-26 15:11:39 +02:00
Benjamin Otte
67299ed106 expander: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
e63d6dd379 frame: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
fac27827c4 frame: Remove unneeded is_drawable() check 2010-09-26 15:11:39 +02:00
Benjamin Otte
ff97485695 API: checkbutton: Port to draw vfunc
Requires changing the API of the draw_indicator vfunc.
2010-09-26 15:11:39 +02:00
Benjamin Otte
be8a398bb5 radiobutton: Remove redundant is_drawable() check 2010-09-26 15:11:39 +02:00
Benjamin Otte
70bdbb3f4c checkbutton: Remove redundant is_drawable() check 2010-09-26 15:11:39 +02:00
Benjamin Otte
66bd7c1578 checkbutton: Remove excessive is_drawable() check 2010-09-26 15:11:39 +02:00
Benjamin Otte
6a0c31143f handlebox: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
2e53b58b01 handlebox: Simplify painting code 2010-09-26 15:11:39 +02:00
Benjamin Otte
08d05f954d handlebox: Don't draw outside of expose events
We do a queue_draw() via queue_resize() here, so everything's fine.
2010-09-26 15:11:39 +02:00
Benjamin Otte
748d3d612d button: Port to draw vfunc
Also port togglebutton, they use the same paint function.
2010-09-26 15:11:39 +02:00
Benjamin Otte
e0be884297 button: Remove is_drawable() check
It's already done in the expose function
2010-09-26 15:11:39 +02:00
Benjamin Otte
ee15f5aab1 tearoffmenuitem: remove is_drawable() check 2010-09-26 15:11:39 +02:00
Benjamin Otte
c9c9d2ac15 API: checkmenuitem: Port to draw vfunc
Requires changing the draw_indicator vfunc to take a cairo_t.
2010-09-26 15:11:39 +02:00
Benjamin Otte
79477e097d tearoffmenuitem: Port to draw vfunc 2010-09-26 15:11:39 +02:00
Benjamin Otte
557b9d0b26 tearoffmenuitem: Don't clear the window, it should be clear already 2010-09-26 15:11:38 +02:00
Benjamin Otte
d992df0a47 tearoffmenuitem: Merge paint() into expose() 2010-09-26 15:11:38 +02:00
Benjamin Otte
6f6c81e527 menuitem: Remove is_drawable() check 2010-09-26 15:11:38 +02:00
Benjamin Otte
475f96216d menuitem: Port to draw vfunc 2010-09-26 15:11:38 +02:00
Benjamin Otte
e6d1c8aeab menuitem: Move paint function into expose function 2010-09-26 15:11:38 +02:00
Benjamin Otte
1f640d127e combobox: Port to draw vfunc 2010-09-26 15:11:38 +02:00
Benjamin Otte
fe4c61b1ec eventbox: Port to draw vfunc 2010-09-26 15:11:38 +02:00
Benjamin Otte
d17ba1d30a eventbox: Merge paint function into expose function 2010-09-26 15:11:38 +02:00
Benjamin Otte
ce2d6cc015 scrolledwindow: Port to draw vfunc 2010-09-26 15:11:38 +02:00
Benjamin Otte
5eabd8c6fa scrolledwindow: Move paint function into expose handler
Also remove the is_drawable() check. It will not be needed once we have
the draw vfunc.
2010-09-26 15:11:38 +02:00
Benjamin Otte
8af968946f viewport: No need to check if the widget is drawable anymore 2010-09-26 15:11:38 +02:00
Benjamin Otte
bf8df2daea viewport: Port to draw vfunc 2010-09-26 15:11:38 +02:00
Benjamin Otte
4a23b12911 viewport: Pass sizes explicitly to paint functions 2010-09-26 15:11:38 +02:00
Benjamin Otte
e087fe7e99 viewport: Merge gtk_viewport_paint() into expose function 2010-09-26 15:11:38 +02:00
Benjamin Otte
01a1e16dcf viewport: Don't paint stuff in realize handler 2010-09-26 15:11:38 +02:00
Benjamin Otte
f383e1f183 notebook: Port to draw vfunc 2010-09-26 15:11:38 +02:00
Benjamin Otte
21099d31ed notebook: The drawable check is not necessary
Large patch, but that's only indentation.
2010-09-26 15:11:38 +02:00
Benjamin Otte
fadf269a36 notebook: Draw tabs and arrows with Cairo
Includes a fix to only draw the current page once during a drag
operation.
2010-09-26 15:11:38 +02:00
Benjamin Otte
ad030e1696 notebook: Simplify draw_tab function a bit
Don't keep lots of local variables that are only used once.
2010-09-26 15:11:38 +02:00
Benjamin Otte
806bcb10ff notebook: remove check for is_drawable
When we reach that code, the widget will always be drawable
2010-09-26 15:11:37 +02:00
Benjamin Otte
c46ce97145 notebook: Reorder expose function in preparation of draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
f94ff0b3b9 notebook: Use a for loop when iterating over a list 2010-09-26 15:11:37 +02:00
Benjamin Otte
468e453a31 notebook: Draw focus when drawing tab
Instead of using a special function, draw the focus of a tab when the
tab actually is painted. Simplifies the code quite a bit.
2010-09-26 15:11:37 +02:00
Benjamin Otte
a5e487846a notebook: Remove useless optimization
It will become especially useless once we draw with Cairo exclusively.
2010-09-26 15:11:37 +02:00
Benjamin Otte
1c94efc921 paned: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
f2d7e6c8d4 infobar: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
299d533376 statusbar: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
782af63273 layout: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
8fc35150a2 iconview: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
c8b16f66b6 iconview: Check if the cr is clipped instead of using region 2010-09-26 15:11:37 +02:00
Benjamin Otte
ab781bd89b iconview: Simplify rubberband drawing 2010-09-26 15:11:37 +02:00
Benjamin Otte
0d6461714b menu: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
240ca0bb21 menubar: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
00375c7692 textview: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
9daab81ab5 separatortoolitem: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
818005f3fe toolbar: Port to draw vfunc 2010-09-26 15:11:37 +02:00
Benjamin Otte
9a8c9d6579 toolbar: Don't propagate events to placeholders
In particular don't when that's done using uninitialized memory
2010-09-26 15:11:36 +02:00
Benjamin Otte
a18ec3485c toolpalette: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
f525837e39 treeview: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
327a04807e treeview: Update rubberbanding code to Cairo 2010-09-26 15:11:36 +02:00
Benjamin Otte
bf3b4438bb treeview: Do not put different windows in else if branches anymore 2010-09-26 15:11:36 +02:00
Benjamin Otte
f679516ce1 treeview: Use Cairo for all bin window drawing 2010-09-26 15:11:36 +02:00
Benjamin Otte
62f5fdc856 treeview: Invalidate on expander changes, don't just repaint
Repaints are supposed to be initiated by GDK, not by random repaints.
2010-09-26 15:11:36 +02:00
Benjamin Otte
bc1cd6c5cb treeview: Draw empty tree view with Cairo 2010-09-26 15:11:36 +02:00
Benjamin Otte
0cbe62f943 API: Add gtk_container_propagate_draw()
Equivalent to gtk_container_propagate_expose(), just for the draw event.
Also port GtkContainer to the draw vfunc
2010-09-26 15:11:36 +02:00
Benjamin Otte
90379ed68a widget: Store the expose event in the cairo_t, not just the window
This way we can grab it for propagating expose events. Not sure if we
need to do this once we're all Cairo, but for now we do.
2010-09-26 15:11:36 +02:00
Benjamin Otte
fb4ba51d44 accellabel: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
4aefc82496 label: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
2e75cecd49 scale: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
e605272436 range: Port to draw vfunc 2010-09-26 15:11:36 +02:00
Benjamin Otte
745f110814 range: Make drawing use a single cairo context 2010-09-26 15:11:36 +02:00
Benjamin Otte
1d5796c95b arrow: Port to draw vfunc 2010-09-26 15:11:35 +02:00
Benjamin Otte
9233a08991 calendar: Port to draw vfunc 2010-09-26 15:11:35 +02:00
Benjamin Otte
725749cd14 calendar: Fix drawing order for windows 2010-09-26 15:11:35 +02:00
Benjamin Otte
02572cdf7e calendar: Create one cairo_t per expose event and pass it around 2010-09-26 15:11:35 +02:00
Benjamin Otte
ed996bcd68 cellview: Port to draw vfunc 2010-09-26 15:11:35 +02:00
Benjamin Otte
0a6b7e5759 spinner: Port to draw vfunc 2010-09-26 15:11:35 +02:00
Benjamin Otte
7121ec2880 image: Port to draw vfunc 2010-09-26 15:11:35 +02:00
Benjamin Otte
c76221426a image: Always render the whole image
Otherwise effects like blur etc will have funny seams on repaints.
Oh, and also, the draw vfunc doesn't have an equivalent to event->area
;)
2010-09-26 15:11:35 +02:00
Benjamin Otte
5228913f68 spinbutton: Port to draw vfunc 2010-09-26 15:11:35 +02:00
Benjamin Otte
d13a2ad66a entry: Remove gtk_entry_is_drawable() checks when painting 2010-09-26 15:11:35 +02:00
Benjamin Otte
c412c1c752 entry: Port to draw signal 2010-09-26 15:11:35 +02:00
Benjamin Otte
696989d499 entry: Split else ifs into separate if statements
Preparation for the draw vfunc
2010-09-26 15:11:35 +02:00
Benjamin Otte
ec4be3619f entry: Add bug reference to workaround 2010-09-26 15:11:35 +02:00
Benjamin Otte
867ab99b1a API: Add gtk_cairo_should_draw_window()
See the function documentation for its purpose and the next commit(s)
for examples on how to use it.
2010-09-26 15:11:35 +02:00
Benjamin Otte
04e58c192e ruler: Port to draw signal 2010-09-26 15:11:35 +02:00
Benjamin Otte
ee8788f766 API: ruler: Change draw_pos vfunc to take a cr, width and height
Also refactor code to use it
2010-09-26 15:11:35 +02:00
Benjamin Otte
f5a10b05b5 API: ruler: Remove private ruler draw functions from header 2010-09-26 15:11:34 +02:00
Benjamin Otte
892593eff4 ruler: Change the way the ruler handles exposes
1) Don't directly draw in motion-notify, instead call
   gtk_widget_queue_draw()
2) Don't draw ticks in expose events anymore, only when they were
   changed
2010-09-26 15:11:34 +02:00
Benjamin Otte
c68029b778 API: ruler: Change draw_ticks vfunc
We now pass in a cairo_t of the backbuffer and the width and height of
the widget/backbuffer, so the vfunc has a place to draw to.
2010-09-26 15:11:34 +02:00
Benjamin Otte
3bd8319a08 ruler: Don't create two cairo_t's 2010-09-26 15:11:34 +02:00
Benjamin Otte
84671438b0 separator: Convert to draw signal 2010-09-26 15:11:34 +02:00
Benjamin Otte
812d9b9948 hsv: Convert to draw signal 2010-09-26 15:11:34 +02:00
Benjamin Otte
5ea1d78857 progressbar: Port to new draw signal 2010-09-26 15:11:34 +02:00
Benjamin Otte
7108586b16 widget: Add draw signal
For now, the draw signal is emitted by default from the expose event, so
widgets can chose to either implement the expose event or the draw
function.
This is for the transitional period from expose event to draw signal.

Note that for now subclasses can only implement the draw function when
none of their parents implemented the expose event.
2010-09-26 15:11:34 +02:00
Benjamin Otte
9507670db4 API: Add API to query width and height when rendering
The functions are gtk_widget_get_allocated_width() and
gtk_widget_get_allocated_height().

They are currently identical to using width/height of
gtk_widget_get_allocation(), but are introduced for ease of use (no need
to use a custom struct) and to free people from having to think about
allocation.x and allocation.y (which is where the origin of the cairo
context in GtkWidget::draw is located).
2010-09-26 15:11:34 +02:00
Kristian Rietveld
03cf19e8e2 Create cairo context after running validate_visible_area()
validate_visible_area() can change the vertical adjustment and thus
trigger window moves/scrolls.  This seems to change the surface for
which gtk_tree_view_bin_expose() just created a cairo context.  Creating
the cairo context after the call to validate_visible_area() fixes
such crashes.
2010-09-26 15:11:34 +02:00
Benjamin Otte
e624656c20 API: Remove GdkColormap 2010-09-26 15:11:34 +02:00
Benjamin Otte
2ee8fdb79b gtk: gdk_drawable_get_display() => gdk_window_get_display() 2010-09-26 15:11:33 +02:00
Benjamin Otte
9f47be2216 gtk: gdk_drawable_get_screen/visual => gdk_window_get_screen/visual 2010-09-26 15:11:33 +02:00
Benjamin Otte
e316157671 API: gdk_pixbuf_get_from_drawable() => gdk_pixbuf_get_from_window()
The Colormap argument needed to be removed, so the renaming is just a
side effect.
2010-09-26 15:11:32 +02:00
Benjamin Otte
a9f198082a dnd: Remove unused colormap code 2010-09-26 15:11:32 +02:00
Benjamin Otte
3607a4c082 API: Remove setters and getters for default colormaps
This removes:
gtk_widget_set_default_colormap()
gtk_widget_get_default_colormap()
gtk_widget_get_default_visual()

Colormaps are gone, and the default visual is the system visual of the
default screen.
2010-09-26 15:11:32 +02:00
Benjamin Otte
c51e8bd9e5 API: Remove colormap setting and getting from GtkWidget
gtk_widget_get_colormap() and gtk_widget_set_colormap() are gone. They
are replaced by visuals.
2010-09-26 15:11:32 +02:00
Benjamin Otte
4701bdb2a8 style: Move from colormaps to visuals 2010-09-26 15:11:32 +02:00
Benjamin Otte
c64946c52d trayicon: Use XClearArea
gdk_window_clear_area() isn't smart enough to clear to a parent pixmap
that is part of a window that GDK doesn't manage.
2010-09-26 15:11:32 +02:00
Benjamin Otte
4515f0803b trayicon: Change to use gtk_window_set_visual()
One less user of colormaps, and the code is cleaner, too!
2010-09-26 15:11:32 +02:00
Benjamin Otte
59b227e123 window: Keep track of own visual
Add gtk_window_set_visual() and a "visual" property. This allows
changing the window visual to the rgba one and other awesome things
(like implementing the trayicon spec).
2010-09-26 15:11:32 +02:00
Benjamin Otte
913f3fcc9f gtk: Change gtk_widget_get_visual()
We now return the visual of the topmost widget in widget's stack that
has a window. If no such widget exists, but a GtkWindow is a parent, we
return its visual (note: GtkWindow Will gain support for setting visuals
soon). If a window doesn't exist, we return the system visual of the
default screen.

This change has multiple reasons:
- Colormaps are gone
  Now visuals are the most important resource for creating GDK windows.
- Allow widgets to change visuals for themselves and their children
  By walking the hierarchy, we ensure that child windows have the same
  visual as their parents by default. But widgets can still select a
  different visual in their realize handler when creating the GDK
  window.
- Have a replacement for gtk_widget_set_colormap()
  That function is going to die with colormaps, so a replacement was
  needed. That replacement is going to be gdk_window_set_visual().
- Make a future transition to no-window GTK easy
  Should we ever attempt a change to make all GTK widgets no-window, a
  gtk_widget_set_visual() would be silly, as only widgets with windows
  can have their own visuals. So only toplevels will gain the ability to
  change it.
2010-09-26 15:11:31 +02:00
Benjamin Otte
e8a6bad00b gtk: Don't set colormap anymore when creating GDK windows
Colormaps are about to be removed, so not using them sounds like an
awesome idea.
2010-09-26 15:11:31 +02:00
Benjamin Otte
e06d04032b spinner: We're a no-window widget, so setting a colormap does nothing 2010-09-26 15:11:31 +02:00
Benjamin Otte
ce7379a8bd style: Remove depth member from GtkStyle 2010-09-26 15:11:31 +02:00
Benjamin Otte
b09019560b style: Remove depth checks in render functions
There's no need for them anymore now that we render with Cairo.
2010-09-26 15:11:31 +02:00
Benjamin Otte
b479ff9cb5 API: Remove gtk_widget_push_colormap()
And of course, gtk_widget_pop_colormap() is gone, too.
No replacement is necessary, the function is basically unused.
2010-09-26 15:11:31 +02:00
Benjamin Otte
4dd215f82d tests: Remove GdkPixmap from test
It's not used anymore. (Was it ever?)
2010-09-26 15:11:30 +02:00
Benjamin Otte
b7f2f9a678 gtk: Remove special code for detecting pixmaps as event targets 2010-09-26 15:11:30 +02:00
Benjamin Otte
6607f2b794 API: Rename gdk_set_source_pixmap() to gdk_set_source_window()
That's what it's used for now.
2010-09-26 15:11:30 +02:00
Benjamin Otte
332652f702 API: Change offscreen windows to use a cairo_surface_t
This requires changes to all the offscreen surface getters that used to
return a GdkPixmap before.
2010-09-26 15:11:29 +02:00
Benjamin Otte
804fd4b15a dnd: Replace last pixmap usage with cairo surfaces. 2010-09-26 15:11:11 +02:00
Benjamin Otte
b370cb0d4c API: image: Remove ability to set image from a pixmap 2010-09-26 15:11:11 +02:00
Benjamin Otte
3ba78fed2a API: Remove the ability to set the dnd icon from a pixmap 2010-09-26 15:11:11 +02:00
Benjamin Otte
ca8a835874 API: Remove gtk_widget_get_snapshot()
It will be replaced with gtk_widget_draw().
2010-09-26 15:11:11 +02:00
Benjamin Otte
8ac0e98f98 ruler: Make the backing store use a surface 2010-09-26 15:04:02 +02:00
Benjamin Otte
b186680a43 API: make gtk_icon_view_create_drag_icon() return a cairo_surface_t
GdkPixmap is going to die!
2010-09-26 15:04:02 +02:00