Add HideTitleBar

This commit is contained in:
Lea Anthony
2020-09-21 17:13:23 +10:00
parent 629e8f73f4
commit 4bf59301e5
4 changed files with 20 additions and 3 deletions

View File

@@ -4,4 +4,5 @@ package appoptions
type MacOptions struct {
TitlebarAppearsTransparent bool
HideTitle bool
HideTitleBar bool
}

View File

@@ -115,6 +115,7 @@ struct Application {
int minimised;
int titlebarAppearsTransparent;
int hideTitle;
int hideTitleBar;
// User Data
char *HTML;
@@ -139,6 +140,10 @@ void HideTitle(struct Application *app) {
app->hideTitle = 1;
}
void HideTitleBar(struct Application *app) {
app->hideTitleBar = 1;
}
void Hide(struct Application *app) {
ON_MAIN_THREAD(
msg(app->application, s("hide:"))
@@ -198,6 +203,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in
// Features
result->frame = 1;
result->hideTitle = 0;
result->hideTitleBar = 0;
result->titlebarAppearsTransparent = 0;
printf("[l] setTitlebarAppearsTransparent %d\n", result->titlebarAppearsTransparent);
@@ -651,10 +657,13 @@ void disableBoolConfig(id config, const char *setting) {
void Run(void *applicationPointer, int argc, char **argv) {
struct Application *app = (struct Application*) applicationPointer;
int decorations;
int decorations = 0;
if (app->frame == 1 ) {
decorations = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable;
if( app->hideTitleBar == 0) {
decorations |= NSWindowStyleMaskTitled;
}
decorations |= NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable;
}
if (app->resizable) {

View File

@@ -6,6 +6,7 @@ package ffenestri
extern void TitlebarAppearsTransparent(void *);
extern void HideTitle(void *);
extern void HideTitleBar(void *);
*/
import "C"
@@ -16,6 +17,11 @@ func (a *Application) processPlatformSettings() {
C.HideTitle(a.app)
}
// HideTitleBar
if a.config.Mac.HideTitleBar {
C.HideTitleBar(a.app)
}
// if a.config.Mac.TitlebarAppearsTransparent {
// C.TitlebarAppearsTransparent(a.app)
// }

View File

@@ -21,7 +21,8 @@ func main() {
DisableResize: false,
Fullscreen: false,
Mac: wails.MacOptions{
HideTitle: true,
HideTitle: true,
HideTitleBar: true,
},
})