Re: Which function is called when an app is selected in AppDisplay by hitting the return key?



Am 24.09.2012 20:35, schrieb Jasper St. Pierre:
On Mon, Sep 24, 2012 at 2:27 PM, Bazon Bloch <bazonbloch arcor de> wrote:
Hello,

ABSTRACT:

Which function is called when an app is selected in the AppDisplay by
hitting the return/enter key?
It seems to make a difference whether the app is activated by mouse click or
return key. I got the function for the mouse click, but I'm looking for the
return key function.



DETAILED QUESTION:

The reason why I am asking: The following user request for my "Workspace
Separation On Dash" Extension
(https://extensions.gnome.org/extension/440/workspace-separation-on-dash/):

calebtom87 wrote:
"I don't know if this is more of a feature request or a bug report: It works
great for clicking icons. It even works when I type in what I want and then
click the icon, but if I hit enter to launch my program it will still switch
work spaces. "


I prevent that workspace change by a modified version of the _onActivate
function in /usr/share/gnome-shell/js/ui/appDisplay.js, originally only in
order to prevent Workspace-Change by Dash-Clicks.

For reference, here is my modified version of that function:

/**
  * Modified version of the function in
/usr/share/gnome-shell/js/ui/appDisplay.js
  */
function  _onActivate(event) {

     // Added: First check, whether the application is running on the current
workspace
     let windows = this.app.get_windows();
     let activeWorkspace = global.screen.get_active_workspace();
     let isoncurrentworkspace=0;

     for (let i = 0; i < windows.length; i++) {
             if (windows[i].get_workspace() == activeWorkspace) {
         isoncurrentworkspace=1;
             }
         }

     //original function again:
         this.emit('launching');
         let modifiers = event.get_state();

         if (this._onActivateOverride) {
             this._onActivateOverride(event);
         } else {
             if (modifiers & Clutter.ModifierType.CONTROL_MASK
                 && this.app.state == Shell.AppState.RUNNING) {
                 this.app.open_new_window(-1);
             } else {
         // edited from original here: If not on current workspace, launch a
new instance
         if (isoncurrentworkspace) {
                     this.app.activate();
         } else {
             this.app.open_new_window(-1);
         }
             }
         }
         Main.overview.hide();
     }


So how can I have the same effect, also for selecting an app by hitting the
return key?
I searched, by had no success in finding the corresponding function.
http://git.gnome.org/browse/gnome-shell/tree/src/st/st-button.c#n204

Depressing the "enter" button will send a button press 1, and
releasing it will send a button release 1. The actor needs to be
focused, though.

Thanks, but unfortunately, I can't see a connection to the workspace-change-event caused by that in the overview-appdisplay... The closest thing I can find in appDisplay.js is the function AppWellIcon._onButtonPress(actor, event), but again, this function is only called, when the search result is clicked by the mouse button, not if just the return key is hit....



thanks,
Bazon
_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]