Remmy / afterstep

Other
3 stars 15 forks source link

Keyboard Focus / Timing issue #5

Open wildstar84 opened 9 years ago

wildstar84 commented 9 years ago

I'm still using Afterstep, is anyone still maintaining it? One small issue affecting 2.2.12 up thru latest 2.2.12-4: Popup dialog windows in Perl/Tk often pop up WITHOUT keyboard focus (requiring one to click on the popup window before typing on the field designated to be focused. I use "ClickToFocus". Other windowmanagers do not require this code. Problem is when calling $popup->waitWindow. My workaround is to add the Perl code below before calling waitWindow:

if ($ENV{DESKTOP_SESSION} =~ /AfterStep version 2.2.1[2-9]/i) {  # TO GET AFTERSTEP TO GIVE "TRANSIENT" WINDOWS THE FOCUS?!
    DoOneEvent(ALL_EVENTS);
    select(undef, undef, undef, 0.5);  #FANCY QUICK-NAP FUNCTION!
}
Remmy commented 9 years ago

Hi wildstar,

Thank you for the report. Do you use ClickToFocus (or a similar functionality setting) in those other window managers where this is not an issue?

Remmy commented 9 years ago

I'm inclined to say this works as intended, hence the question. Also, the official afterstep repository is at https://github.com/sashavasko/afterstep-devel , with sasha being the long term afterstep coder / maintainer. We haven't seen him around much lately.

wildstar84 commented 9 years ago

Thank you for the very quick response!! It can't be normal behavior, since it's somewhat random. Yes, I use "ClickToFocus" (vs. FocusFollowsMouse, etc. since I want focus to stay on window last clicked, except transient popups, which (I believe) should get kb focus and be on top). In other WMs, w/ClickToFocus, transient popups get popped up, raised, and focused. Is there a proper way / options to set this this way in AS? I think it's a timing issue, since varying the delay affects this as does how much load is on the windowmanager (ie. how many windows open, etc.) I saw Sasha's repository, but it did not have a link to view/report issues, so I ssumed you had taken it over. So far, it's only an issue w/my Perl/Tk apps but I haven't seen it manifest in Fluxbox, Kde, Xfce, Windows, or older vsns. of AS.

wildstar84 commented 9 years ago

If it would help, I can provide my look/feel files and/or write up a very simple Perl/Tk app. to demo/use for test/debugging!

Remmy commented 9 years ago

If it would help, I can provide my look/feel files and/or write up a very simple Perl/Tk app. to demo/use for test/debugging!

Yes, that would be very useful. I wouldn't mind giving fixing this a try, but I am nowhere near the expert that Sasha is on this. I have emailed him yesterday to ask how he's doing and what's up, but no reply yet.

wildstar84 commented 9 years ago

Thank you very much for your attention to this issue! Please let me know if you need any other information.

Jim Turner

Program (aspopuptest.pl): ###################################################################

!/usr/bin/perl -s

use Tk; #LOAD TK STUFF

$MainWin = MainWindow->new;

my $pbtn = $MainWin->Button( #MAIN WINDOW BUTTON TO ACTIVATE POPUP WINDOW: -text => 'Popup', -underline => 0, -command => sub { &popup() } )->pack( -side => 'top' );

$MainWin->Button( #MAIN WINDOW BUTTON TO QUIT. -text => 'Quit', -underline => 0, -command => sub { exit (0); } )->pack( -side => 'top' );

$pbtn->focus(); #GIVE MAIN WINDOW BUTTON THE KEYBOARD FOCUS.

MainLoop;

sub popup #CALLED WHEN POPUP BUTTON PRESSED ON MAIN WINDOW: { if (Exists($textPopup)) #IF POPUP WINDOW STILL EXISTS, GET RID OF IT. { $MainWin->focus(); $textPopup->destroy; $MainWin->raise(); $pbtn->focus(); #SEEMS TO BE NEEDED REGARDLESS OF WINDOW-MANAGER. } $textPopup = $MainWin->Toplevel; #CREATE THE POPUP WINDOW. $textPopup->transient($MainWin); #TELL W/M IT'S "TRANSIENT". $textPopup->title('Popup Window');

my $getText = $textPopup->Entry(  #CREATE A TEXT FIELD WHICH SHOULD BE INITIALLY FOCUSED:
        -relief => 'sunken',
        -width  => 10
)->pack(
        -side => 'top'
);
my $okButton = $textPopup->Button(  #BUTTON TO CLOSE POPUP WINDOW.
        -text => 'Close',
        -underline => 0,
        -command => sub {
            $MainWin->focus();   #RESTORE FOCUS TO PARENT WINDOW ON CLOSE.
            $textPopup->destroy; #DESTROY POPUP WINDOW.
            $MainWin->raise();
            $pbtn->focus();      #SEEMS TO BE NEEDED REGARDLESS OF WINDOW-MANAGER.
        }
)->pack(
        -side=>'top'
);

UNCOMMENT CODE BELOW NEEDED TO GET AFTERSTEP (IN "clicktofocus" MODE) TO GIVE KEYBOARD FOCUS TO POPUP WINDOW:

(THIS EXTRA CODE NOT NEEDED ON OTHER W/Ms - (TESTED & CONFIRMED ON fluxbox, icewm, jwm, and wmii)

AS DOES TRANSFER KEYBOARD FOCUS FROM THE PARENT WINDOW TO NOWHERE, WHEREIS IT SHOULD (IMO) GIVE IT TO THE POPUP WINDOW.

if ($ENV{DESKTOP_SESSION} =~ /AfterStep version 2.2.1[2-9]/io) { #JWT:ADDED 20140606 TO GET AFTERSTEP TO GIVE "TRANSIENT" WINDOWS THE FOCUS?!

$textPopup->waitVisibility; #GREATLY REDUCES THE REQUIRED DELAY!

select(undef, undef, undef, 0.3); #FANCY QUICK-NAP FUNCTION TO ADDRESS AS "FOCUS TIMING ISSUE"!

NOTE: A DELAY OF 0.05 SEEMS TO SUFFICE IF POPUP INVOKED BY MOUSECLICK, BUT 0.3 (OR MORE) SEEMS TO BE NEEDED FOR KEYBOARD ACTIVATION.

}

$getText->focus();       #INITIAL FIELD WE WANT FOCUSED.
$textPopup->waitWindow;  #WAIT HERE FOR USER RESPONSE!!!

}

END

APPLICABLE "feel" SETTINGS

AutoReverse 0 AutoTabThroughDesks KeepIconWindows NoFollowTitleChanges HonorTransientHints NoExtWMHints HonorGroupHints ClickToFocus 1 MenuMiniPixmaps 0 IconTitle CirculateSkipIcons ClickTime 150 OpaqueMove 25 OpaqueResize 25 EdgeScroll 10 10 EdgeResistance 500 4 WindowEdgeAttraction 5 ScreenEdgeAttraction 0 HonorPPosition

this window box prevents windows from being random-placed under WinList :

WindowBox "mywinlist" Area 1920x1048+0+0 FirstTry SmartPlacement ThenTry RandomPlacement ~WindowBox DefaultWindowBox "mywinlist"

SHOULD I USE THIS?!

BackingStore SaveUnders RecentMenuItems 5 DecorateTransients CoverAnimationSteps 6 CoverAnimationType 10

Mouse 3 R A PopUp "0" 0 Mouse 2 R A WindowList "0" Key Menu A A Popup "Start Menu" 0 Key Pause A A Exec "xscreensaver" exec xscreensaver-command -lock

APPLICABLE "look" SETTINGS

KillBackgroundThreshold 10000 CoverAnimationSteps 0 DecorateFrames 1

APPLICABLE database SETTINGS

Style "*" Icon AfterStep.as.xpm, WindowBox mywinlist, FocusOnMap

Remmy commented 9 years ago

Jim, can I have your email address? (You may send it to remco@webconquest.com). I have some additional questions related to my ignorance of things, and not on topic for this report.

wildstar84 commented 9 years ago

Any updates on this, did you get my reply w/my address? I thought you had some additional ?s. I noticed that there's a new AS out on Debian (v2.2.12-5), I tested it out on my test box & no change.

Jim