|
Packit Service |
fb6fa5 |
This is a list of things to check when testing window size/pos functions.
|
|
Packit Service |
fb6fa5 |
===
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_widget_set_size_request():
|
|
Packit Service |
fb6fa5 |
- causes the widget to request the given size
|
|
Packit Service |
fb6fa5 |
- for toplevel windows, changes the default-requested size if
|
|
Packit Service |
fb6fa5 |
no default size is set and gtk_window_resize() has not been called
|
|
Packit Service |
fb6fa5 |
- passing -1 for either width or height reverts to "natural" request
|
|
Packit Service |
fb6fa5 |
in that dimension
|
|
Packit Service |
fb6fa5 |
- passing 0 is allowed, and results in requisition of 1x1
|
|
Packit Service |
fb6fa5 |
(0x0 is a permitted requisition, but equivalent to 1x1,
|
|
Packit Service |
fb6fa5 |
we use 1x1 for implementation convenience)
|
|
Packit Service |
fb6fa5 |
- causes notifies on width_request, height_request properties
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_resize():
|
|
Packit Service |
fb6fa5 |
- causes a configure request in all cases if the window is mapped,
|
|
Packit Service |
fb6fa5 |
unless the new size is the same as the old size
|
|
Packit Service |
fb6fa5 |
- overrides the default size on map if the window is unmapped
|
|
Packit Service |
fb6fa5 |
- allows size of 0, equivalent to 1
|
|
Packit Service |
fb6fa5 |
- clamped to geometry hints
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_set_default_size():
|
|
Packit Service |
fb6fa5 |
- has no effect after the window has been mapped the first time,
|
|
Packit Service |
fb6fa5 |
unless the window has been unrealized in which case it should
|
|
Packit Service |
fb6fa5 |
have an effect
|
|
Packit Service |
fb6fa5 |
- allows size of 0, equivalent to 1
|
|
Packit Service |
fb6fa5 |
- allows size of -1 to unset the default size
|
|
Packit Service |
fb6fa5 |
- clamped to geometry hints
|
|
Packit Service |
fb6fa5 |
- gtk_window_resize() overrides it
|
|
Packit Service |
fb6fa5 |
- causes notifies on default_width, default_height properties
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_get_default_size():
|
|
Packit Service |
fb6fa5 |
- returns the values last passed to set_default_size(), including
|
|
Packit Service |
fb6fa5 |
-1. If set_default_size() has not been called, returns -1.
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_move():
|
|
Packit Service |
fb6fa5 |
- always causes a configure request if the window is mapped,
|
|
Packit Service |
fb6fa5 |
unless the last configure request we sent was for the same
|
|
Packit Service |
fb6fa5 |
position being moved to
|
|
Packit Service |
fb6fa5 |
- position may be negative to move windows offscreen
|
|
Packit Service |
fb6fa5 |
- if GTK_WIN_POS_CENTER_ALWAYS (or other future position
|
|
Packit Service |
fb6fa5 |
constraints we may add) is in effect, the move
|
|
Packit Service |
fb6fa5 |
request is clamped to obey the constraints. thus
|
|
Packit Service |
fb6fa5 |
calling gtk_window_move() on a CENTER_ALWAYS window
|
|
Packit Service |
fb6fa5 |
may trigger the window to bounce back to center if it
|
|
Packit Service |
fb6fa5 |
wasn't there
|
|
Packit Service |
fb6fa5 |
- overrides all GTK_WIN_POS_ except CENTER_ALWAYS
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_get_size():
|
|
Packit Service |
fb6fa5 |
- obtains the client-side known size of widget->window,
|
|
Packit Service |
fb6fa5 |
as last received from a configure event
|
|
Packit Service |
fb6fa5 |
- prior to mapping, returns the default size we will request
|
|
Packit Service |
fb6fa5 |
- between realization and mapping, computes default size
|
|
Packit Service |
fb6fa5 |
rather than looking at widget->window up-to-date size,
|
|
Packit Service |
fb6fa5 |
so the size will be correct after force-realizing a window
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_get_position():
|
|
Packit Service |
fb6fa5 |
- obtains the point to be passed to gtk_window_move() in order
|
|
Packit Service |
fb6fa5 |
to keep the window in its current position
|
|
Packit Service |
fb6fa5 |
- round-trips to the server to get the position; this is suboptimal
|
|
Packit Service |
fb6fa5 |
from both a race condition and speed standpoint but required to get
|
|
Packit Service |
fb6fa5 |
window frame size
|
|
Packit Service |
fb6fa5 |
- if the window is unmapped, returns the default position we will
|
|
Packit Service |
fb6fa5 |
request
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_set_position():
|
|
Packit Service |
fb6fa5 |
- not the inverse of get_position(), sadly
|
|
Packit Service |
fb6fa5 |
- modifies the default positioning of the window
|
|
Packit Service |
fb6fa5 |
- if set to CENTER_ALWAYS and the window is mapped, results in a
|
|
Packit Service |
fb6fa5 |
configure request moving the window to the center, unless the
|
|
Packit Service |
fb6fa5 |
window was already centered
|
|
Packit Service |
fb6fa5 |
- ignored if gtk_window_move() called, with the exception
|
|
Packit Service |
fb6fa5 |
of CENTER_ALWAYS
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_parse_geometry():
|
|
Packit Service |
fb6fa5 |
- parses a standard X geometry string
|
|
Packit Service |
fb6fa5 |
- toggles on one or both of GDK_HINT_USER_SIZE, GDK_HINT_USER_POS
|
|
Packit Service |
fb6fa5 |
- "xprop" shows user size/position are set on the window
|
|
Packit Service |
fb6fa5 |
- calls gtk_window_set_default_size() to set the window size
|
|
Packit Service |
fb6fa5 |
- calls gtk_window_move() to set the window position
|
|
Packit Service |
fb6fa5 |
- calls gtk_window_set_gravity() to set the window gravity
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_reshow_with_initial_size():
|
|
Packit Service |
fb6fa5 |
- for use by GUI builders; unrealizes and re-shows the window,
|
|
Packit Service |
fb6fa5 |
using default size (and also position, but position
|
|
Packit Service |
fb6fa5 |
is reset on any hide anyway)
|
|
Packit Service |
fb6fa5 |
- window should be positioned and sized as it was on initial map,
|
|
Packit Service |
fb6fa5 |
barring odd window managers
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_window_set_geometry_hints():
|
|
Packit Service |
fb6fa5 |
- if a hint is set with this function, we do not override it
|
|
Packit Service |
fb6fa5 |
in other parts of the code
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
General behavior
|
|
Packit Service |
fb6fa5 |
===
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
- no infinite loops or nasty fighting-the-user flicker during
|
|
Packit Service |
fb6fa5 |
operations such as moving/resizing a window
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
Properties
|
|
Packit Service |
fb6fa5 |
===
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
GtkWindow::default_width, GtkWindow::default_height:
|
|
Packit Service |
fb6fa5 |
- default_width is -1 if unset, or >= 0 if
|
|
Packit Service |
fb6fa5 |
a default width is set
|
|
Packit Service |
fb6fa5 |
- default_height is -1 if unset, or >= 0 if
|
|
Packit Service |
fb6fa5 |
a default height is set
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
GtkWindow::allow_grow, GtkWindow::resizable:
|
|
Packit Service |
fb6fa5 |
- equivalent properties; changing one notifies on the other
|
|
Packit Service |
fb6fa5 |
- if FALSE, we set the min size to the max size in the geometry
|
|
Packit Service |
fb6fa5 |
hints.
|
|
Packit Service |
fb6fa5 |
- If the app programmer has called gtk_window_set_geometry_hints()
|
|
Packit Service |
fb6fa5 |
however and set min or max size, we don't replace the hint they
|
|
Packit Service |
fb6fa5 |
set.
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
GtkWidget::width_request, GtkWidget::height_request:
|
|
Packit Service |
fb6fa5 |
- if -1, default requisition of widget is used
|
|
Packit Service |
fb6fa5 |
- otherwise, override default requisition
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
|