After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 580658 - Drag&Drop applications open in wrong workspace
Drag&Drop applications open in wrong workspace
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2009-04-28 21:48 UTC by Igor Vatavuk
Modified: 2009-05-01 20:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set the workspace when launching apps (4.07 KB, patch)
2009-05-01 19:19 UTC, Owen Taylor
reviewed Details | Review

Description Igor Vatavuk 2009-04-28 21:48:59 UTC
Steps to reproduce:
1. Enter the overlay mode
2. Add some workspaces
3. Drag&Drop an application to one workspace, choose an app that opens longer (e.g. evolution and then while the app is still loading "zoom in" on another workspace.

Result:
Application opens in our current workspace.

Expected behaviour:
Application gets launched on the workspace where it was dragged.
Comment 1 Owen Taylor 2009-05-01 19:19:29 UTC
Created attachment 133751 [details] [review]
Set the workspace when launching apps

main.js: Add create_app_launch_context() with code from appDisplay;
  additionally set the workspace on the launch context to the current
  workspace so that the application launches on the right workspace
  even if the user switches before the app starts.

appDisplay.js docDisplay.js: Use Main.create_app_launch_context()

http://bugzilla.gnome.org/show_bug.cgi?id=580658 (Reported by Igor Vatavuk)
Comment 2 Owen Taylor 2009-05-01 19:25:39 UTC
Ah, also, you may notice:

-        let icon = this._appInfo.get_icon();
-        context.set_icon(icon);

Went missing; I removed it because I read the code in GDK and it automatically got the icon from the AppInfo if the AppInfo had an icon.
Comment 3 Dan Winship 2009-05-01 19:36:20 UTC
+    context.set_timestamp(display.get_current_time());

I realize this is just copied from the current code, but wouldn't Clutter.get_current_event_time() be more correct?

Otherwise looks good.
Comment 4 Marina Zhurakhinskaya 2009-05-01 20:09:28 UTC
+    // The app launch context doesn't work as well as we might like because
+    // it doesn't get the right StartupNotify key from the application's
+    // desktop file. So, we don't get startup notification, the application
+    // doesn't stick to the current workspace, and so forth.
+    appInfo.launch([], Main.create_app_launch_context());

This comment is unclear to me. Are you talking about the default app launch context and explaining why we are passing in our own? Perhaps changing "The app launch context" to "The default app launch context" would clarify the situation.

+    // Make sure that the app is opened on the current workspace even if
+    // the user switches before it seetarts
s/seetarts/starts

Otherwise looks good.
Comment 5 Owen Taylor 2009-05-01 20:26:31 UTC
Rewrote the comment to:

// The point of passing an app launch context to launch() is mostly to get
// startup notification and associated benefits like the app appearing
// on the right desktop; but it doesn't really work for now because we aren't
// reading the application's desktop file, and thus don't find the
// StartupNotify=true in it. So, despite passing the app launch context,
// no startup notification occurs.

Hopefully that explains things better. Also fixed the typo.
Comment 6 Owen Taylor 2009-05-01 20:32:46 UTC
(In reply to comment #3)
> +    context.set_timestamp(display.get_current_time());
> 
> I realize this is just copied from the current code, but wouldn't
> Clutter.get_current_event_time() be more correct?

First reply to this got lost due to a bugzilla timeout.

display.get_current_time() gets you a timestamp that is updated every time an event is received on the Metacity display (including events processed by clutter rather than Metacity.)

So I think it's appropriate to use, and would work better then Clutter.get_current_event_time() if you had a launch triggered off a global hotkey or something.