Commit Graph

1344 Commits

Author SHA1 Message Date
Owen W. Taylor
a4a7a611f2 GtkWindow: Allow setting size from geometry
If you set a geometry widget via gtk_window_set_geometry_hints() it
becomes very hard to compute appropriate toplevel sizes in pixels
to make the window a particular size. Synthesizing strings and passing
them to gtk_window_parse_geometry() is possible, but to avoid
avoid such ugliness, add functions:

 gtk_window_set_default_geometry()
 gtk_window_resize_to_geometry()

That act like gtk_window_set_default_size() and
gtk_window_resize() but are in terms of the resize increments of the
geometry widget.

https://bugzilla.gnome.org/show_bug.cgi?id=631796
2010-10-11 14:06:16 -04:00
Owen W. Taylor
88cf547029 Fix handling of the geometry widget
The geometry widget feature of gtk_window_set_geometry_hints() has
never really worked right because the calculation that GTK+ did to
compute the base size of the window only worked when the geometry
widget had a larger minimum size than anything else in the window.

Setup:
* Move the GtkSizeGroup private functions to a new private header
  gtksizegroup-private.h
* Add the possibilty to pass flags to _gtk_size_group_queue_resize(),
  with the flag GTK_QUEUE_RESIZE_INVALIDATE_ONLY to suppress adding
  the widget's toplevel to the resize queue.
* _gtk_container_resize_invalidate() is added to implement that feature
* _gtk_widget_override_size_request()/_gtk_widget_restore_size_request()
  allow temporarily forcing a large minimum size on the geometry
  widget without creating resize loops.

GtkWindow:
* Compute the extra width/height around the geometry widget
  correctly; print a warning if the computation fails.
* Always make the minimum size at least the natural minimum
  size of the toplevel; GTK+ now fails badly with underallocation.
* Always set the base size hint; we were failing to set it
  properly when the specified minimum size was overriden, but
  it's harmless to always set it.

Tests:
* New test 'testgeometry' that replaces the 'gridded geometry' test
  from testgtk. The new test is roughly similar but creates a bunch
  of windows showing different possibilities.
* The testgtk test is removed. No need to have both.

https://bugzilla.gnome.org/show_bug.cgi?id=68668
2010-10-11 14:05:29 -04:00
Cody Russell
fe9a45c413 Remove uses of gtk_statusbar_set_has_resize_grip()
This function is going away.
2010-10-08 02:14:19 -04:00
Benjamin Otte
2a1650843d Revert "testgtk: Remove snapshot test"
This reverts commit 99c82af20a and fixes
up things to compile again. Of course, the snapshotting now uses
gtk_widget_draw() instead.
2010-10-05 23:22:55 +02:00
Michael Natterer
a472d1a400 tests: don't call gtk_widget_get_allocation() on NULL children 2010-10-05 13:05:56 +02:00
Javier Jardón
e141bd3287 testtext: Use gtk_widget_destroy() instead gtk_object_destroy() 2010-09-29 05:58:02 +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
bf81be51eb testgtk: Use gtk_widget_set_visual() 2010-09-28 19:11:46 +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
e4a0a39a56 Fixing tests/ build for removal of GtkObject type. 2010-09-27 15:10:23 +09:00
Matthias Clasen
f53ad33994 Remove GtkObject completely 2010-09-26 22:18:19 -04:00
Javier Jardón
3b8184cfee Move classes that currently derive from GtkObject to GInitiallyUnowned 2010-09-26 22:18:13 -04:00
Benjamin Otte
f15860fb31 tests: Port testadjustsize to draw vfunc 2010-09-27 00:50:14 +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
aa70d351c4 tests: Get rid of gdk_drawable_get_size() usage in testwindows 2010-09-26 15:11:45 +02:00
Benjamin Otte
cdba1f6519 tests: Get rid of gdk_drawable_get_size() usage in offscreenbox 2010-09-26 15:11:45 +02:00
Benjamin Otte
15497825c0 testgtk: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:44 +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
45836db7a5 test: Port offscreen test to draw vfunc 2010-09-26 15:11:42 +02:00
Benjamin Otte
e194bc14fd testgtk: Use draw signal in layout test 2010-09-26 15:11:42 +02:00
Benjamin Otte
5442f5b9f2 testgtk: Use draw signal in scrolling test 2010-09-26 15:11:42 +02:00
Benjamin Otte
0ab6956579 testgtk: Use draw signal in cursors example 2010-09-26 15:11:41 +02:00
Benjamin Otte
87940287aa testgtk: Remove non-existing property from frame constructor 2010-09-26 15:11:41 +02:00
Benjamin Otte
38c932ace6 testgtk: Use draw signal in gridded geometry example 2010-09-26 15:11:41 +02:00
Benjamin Otte
c42f6ff4bf testgtk: Make big windows test not use expose events
Instead, use gdk_window_set_background().
2010-09-26 15:11:41 +02:00
Benjamin Otte
e1571a5936 testgtk: Use draw signal in resize grips example 2010-09-26 15:11:41 +02:00
Benjamin Otte
ba21d3e687 tests: Use draw vfunc in print-editor 2010-09-26 15:11:41 +02:00
Benjamin Otte
e65b1cfd76 testoffscreen: Connect to draw signal 2010-09-26 15:11:41 +02:00
Benjamin Otte
9cd83da6dc tests: Use draw signal in testinput 2010-09-26 15:11:41 +02:00
Benjamin Otte
c6f28c3dbc testtooltips: Connect to draw signal 2010-09-26 15:11:41 +02:00
Benjamin Otte
07d0c0b921 testtooltips: Don't call gdk_window_get_pointer() in expose events 2010-09-26 15:11:41 +02:00
Benjamin Otte
b8ebcdd0e0 testgtk: Connect to draw signal in "rotated text" example 2010-09-26 15:11:41 +02:00
Benjamin Otte
7af767333e testgtk: Connect to draw signals in "composited window" example 2010-09-26 15:11:41 +02:00
Benjamin Otte
ec604d11ec testgtk: Connect to draw signal in alpha test
Test still behaves weird, no idea why though.
2010-09-26 15:11:41 +02:00
Benjamin Otte
dfd0ceab1c tests: Connect to draw signal in testimage 2010-09-26 15:11:40 +02:00
Benjamin Otte
f8b420783d tests: Connect to draw signal in testoffscreenwindow 2010-09-26 15:11:40 +02:00
Benjamin Otte
0ad2f57332 tests: Connect to draw signal in testellipsise
The test seems broken, not sure why.
2010-09-26 15:11:40 +02:00
Benjamin Otte
9c980372d2 testcairo: Connect to draw signal 2010-09-26 15:11:40 +02:00
Benjamin Otte
c85f91e14c tests: Remove ability to set backend from testfilechooser
There's no backends anymore
2010-09-26 15:11:35 +02:00
Benjamin Otte
fc52c9daf3 testgtk: Check visual, not colormap for RGBA availability 2010-09-26 15:11:32 +02:00
Benjamin Otte
d7ede44dae testgtk: gtk_widget_set_colormap() => gtk_window_set_visual() 2010-09-26 15:11:32 +02:00
Benjamin Otte
600f52321b tests: Don't set colormap when creating offscreen windows 2010-09-26 15:11:31 +02:00
Benjamin Otte
08e6fc11ad testgtk: Don't set colormap when creating GDK windows 2010-09-26 15:11:31 +02:00
Benjamin Otte
a38472c139 testgtk: No need to set a custom colourmap here 2010-09-26 15:11:31 +02:00
Benjamin Otte
c340fb7efd tests: No need to allocate colors anymore 2010-09-26 15:11:31 +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
19bad9fecc tests: Convert testinput to use cairo_surface_t 2010-09-26 15:11:11 +02:00
Benjamin Otte
039e0c273a testoffscreen: Remove unused code 2010-09-26 15:11:11 +02:00