Skip to content

Commit

Permalink
TEMP: experiment giving focus to auth dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
CendioOssman committed Oct 14, 2022
1 parent d3487aa commit ce81726
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions vncviewer/CConn.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)

if(sock == NULL) {
try {
// FIXME: This shouldn't block
#ifndef WIN32
if (strchr(vncServerName, '/') != NULL) {
sock = new network::UnixSocket(vncServerName);
Expand Down
13 changes: 8 additions & 5 deletions vncviewer/DesktopWindow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name,
#else
delayedFullscreen = true;
#endif

// Full screen events are not sent out for a hidden window,
// so send a fake one here to set up things properly.
if (fullscreen_active())
handle(FL_FULLSCREEN);
}

show();

// Full screen events are not sent out for a hidden window,
// so send a fake one here to set up things properly.
if (fullscreen_active())
handle(FL_FULLSCREEN);

// Unfortunately, current FLTK does not allow us to set the
// maximized property on Windows and X11 before showing the window.
// See STR #2083 and STR #2178
Expand Down Expand Up @@ -901,6 +901,7 @@ int DesktopWindow::handle(int event)
{
switch (event) {
case FL_FULLSCREEN:
vlog.error("FL_FULLSCREEN");
fullScreen.setParam(fullscreen_active());

// Update scroll bars
Expand Down Expand Up @@ -996,10 +997,12 @@ int DesktopWindow::fltkDispatch(int event, Fl_Window *win)
// another application. Make sure we update our grabs with the focus
// changes.
case FL_FOCUS:
vlog.error("FL_FOCUS");
if (fullscreenSystemKeys && dw->fullscreen_active())
dw->grabKeyboard();
break;
case FL_UNFOCUS:
vlog.error("FL_UNFOCUS");
dw->ungrabKeyboard();
break;

Expand Down
8 changes: 7 additions & 1 deletion vncviewer/cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,14 @@ int cocoa_tap_keyboard(Fl_Window *win)
trusted = AXIsProcessTrustedWithOptions(options);
CFRelease(options);

if (!trusted)
if (!trusted) {
NSWindow *nsw;
nsw = (NSWindow*)fl_xid(win);
[nsw setLevel:NSNormalWindowLevel];
[nsw orderBack:nil];
[NSApp deactivate];
return 1;
}

//NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt: @YES};
//BOOL accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
Expand Down
5 changes: 4 additions & 1 deletion vncviewer/vncviewer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,10 @@ int main(int argc, char** argv)
}
}

usage(argv[0]);
vlog.error(_("Unknown parameter: %s"), argv[i]);

if (false)
usage(argv[0]);
}

strncpy(vncServerName, argv[i], VNCSERVERNAMELEN);
Expand Down

0 comments on commit ce81726

Please sign in to comment.