Made the preferred size of an Area its size on GTK+ as well.
This commit is contained in:
parent
f539747546
commit
14c7267b10
|
@ -14,8 +14,13 @@ import (
|
||||||
// The difference? Minimum size takes into account things like truncation with ellipses: the minimum size of a label can allot just the ellipses!
|
// The difference? Minimum size takes into account things like truncation with ellipses: the minimum size of a label can allot just the ellipses!
|
||||||
// So we use the natural size instead.
|
// So we use the natural size instead.
|
||||||
// There is a warning about height-for-width controls, but in my tests this isn't an issue.
|
// There is a warning about height-for-width controls, but in my tests this isn't an issue.
|
||||||
|
// For Areas, we manually save the Area size and use that, just to be safe.
|
||||||
|
|
||||||
func (s *sysData) preferredSize() (width int, height int) {
|
func (s *sysData) preferredSize() (width int, height int) {
|
||||||
|
if s.ctype == c_area {
|
||||||
|
return s.areawidth, s.areaheight
|
||||||
|
}
|
||||||
|
|
||||||
_, _, width, height = gtk_widget_get_preferred_size(s.widget)
|
_, _, width, height = gtk_widget_get_preferred_size(s.widget)
|
||||||
return width, height
|
return width, height
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@ type sysData struct {
|
||||||
container *C.GtkWidget // for moving
|
container *C.GtkWidget // for moving
|
||||||
pulse chan bool // for sysData.progressPulse()
|
pulse chan bool // for sysData.progressPulse()
|
||||||
clickCounter clickCounter // for Areas
|
clickCounter clickCounter // for Areas
|
||||||
|
// we probably don't need to save these, but we'll do so for sysData.preferredSize() just in case
|
||||||
|
areawidth int
|
||||||
|
areaheight int
|
||||||
}
|
}
|
||||||
|
|
||||||
type classData struct {
|
type classData struct {
|
||||||
|
@ -358,6 +361,8 @@ func (s *sysData) setAreaSize(width int, height int) {
|
||||||
uitask <- func() {
|
uitask <- func() {
|
||||||
c := gtkAreaGetControl(s.widget)
|
c := gtkAreaGetControl(s.widget)
|
||||||
gtk_widget_set_size_request(c, width, height)
|
gtk_widget_set_size_request(c, width, height)
|
||||||
|
s.areawidth = width // for sysData.preferredSize()
|
||||||
|
s.areaheight = height
|
||||||
ret <- struct{}{}
|
ret <- struct{}{}
|
||||||
}
|
}
|
||||||
<-ret
|
<-ret
|
||||||
|
|
1
todo.md
1
todo.md
|
@ -28,7 +28,6 @@ UNIX:
|
||||||
- resizing seems to be completely and totally broken in the Wayland backend
|
- resizing seems to be completely and totally broken in the Wayland backend
|
||||||
- TODO find out if this is a problem on the GTK+/Wayland side (no initial window-configure event?)
|
- TODO find out if this is a problem on the GTK+/Wayland side (no initial window-configure event?)
|
||||||
- [12:55] <myklgo> pietro10: I meant to mention: 1073): Gtk-WARNING **: Theme parsing error: gtk.css:72:20: Not using units is deprecated. Assuming 'px'. twice.
|
- [12:55] <myklgo> pietro10: I meant to mention: 1073): Gtk-WARNING **: Theme parsing error: gtk.css:72:20: Not using units is deprecated. Assuming 'px'. twice.
|
||||||
- make sure the preferred size of Area is its size
|
|
||||||
|
|
||||||
ALL PLATFORMS:
|
ALL PLATFORMS:
|
||||||
- make sure MouseEvent's documentation has dragging described correctly (both Windows and GTK+ do)
|
- make sure MouseEvent's documentation has dragging described correctly (both Windows and GTK+ do)
|
||||||
|
|
Loading…
Reference in New Issue