On Tue, May 19, 2015 at 10:51 PM, Ben Coman <b...@openinworld.com> wrote:

>
>
> On Sat, May 16, 2015 at 5:35 PM, Esteban Lorenzano <esteba...@gmail.com>
> wrote:
>
>> my answer on stackoverflow:
>>
>> well... you hit one of our weaker spots :)
>>
>> Keybindings are not in his best shape, but:
>>
>> - Actually, alt+tab is already set to "switch window" activity. The
>> problem is that does not work all the time (for example, it does not work
>> on Playground).
>> - This is because there are some hardcoded logic there, who we are
>> removing slowly from the system (some of those parts have more than 15yrs
>> since they come from before Pharo has born).
>> - Someone (probably in a failed attempt to fix the playground, or the
>> hardcodes) forget a halt in the method who creates a new preview window...
>> so even if you reach that part of the system, you will have a debugger. Of
>> course, you will be able to restore correct behaviour by just removing the
>> breakpoint, but that will not correct the fact "switch windows" will not be
>> available everywhere.
>> - I opened a bug entry for it: https://pharo.fogbugz.com/f/cases/15546,
>> in case you want to follow the issue (you will need an account there, I'm
>> sorry for that).
>>
>> In any case, we are moving out this hardcode stuff, and you can check all
>> currently available settings going to **World Menu/System/Keymap Browser**
>> (they are a lot, we are also playing with ideas on how to show better this
>> combinations... emacs style, popup notifications, etc.)
>>
>> Esteban
>>
>> ps: I will like to have a solution for this, if anyone can help a bit in
>> this area… but it has to be a solution using the keybindings framework. I
>> will deny integration to any hardcoded solution :)
>>
>
> I thought I'd have a look at this (a reason to dip my toe into the
> keybindings framework for the first time). Not sure if I'm heading down the
> right track, but the first part of just responding to key presses was much
> easier than I thought it might be, so I thought there might be general
> interest.
>

Here it is fully working.  Note the correction moving #isGlobal to the
class-side.


>
>
>      KMCategory subclass: #TaskListGlobalShortcut
>   instanceVariableNames: ''
>   classVariableNames: ''
>   category: 'Morphic-Widgets-Taskbar'
>
>    TaskListGlobalShortcut class >> isGlobalCategory "<---whoops,
> correction"
>   ^true
>
>
I discovered that to match existing method names, #selectNextTask was
better than #cycleLeft.

    TaskListGlobalShortcut>>selectNextTask
  <shortcut>
  ^ KMKeymap
     shortcut: $] command
     action: [ World taskList selectNextTask. ]


    TaskListGlobalShortcut>>selectPreviousTask
  <shortcut>
  ^ KMKeymap
     shortcut: $[ command
     action: [ World taskList selectPreviousTask. ]


    NullTaskList>>selectNextTask
  self openTaskList selectNextTask


    NullTaskList>>selectPreviousTask
  self openTaskList selectPreviousTask


    NullTaskList>>openTaskList
  ^ world theme openTaskListIn: world.
        " Adapted from NullTaskList >> handleEvent: "


    UITheme>>openTaskListIn: worldMorph
  | taskListMorph |
  taskListMorph := TaskListMorph new.
  taskListMorph openAsIsIn: worldMorph.
  ^ taskListMorph
        "Adapted from UITheme >> openTaskListIn:from: "


    KMRepository reset.


This was developed on Pharo 4, but I
uploaded SLICE-Issue-15546-alttab-does-not-work-correctly-BenComan.2 to
Pharo5Inbox per policy to integrate there first.   I guess since this is
not mission critical it might be queued for a while for Pharo 4.

Nicolai, I didn't see your slice until after.  I've left some comments on
fogbugz comparing the both slices.

cheers -ben

Reply via email to