Skip to content

Commit

Permalink
exposed uiWindowShow method, darwin window setup for sane show onfocus
Browse files Browse the repository at this point in the history
  • Loading branch information
d4tocchini committed Apr 3, 2020
1 parent b592bab commit 2ceeff8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions darwin/window.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,16 @@ static int uiWindowVisible(uiControl *c)
return [w->window isVisible];
}

static void uiWindowShow(uiControl *c)
void uiWindowShow(uiControl *c)
{
uiWindow *w = (uiWindow *) c;

// TODO: D4
// https://developer.apple.com/documentation/appkit/nswindow/1419208-makekeyandorderfront?language=objc
[w->window makeKeyAndOrderFront:w->window];
[w->window setLevel:NSFloatingWindowLevel];
// [w->window orderFrontRegardless];
// [w->window makeKeyAndOrderFront:nil];
// [w->window orderFront: nil];
}

static void uiWindowHide(uiControl *c)
Expand Down
2 changes: 2 additions & 0 deletions examples/controlgallery/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ int main(void)

uiControlShow(uiControl(mainwin));
uiMain();

uiWindowShow(uiControl(mainwin));
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ _UI_EXTERN void uiWindowSetChild(uiWindow *w, uiControl *child);
_UI_EXTERN int uiWindowMargined(uiWindow *w);
_UI_EXTERN void uiWindowSetMargined(uiWindow *w, int margined);
_UI_EXTERN uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar);
_UI_EXTERN void uiWindowShow(uiControl *c);

typedef struct uiButton uiButton;
#define uiButton(this) ((uiButton *) (this))
Expand Down
2 changes: 1 addition & 1 deletion unix/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static int uiWindowToplevel(uiControl *c)

uiUnixControlDefaultVisible(uiWindow)

static void uiWindowShow(uiControl *c)
void uiWindowShow(uiControl *c)
{
uiWindow *w = uiWindow(c);

Expand Down
2 changes: 1 addition & 1 deletion windows/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static int uiWindowVisible(uiControl *c)
return w->visible;
}

static void uiWindowShow(uiControl *c)
void uiWindowShow(uiControl *c)
{
uiWindow *w = uiWindow(c);

Expand Down

0 comments on commit 2ceeff8

Please sign in to comment.