@@ -14,7 +14,6 @@ var ThumbnailsBoxOverride = class {
1414 this . thumbnailsBox = thumbnailsBox ;
1515 this . overrideProperties = [
1616 '_activateThumbnailAtPoint' ,
17- '_activeWorkspaceChanged' ,
1817 'allocate' ,
1918 'handleDragOver' ,
2019 'get_preferred_height' ,
@@ -87,7 +86,7 @@ var ThumbnailsBoxOverride = class {
8786 // Overriding the switch to workspace method
8887 // triggered on clicking a workspace thumbnail in the thumbnailbox of the overview
8988 _activateThumbnailAtPoint ( stageX , stageY , time ) {
90- let [ r , x , y ] = this . transform_stage_point ( stageX , stageY ) ;
89+ let [ , x , y ] = this . transform_stage_point ( stageX , stageY ) ;
9190
9291 let thumbnail = this . _thumbnails . find ( t => {
9392 let [ w , h ] = t . get_transformed_size ( ) ;
@@ -99,31 +98,6 @@ var ThumbnailsBoxOverride = class {
9998 }
10099 }
101100
102- // Overriding the Tweener animation to consider both vertical and horizontal changes
103- // the original method only animates vertically
104- _activeWorkspaceChanged ( wm , from , to , direction ) {
105- let workspaceManager = global . workspace_manager ;
106- let activeWorkspace = workspaceManager . get_active_workspace ( ) ;
107- let thumbnail = this . _thumbnails . find ( t => t . metaWorkspace == activeWorkspace ) ;
108- let [ thumbX , thumbY ] = thumbnail . get_position ( ) ;
109-
110- this . _animatingIndicator = true ;
111-
112- //todo: this code should animate x & y, but for some reason it is not
113- this . _indicator . ease ( {
114- thumbX,
115- thumbY,
116- duration : WorkspacesView . WORKSPACE_SWITCH_TIME ,
117- mode : Clutter . AnimationMode . EASE_OUT_QUAD ,
118- onComplete : ( ) => {
119- this . _animatingIndicator = false ;
120- this . indicator_x = thumbX ;
121- this . indicator_y = thumbY ;
122- this . _queueUpdateStates ( ) ;
123- }
124- } ) ;
125- }
126-
127101 // It is helpful to be able to control the height
128102 // however, this method is not being called for some reason
129103 get_preferred_height ( forWidth ) {
@@ -147,8 +121,8 @@ var ThumbnailsBoxOverride = class {
147121 let totalSpacingX = ( this . getColumns ( ) - 1 ) * spacing ;
148122 let totalSpacingY = ( this . getRows ( ) - 1 ) * spacing ;
149123
150- let availY = forHeight - totalSpacingY ;
151- let scale = availY < 0 ? MAX_THUMBNAIL_SCALE : ( availY / this . getRows ( ) ) / this . _porthole . height ;
124+ let availY = Math . max ( 0 , forHeight - totalSpacingY ) ;
125+ let scale = ( availY / this . getRows ( ) ) / this . _porthole . height ;
152126 scale = Math . min ( scale , MAX_THUMBNAIL_SCALE ) ;
153127
154128 let width = Math . round ( totalSpacingX + this . getColumns ( ) * this . _porthole . width * scale ) ;
@@ -168,7 +142,7 @@ var ThumbnailsBoxOverride = class {
168142 allocate ( box , flags ) {
169143 this . _overrideProperties . allocate ( box , flags ) ;
170144
171- let rtl = ( Clutter . get_default_text_direction ( ) == Clutter . TextDirection . RTL ) ;
145+ let rtl = Clutter . get_default_text_direction ( ) == Clutter . TextDirection . RTL ;
172146
173147 if ( this . _thumbnails . length == 0 ) // not visible
174148 return ;
@@ -315,30 +289,33 @@ var ThumbnailsBoxOverride = class {
315289
316290 // Handle dragging a window into a workspace
317291 handleDragOver ( source , actor , x , y , time ) {
318- if ( ! source . realWindow && ! source . shellWorkspaceLaunch && source != Main . xdndHandler )
292+ if ( ! source . realWindow &&
293+ ( ! source . app || ! source . app . can_open_new_window ( ) ) &&
294+ ( source . app || ! source . shellWorkspaceLaunch ) &&
295+ source != Main . xdndHandler )
319296 return DND . DragMotionResult . CONTINUE ;
320297
321298 let canCreateWorkspaces = Meta . prefs_get_dynamic_workspaces ( ) ;
322299 let spacing = this . get_theme_node ( ) . get_length ( 'spacing' ) ;
323300
324301 this . _dropWorkspace = - 1 ;
325302 let placeholderPos = - 1 ;
326- let targetBaseY ;
303+ let targetBase ;
327304 if ( this . _dropPlaceholderPos == 0 )
328- targetBaseY = this . _dropPlaceholder . y ;
305+ targetBase = this . _dropPlaceholder . y ;
329306 else
330- targetBaseY = this . _thumbnails [ 0 ] . y ;
331- let targetTop = targetBaseY - spacing - WorkspaceThumbnail . WORKSPACE_CUT_SIZE ;
307+ targetBase = this . _thumbnails [ 0 ] . y ;
308+ let targetTop = targetBase - spacing - WorkspaceThumbnail . WORKSPACE_CUT_SIZE ;
332309
333310 let length = this . _thumbnails . length ;
334311 for ( let i = 0 ; i < length ; i ++ ) {
335312 // Allow the reorder target to have a 10px "cut" into
336313 // each side of the thumbnail, to make dragging onto the
337314 // placeholder easier
338315 let [ w , h ] = this . _thumbnails [ i ] . get_transformed_size ( ) ;
339- let targetBottom = targetBaseY + WorkspaceThumbnail . WORKSPACE_CUT_SIZE ;
340- let nextTargetBaseY = targetBaseY + h + spacing ;
341- let nextTargetTop = nextTargetBaseY - spacing - ( ( i == length - 1 ) ? 0 : WorkspaceThumbnail . WORKSPACE_CUT_SIZE ) ;
316+ let targetBottom = targetBase + WorkspaceThumbnail . WORKSPACE_CUT_SIZE ;
317+ let nextTargetBase = targetBase + h + spacing ;
318+ let nextTargetTop = nextTargetBase - spacing - ( ( i == length - 1 ) ? 0 : WorkspaceThumbnail . WORKSPACE_CUT_SIZE ) ;
342319
343320 // Expand the target to include the placeholder, if it exists.
344321 if ( i == this . _dropPlaceholderPos )
@@ -354,7 +331,7 @@ var ThumbnailsBoxOverride = class {
354331 break
355332 }
356333
357- targetBaseY = nextTargetBaseY ;
334+ targetBase = nextTargetBase ;
358335 targetTop = nextTargetTop ;
359336 }
360337
@@ -364,7 +341,7 @@ var ThumbnailsBoxOverride = class {
364341 }
365342
366343 if ( this . _dropWorkspace != - 1 )
367- return this . _thumbnails [ this . _dropWorkspace ] . handleDragOverInternal ( source , time ) ;
344+ return this . _thumbnails [ this . _dropWorkspace ] . handleDragOverInternal ( source , actor , time ) ;
368345 else if ( this . _dropPlaceholderPos != - 1 )
369346 return source . realWindow ? DND . DragMotionResult . MOVE_DROP : DND . DragMotionResult . COPY_DROP ;
370347 else
0 commit comments