summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-27 11:11:41 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-27 11:11:41 +0300
commit83e14d99ba75316da265cfa5f3fd092caa1498cf (patch)
treed7711363747455b39f0c33af57228ceac650f2c6 /src/ui/widget.c
parent6b5c5ce624178c1b61c9d5b8677d1c7f8ef38286 (diff)
Refactor: Separating UI creation and root widget from Window
Making the way for multiple roots/windows.
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index b398b7f6..b7458528 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
26#include "touch.h" 26#include "touch.h"
27#include "command.h" 27#include "command.h"
28#include "paint.h" 28#include "paint.h"
29#include "root.h"
29#include "util.h" 30#include "util.h"
30#include "window.h" 31#include "window.h"
31 32
@@ -39,7 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
39#endif 40#endif
40 41
41iDeclareType(RootData) 42iDeclareType(RootData)
42 43
44/* TODO: Move to root.c, one instance per root widget. */
43struct Impl_RootData { 45struct Impl_RootData {
44 iWidget *hover; 46 iWidget *hover;
45 iWidget *mouseGrab; 47 iWidget *mouseGrab;
@@ -772,6 +774,7 @@ void unhover_Widget(void) {
772 774
773iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) { 775iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) {
774 if (!d->parent) { 776 if (!d->parent) {
777 setCurrent_Root(d);
775 if (ev->type == SDL_MOUSEMOTION) { 778 if (ev->type == SDL_MOUSEMOTION) {
776 /* Hover widget may change. */ 779 /* Hover widget may change. */
777 setHover_Widget(NULL); 780 setHover_Widget(NULL);