Skip to content

Commit

Permalink
FIX: load gui-console's configs not right
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbegin authored and qtxie committed Apr 13, 2020
1 parent 41c2470 commit 50417f6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
11 changes: 9 additions & 2 deletions modules/view/backends/gtk3/events.reds
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,15 @@ get-event-offset: func [
offset/header: TYPE_PAIR

widget: as handle! evt/msg
sz: (as red-pair! get-face-values widget) + FACE_OBJ_SIZE
as red-value! sz
either null? GET-HMENU(widget) [
sz: (as red-pair! get-face-values widget) + FACE_OBJ_SIZE
offset/x: sz/x
offset/y: sz/y
][
offset/x: GET-CONTAINER-W(widget)
offset/y: GET-CONTAINER-H(widget)
]
as red-value! offset
]
any [
evt/type = EVT_ZOOM
Expand Down
9 changes: 9 additions & 0 deletions modules/view/backends/gtk3/gtk.reds
Original file line number Diff line number Diff line change
Expand Up @@ -3275,6 +3275,9 @@ caption-id: g_quark_from_string "caption-id"
in-loop-id: g_quark_from_string "in-loop-id"
first-radio-id: g_quark_from_string "first-radio-id"
resend-event-id: g_quark_from_string "resend-event-id"
hmenu-id: g_quark_from_string "hmenu-id"
container-w: g_quark_from_string "container-w"
container-h: g_quark_from_string "container-h"

#define SET-CONTAINER(s d) [g_object_set_qdata s container-id d]
#define GET-CONTAINER(s) [g_object_get_qdata s container-id]
Expand All @@ -3294,3 +3297,9 @@ resend-event-id: g_quark_from_string "resend-event-id"
#define GET-FIRST-RADIO(s) [g_object_get_qdata s first-radio-id]
#define SET-RESEND-EVENT(s d) [g_object_set_qdata s resend-event-id d]
#define GET-RESEND-EVENT(s) [g_object_get_qdata s resend-event-id]
#define SET-HMENU(s d) [g_object_set_qdata s hmenu-id d]
#define GET-HMENU(s) [g_object_get_qdata s hmenu-id]
#define SET-CONTAINER-W(s d) [g_object_set_qdata s container-w as int-ptr! d]
#define GET-CONTAINER-W(s) [as integer! g_object_get_qdata s container-w]
#define SET-CONTAINER-H(s d) [g_object_set_qdata s container-h as int-ptr! d]
#define GET-CONTAINER-H(s) [as integer! g_object_get_qdata s container-h]
4 changes: 4 additions & 0 deletions modules/view/backends/gtk3/gui.reds
Original file line number Diff line number Diff line change
Expand Up @@ -1738,12 +1738,16 @@ OS-make-view: func [

winbox: gtk_box_new GTK_ORIENTATION_VERTICAL 0
gtk_container_add widget winbox
hMenu: null
if menu-bar? menu window [
hMenu: gtk_menu_bar_new
gtk_widget_show hMenu
build-menu menu hMenu widget
gtk_box_pack_start winbox hMenu no yes 0
SET-CONTAINER-W(widget size/x)
SET-CONTAINER-H(widget size/y)
]
SET-HMENU(widget hMenu)
gtk_widget_show winbox
container: gtk_layout_new null null
gtk_layout_set_size container size/x size/y
Expand Down
29 changes: 22 additions & 7 deletions modules/view/backends/gtk3/handlers.reds
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,16 @@ window-configure-event: func [
event [GdkEventConfigure!]
widget [handle!]
return: [integer!]
/local
x [integer!]
y [integer!]
offset [red-pair!]
][
x: 0 y: 0
gtk_window_get_position widget :x :y
offset: (as red-pair! get-face-values widget) + FACE_OBJ_OFFSET
offset/x: x
offset/y: y
unless null? GET-STARTRESIZE(widget) [
SET-RESIZING(widget widget)
]
Expand All @@ -479,15 +488,21 @@ window-size-allocate: func [
if null? GET-STARTRESIZE(widget) [
SET-STARTRESIZE(widget widget)
]
cont: GET-CONTAINER(widget)
w: gtk_widget_get_allocated_width cont
h: gtk_widget_get_allocated_height cont

unless null? GET-HMENU(widget) [
cont: GET-CONTAINER(widget)
w: gtk_widget_get_allocated_width cont
h: gtk_widget_get_allocated_height cont
SET-CONTAINER-W(widget w)
SET-CONTAINER-H(widget h)
]

if any [
sz/x <> w
sz/y <> h
sz/x <> rect/width
sz/y <> rect/height
][
sz/x: w
sz/y: h
sz/x: rect/width
sz/y: rect/height
either null? GET-RESIZING(widget) [
make-event widget 0 EVT_SIZE
][
Expand Down

0 comments on commit 50417f6

Please sign in to comment.