File tree 3 files changed +18
-4
lines changed
3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import "C"
14
14
import (
15
15
"fmt"
16
16
"gopkg.in/qml.v0/tref"
17
+ "os"
17
18
"reflect"
18
19
"runtime"
19
20
"sync"
@@ -25,9 +26,18 @@ var hookWaiting C.int
25
26
26
27
// guiLoop runs the main GUI thread event loop in C++ land.
27
28
func guiLoop () {
29
+ // This is not an option in Init to avoid forcing people to patch
30
+ // and recompile an application just so it runs on Ubuntu Touch.
31
+ deskfile := os .Getenv ("DESKTOP_FILE_HINT" )
32
+ cdeskfile := (* C .char )(nil )
33
+ if deskfile != "" {
34
+ os .Setenv ("DESKTOP_FILE_HINT" , "" )
35
+ cdeskfile = C .CString ("--desktop_file_hint=" + deskfile )
36
+ }
37
+
28
38
runtime .LockOSThread ()
29
39
guiLoopRef = tref .Ref ()
30
- C .newGuiApplication ()
40
+ C .newGuiApplication (cdeskfile )
31
41
C .idleTimerInit (& hookWaiting )
32
42
guiLoopReady .Unlock ()
33
43
C .applicationExec ()
Original file line number Diff line number Diff line change @@ -43,11 +43,15 @@ void panicf(const char *format, ...)
43
43
hookPanic (local_strdup (ba.constData ()));
44
44
}
45
45
46
- void newGuiApplication ()
46
+ void newGuiApplication (char *deskfile )
47
47
{
48
48
static char empty[1 ] = {0 };
49
- static char *argv[] = {empty};
49
+ static char *argv[] = {empty, empty, empty };
50
50
static int argc = 1 ;
51
+ if (deskfile) {
52
+ argv[argc] = deskfile;
53
+ argc++;
54
+ }
51
55
new QApplication (argc, argv);
52
56
53
57
// The event should never die.
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ typedef struct {
105
105
int line ;
106
106
} LogMessage ;
107
107
108
- void newGuiApplication ();
108
+ void newGuiApplication (char * deskfile );
109
109
void applicationExec ();
110
110
void applicationFlushAll ();
111
111
You can’t perform that action at this time.
0 commit comments