summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-25 08:23:43 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-25 08:23:43 +0300
commitd7550e75941aae4eae27232006a94d6e8477127e (patch)
tree0b58103efe8ed03279b976642b1413ece04130ac /src
parentc94b766e35466e01494a0cbec136b24a87745003 (diff)
Posting global commands
Diffstat (limited to 'src')
-rw-r--r--src/app.c5
-rw-r--r--src/ui/window.c21
2 files changed, 18 insertions, 8 deletions
diff --git a/src/app.c b/src/app.c
index 5bcbfc29..dadc8efb 100644
--- a/src/app.c
+++ b/src/app.c
@@ -419,7 +419,12 @@ void postRefresh_App(void) {
419} 419}
420 420
421void postCommand_App(const char *command) { 421void postCommand_App(const char *command) {
422 iAssert(command);
422 SDL_Event ev; 423 SDL_Event ev;
424 if (*command == '!') {
425 /* Global command; this is global context so just ignore. */
426 command++;
427 }
423 ev.user.type = SDL_USEREVENT; 428 ev.user.type = SDL_USEREVENT;
424 ev.user.code = command_UserEventCode; 429 ev.user.code = command_UserEventCode;
425 ev.user.windowID = get_Window() ? SDL_GetWindowID(get_Window()->win) : 0; 430 ev.user.windowID = get_Window() ? SDL_GetWindowID(get_Window()->win) : 0;
diff --git a/src/ui/window.c b/src/ui/window.c
index 709fc0e0..6291519a 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -140,13 +140,17 @@ static const iMenuItem viewMenuItems[] = {
140}; 140};
141 141
142static const iMenuItem helpMenuItems[] = { 142static const iMenuItem helpMenuItems[] = {
143 { "Help", 0, 0, "open url:about:help" }, 143 { "Help", 0, 0, "!open url:about:help" },
144 { "Release Notes", 0, 0, "open url:about:version" }, 144 { "Release Notes", 0, 0, "!open url:about:version" },
145}; 145};
146#endif 146#endif
147 147
148static const iMenuItem identityMenuItems[] = { 148static const iMenuItem identityMenuItems[] = {
149 { "New Identity...", SDLK_n, KMOD_PRIMARY | KMOD_SHIFT, "ident.new" }, 149 { "New Identity...", SDLK_n, KMOD_PRIMARY | KMOD_SHIFT, "ident.new" },
150#if !defined (iHaveNativeMenus)
151 { "---", 0, 0, NULL },
152 { "Show Identities", '3', KMOD_PRIMARY, "sidebar.mode arg:2 show:1" },
153#endif
150}; 154};
151 155
152static const char *reloadCStr_ = "\U0001f503"; 156static const char *reloadCStr_ = "\U0001f503";
@@ -299,7 +303,11 @@ static void setupUserInterface_Window(iWindow *d) {
299 setCommandHandler_Widget(navBar, handleNavBarCommands_); 303 setCommandHandler_Widget(navBar, handleNavBarCommands_);
300 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f850", 0, 0, "navigate.back"))); 304 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f850", 0, 0, "navigate.back")));
301 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f852", 0, 0, "navigate.forward"))); 305 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f852", 0, 0, "navigate.forward")));
302 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); 306 iLabelWidget *idMenu =
307 makeMenuButton_LabelWidget("\U0001f464", identityMenuItems, iElemCount(identityMenuItems));
308 setAlignVisually_LabelWidget(idMenu, iTrue);
309 addChild_Widget(navBar, iClob(idMenu));
310 //addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f464", 0, 0, "cert.client")));
303 iLabelWidget *lock = 311 iLabelWidget *lock =
304 addChildFlags_Widget(navBar, 312 addChildFlags_Widget(navBar,
305 iClob(newIcon_LabelWidget("\U0001f513", 0, 0, "server.showcert")), 313 iClob(newIcon_LabelWidget("\U0001f513", 0, 0, "server.showcert")),
@@ -314,11 +322,7 @@ static void setupUserInterface_Window(iWindow *d) {
314 setId_Widget( 322 setId_Widget(
315 addChild_Widget(navBar, iClob(newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"))), 323 addChild_Widget(navBar, iClob(newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"))),
316 "reload"); 324 "reload");
317 iLabelWidget *idMenu = 325 addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f3e0", 0, 0, "navigate.home")));
318 makeMenuButton_LabelWidget("\U0001f464", identityMenuItems, iElemCount(identityMenuItems));
319 setAlignVisually_LabelWidget(idMenu, iTrue);
320 addChild_Widget(navBar, iClob(idMenu));
321 //addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f464", 0, 0, "cert.client")));
322#if !defined (iHaveNativeMenus) 326#if !defined (iHaveNativeMenus)
323 iLabelWidget *navMenu = 327 iLabelWidget *navMenu =
324 makeMenuButton_LabelWidget("\U0001d362", navMenuItems, iElemCount(navMenuItems)); 328 makeMenuButton_LabelWidget("\U0001d362", navMenuItems, iElemCount(navMenuItems));
@@ -523,6 +527,7 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
523 } 527 }
524 /* Map mouse pointer coordinate to our coordinate system. */ 528 /* Map mouse pointer coordinate to our coordinate system. */
525 if (event.type == SDL_MOUSEMOTION) { 529 if (event.type == SDL_MOUSEMOTION) {
530 setCursor_Window(d, SDL_SYSTEM_CURSOR_ARROW); /* default cursor */
526 const iInt2 pos = coord_Window(d, event.motion.x, event.motion.y); 531 const iInt2 pos = coord_Window(d, event.motion.x, event.motion.y);
527 event.motion.x = pos.x; 532 event.motion.x = pos.x;
528 event.motion.y = pos.y; 533 event.motion.y = pos.y;