Commit Graph

40 Commits

Author SHA1 Message Date
Dan Winship
75b824d032 *.js: Make emacs modelines consistent
js2-mode is no longer developed and we recommend js-mode these days,
so switch the modelines to specify that, and make them consistent
across all files.

https://bugzilla.gnome.org/show_bug.cgi?id=660358
2011-10-11 08:05:12 -04:00
Adel Gadllah
64e7459d1c dnd: Reparent drag actor to the uiGroup rather then the stage 2011-06-30 21:13:15 +02:00
Florian Müllner
737f395d6c dnd: Rename DND.removeMonitor() to DND.removeDragMonitor()
DND.addDragMonitor() and DND.removeMonitor() are inconsistently
named, so rename the latter.

https://bugzilla.gnome.org/show_bug.cgi?id=652730
2011-06-27 21:39:28 +02:00
Maxim Ermilov
d38f41a459 dnd: If needed, destroy _dragActor in _cancelDrag
In the case where the original actor is destroyed, we don't
show a snap back animation, so we need to destroy drag actor
as we would do in _onAnimationComplete.

https://bugzilla.gnome.org/show_bug.cgi?id=640781
2011-03-21 17:39:42 -04:00
Alexander Larsson
a80e88e33e dnd: Add a drag-cancelled signal
This lets us start the workspace zoom out animation right when the
snapback starts, rather than waiting for the snapback to finish.

https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-09 10:36:09 +01:00
Alexander Larsson
72120bb87f dnd: Avoid division by zero, etc for zero-size actors
When rescaling due to a possible parent actor resize avoid problems
if the parent width is zero.

https://bugzilla.gnome.org/show_bug.cgi?id=643786
2011-03-09 10:27:36 +01:00
Owen W. Taylor
36287fc33b Fix hover state after DND
During a drag-and-drop, our pointer grab keeps enter/leave events from
being delivered. That means that after the DND ends, whatever actor is
under the pointer won't have received the enter event it should have,
and any state or hover effect dependent on that won't work right.
By paying attention to the actors we leave and enter we can figure out
what widgets we need to call st_widget_sync_hover() on after the drag.

https://bugzilla.gnome.org/show_bug.cgi?id=640974
2011-03-07 16:53:56 -05:00
Adel Gadllah
7c534a87cf dnd: Don't pass null to ClutterActor.disconnect()
_ungrabActor disconnects the event signal handler but does not
check whether it is connected before doing so which can result into
an exception like:

JS ERROR: !!!   Exception was: Error: disconnect() takes one arg, the signal handler id
JS ERROR: !!!     lineNumber = '0'
JS ERROR: !!!     fileName = 'gjs_throw'
JS ERROR: !!!     stack = 'Error("disconnect() takes one arg, the signal handler id")@:0
2011-02-28 22:41:11 +01:00
Owen W. Taylor
75f771d736 dnd: Fix bug in computation of snap-back position
We were properly accounting for the fact that an ancestor of the
parent could be scaled rather than the parent itself when computing
the snap-back scale, but directly using parent.scale_x for the
snap-back location.

https://bugzilla.gnome.org/show_bug.cgi?id=642117
2011-02-11 12:34:15 -05:00
Dan Winship
c86a977564 St: drop StClickable, add some functionality to StButton
For historical reasons, we had both StClickable and StButton, which
were nearly identical. StButton was more widely-used, so keep that and
port all StClickable users to that.

https://bugzilla.gnome.org/show_bug.cgi?id=640583
2011-02-07 12:45:48 -05:00
Maxim Ermilov
65f0b483f8 messageTray: make links in message banners clickable
https://bugzilla.gnome.org/show_bug.cgi?id=610219
2010-11-24 02:38:08 +03:00
Dan Winship
b7c1400eb3 dnd: fix a case where ungrabEvents wasn't being called
If the drag actor is destroyed as part of a drag target accepting it,
we were not calling ungrabEvents, meaning the mouse/keyboard remained
grabbed until you clicked somewhere to cancel it.

This fixes that without trying to improve the extremely confusing
control flow...

https://bugzilla.gnome.org/show_bug.cgi?id=635278
2010-11-19 15:09:57 -05:00
Dan Winship
b956c6f093 dnd: when snapping back, deal with moved/rescaled parents
Previously, when snapping back a drag actor, we moved it back to its
original stage-relative position and scale. This worked fine if its
parent was still in the same place it was when the drag started, but
failed in cases like the linear workspace layout window drag-and-drop,
where dragging a window would "zoom out" its parent workspace, causing
the snapback to send it to the wrong place.

Fix this by instead snapping the actor back to "where the actor would
have been right now if it were still at its original scale and
position within its original parent actor" rather than "where it was
before the drag started"

https://bugzilla.gnome.org/show_bug.cgi?id=635272
2010-11-19 15:09:57 -05:00
Florian Müllner
be6e189b49 dnd: Hide drag actor from pick
Instead of hiding the drag actor temporarily to determine the actor
beneath it, make it invisible to picks while dragging using the new
shell_util_set_hidden_from_pick().

https://bugzilla.gnome.org/show_bug.cgi?id=634560
2010-11-18 20:27:55 +01:00
Maxim Ermilov
95ac478f87 dnd: Handle destruction of drag actor during drag
The shell crashes if the drag actor is destroyed during the drag
operation. Cancel the drag gracefully in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=620389
2010-10-24 05:47:54 +04:00
Maxim Ermilov
38c3422331 [DND] change cursor when dragging
Return a DND.DragMotionResult constant from delegate _handleDragMotion
methods as well as the existing return value from the drag monitor method dragMotion.
https://bugzilla.gnome.org/show_bug.cgi?id=607821
2010-09-10 06:00:28 +04:00
Florian Müllner
c50e324366 [dnd] Add monitoring hooks for motion/drop events
Sometimes it is desirable to be able to react to DND events that
happen outside a target actor's bounds, e.g. to implement reactive
screen edges. Add a simple interface which allows to hook into
drag motion and drop handling without jumping through ugly hoops.

https://bugzilla.gnome.org/show_bug.cgi?id=620504
2010-06-16 20:56:09 +02:00
Florian Müllner
b3794f1c17 [linearView] Fix dnd to dash when zoomed out
While zoomed out, the workspaces view's drop target spans the entire
monitor to implement reactive screen edges. When a drop event is not
handled by the view, an attempt is made to pass it on down the stack,
but it doesn't work properly. Fix it by iterating the target's parents
as well.
Also improve the code which translates dnd coordinates to target
positions.

https://bugzilla.gnome.org/show_bug.cgi?id=619203
2010-05-27 12:12:10 +02:00
Florian Müllner
3e2a9a57a1 [dnd] Optionally restore the drag actor
Currently, the drag and drop code assumes that on a successful drop
the target will either consume the drag actor or that it is otherwise
OK to destroy the actor.
As the drag behavior for window preview was changed, dropping a preview
on the dash now results in the preview being swallowed - to fix, add an
option to restore the actor in case of a successful drop as well.

https://bugzilla.gnome.org/show_bug.cgi?id=619203
2010-05-26 14:06:53 +02:00
Dan Winship
8b242dd4bd minor js cleanups
add missing semicolons pointed out by js2-mode, add missing emacs
modelines, fix a few tabs that crept in via cut+paste
2010-05-19 13:26:41 -04:00
Marina Zhurakhinskaya
703b21cef0 Don't use double quotes for things that don't need to be translated
This is our convention.

The only exceptions are double quotes for words in comments that give
them a special meaning (though beware that these quotes are not truly
necessary most of the time) and double quotes that need to be a part
of the output string.
2010-05-13 16:00:38 -04:00
Joseph Scheuhammer
62afd2ffa3 Reorganize stage in terms of a UI Group actor and everything else
In preparation for adding magnification, "uiGroup.patch", organizes the stage
along the following lines:

Stage
  *Magnifier
  UI group
    Window group
    Chrome group
    Overlay group
    Alt tab
    App display
    Chrome
    ...

This allows a magnifier actor to clone and magnify the UI group.  The magnifier
is a sibling of the UI Group in this stage oraganization -- see the next patch,
"Magnifier.patch".
2010-05-06 17:18:10 -04:00
Florian Müllner
04200a4281 [dnd] Special-case St.Clickable
Currently manual dnd mode is used with St.Clickable to avoid messing
up its internal state with a pointer grab. To avoid code duplication,
move this special handling into dnd.

https://bugzilla.gnome.org/show_bug.cgi?id=610385
2010-03-29 17:45:57 +02:00
Owen W. Taylor
94472ba9fa [DND] Allow setting drag actor max size and opacity
Add parameters to DND.makeDraggable:

 dragActorMaxSize: Maximum size for actor drag icon
 dragActorOpacity: Opacity of actor during drag

https://bugzilla.gnome.org/show_bug.cgi?id=613367
2010-03-23 11:32:16 -04:00
Owen W. Taylor
dfb110cd0f [DND] Use Params for DND.makeDraggable()
Replace boolean 'manualMode' with a params object for
improved readability and future expansion.

https://bugzilla.gnome.org/show_bug.cgi?id=613367
2010-03-23 11:32:16 -04:00
Maxim Ermilov
46bce04788 Fix JSObject leak in workspace.js
https://bugzilla.gnome.org/show_bug.cgi?id=612318
2010-03-18 03:27:42 +03:00
Colin Walters
7d8c3f1ecd Ensure our drag actor is positioned over the cursor
Previously we were looking at the source size, which is
not necessarily the same as the drag actor size.

https://bugzilla.gnome.org/show_bug.cgi?id=607821
2010-03-16 10:59:42 -04:00
Maxim Ermilov
765779272f Look at current mouse position for dropping
Previously we used the top-left corner which was not intuitive,
particularly when dragging partially opaque actors.
https://bugzilla.gnome.org/show_bug.cgi?id=607821
2010-03-09 01:53:27 +03:00
Colin Walters
8b3258cb09 Revert "Clean up definition of dragOffsetX, dragOffsetY"
This reverts commit aa7de264e6.
2010-03-05 16:57:09 -05:00
Colin Walters
aa7de264e6 Clean up definition of dragOffsetX, dragOffsetY
These variables were computed strangely; through cancellation
they'd end up being negative 1/2 the width/height of the actor,
so just use that directly.

https://bugzilla.gnome.org/show_bug.cgi?id=607821
2010-03-05 15:29:29 -05:00
Dan Winship
ed75f0da63 [dnd] revert the change to only allow dropping on reactive actors
Workspace.actor is non-reactive, and there's probably some good reason
for this. So just have the add workspace button check its own reactivity.
2010-01-20 14:01:37 -05:00
Dan Winship
88737b2083 [dnd] Don't allow dropping on non-reactive actors 2010-01-18 14:58:31 -05:00
Marina Zhurakhinskaya
6cae94edcc Bug 594916 - Allow cancelling DND by hitting Esc
Esc used to close the overview and get the DND actor stuck on the desktop when
it was pressed when dragging.
2009-09-22 16:15:28 -04:00
Colin Walters
1a834f7d8b Add API to programmatically initiate a drag
For some use cases we have other behavior on mouse press and want
to manually control when a drag starts.  Split out the drag initiation
code into startDrag.
2009-09-02 14:34:57 -04:00
Colin Walters
dd1a309cb6 dnd: Centralize drag actor positioning code, use shellWorkspaceLaunch for workspaces
We had multiple copies of the code to position a drag actor given a particular
source.  Instead, just put it inside dnd.js.

Second, rather than test for GenericDisplay/WellDisplayItem etc.,
in various places, add a new method on each source "shellWorkspaceLaunch"
which both marks the item as being droppable on a workspace, and is
called by the workspaces code to launch the item.
2009-08-20 19:37:50 -04:00
Colin Walters
3c87d76741 dnd: Fix used of undefined variables
The variables this._yOffset and this._xOffset are included in the
drop coordinates, but as far as I can tell never defined.  Looking
back on the commit that introduced this code, they weren't removed
from anywhere else either.

The drop coordinates seem correct without them, so just delete them.
2009-08-08 10:09:30 -04:00
Colin Walters
c23b9ee192 dnd: Emit drag-end in after snapback complete
Emit the signal at the correct time to take action
on snapback (i.e. after the end of the snapback animation).

Add a boolean to the drag-end signal saying whether it was accepted,
which ensures consumers know whether the drag was successful.
2009-08-07 13:29:34 -04:00
Owen W. Taylor
2c7d33bad2 Port gnome-shell to the Clutter-1.0 API
- clutter_actor_get_transformed_position()/size() return floats
- clutter_stage_get_actor_at_pos() takes a pick mode
- ClutterTimeline no longer has a concept of frames
- ClutterUnit is now replaced by float
- cogl_texture_new_from_data() signature changed

http://bugzilla.gnome.org/show_bug.cgi?id=585013
2009-06-08 13:49:53 -04:00
Marina Zhurakhinskaya
39eb563687 Bug 574697 - Slide the workspaces back in if the user starts dragging a document or an application item in the expanded display mode
Sliding the workspaces back in when the user starts dragging an item in the
expanded display mode allows the user to select a workspace in which the item
should be launched and stay in the overlay mode.

This patch adds code to dnd.js that handles notifying actors when a drag item is being dragged over them. Overlay code uses such notification to unset expanded display modes and trigger sliding in of the workspaces.

If the drag is cancelled the drag item snaps back to its source or disappears at the original position of its source if the source is no longer displayed.
2009-03-11 15:41:33 -04:00
Dan Winship
11561fd902 Abstract drag-and-drop a bit and add application/recent document DND. #569717 2009-02-10 11:20:48 -05:00