Skip to content

Commit

Permalink
Merge pull request #1211 from autarkper/scale-tuning
Browse files Browse the repository at this point in the history
[Scale; 1.8] Fine-tune some aspects of Scale
  • Loading branch information
clefebvre committed Nov 21, 2012
2 parents 74925a0 + 961dec4 commit 069a4a1
Show file tree
Hide file tree
Showing 13 changed files with 933 additions and 1,882 deletions.
26 changes: 3 additions & 23 deletions data/theme/cinnamon.css
Expand Up @@ -439,29 +439,9 @@ StScrollBar StButton#vhandle:hover {
background-gradient-end: #AAA;
background-gradient-direction: vertical
}
/* ===================================================================
* ViewSelector
* ===================================================================*/
#viewSelector {
spacing: 1em;
font-size: 12pt;
}
#viewSelectorTabBar {
padding: 1em;
}
.view-tab-title {
color: #888a85;
font-weight: bold;
padding: 0px 0.75em;
height: 1.5em;
}
.view-tab-title:hover {
color: #bbb;
}
.view-tab-title:selected {
color: #000000;
background-color: #c2c7cd;
border-radius: 0.25em;

.workspace-overview-background-shade {
background-color: rgba(0,0,0,0.4);
}
/* ===================================================================
* Looking Glass
Expand Down
3 changes: 2 additions & 1 deletion js/Makefile.am
Expand Up @@ -7,9 +7,11 @@ nobase_dist_js_DATA = \
misc/fileUtils.js \
misc/format.js \
misc/gnomeSession.js \
misc/gridNavigator.js \
misc/history.js \
misc/modemManager.js \
misc/params.js \
misc/pointerTracker.js \
misc/screenSaver.js \
misc/util.js \
perf/core.js \
Expand Down Expand Up @@ -62,7 +64,6 @@ nobase_dist_js_DATA = \
ui/themeManager.js \
ui/tooltips.js \
ui/tweener.js \
ui/viewSelector.js \
ui/windowAttentionHandler.js \
ui/windowManager.js \
ui/workspace.js \
Expand Down
64 changes: 64 additions & 0 deletions js/misc/gridNavigator.js
@@ -0,0 +1,64 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
const Clutter = imports.gi.Clutter;

function nextIndex(itemCount, numCols, currentIndex, symbol) {
let result = -1;
if (itemCount > 3 // grid navigation is not suited for a low item count
&& (symbol === Clutter.Down || symbol === Clutter.Up))
{
let numRows = Math.ceil(itemCount/numCols);

let curRow = Math.floor(currentIndex/numCols);
let curCol = currentIndex % numCols;

let calcNewIndex = function(rowDelta) {
let newIndex = (curRow + rowDelta) * numCols + curCol;
if (rowDelta >= 0) { // down
return newIndex < itemCount ?
newIndex :
curCol < numCols - 1 ?
// wrap to top row, one column to the right:
curCol + 1 :
// wrap to top row, left-most column:
0;
}
else { // up
let numFullRows = Math.floor(itemCount/numCols);
let numIOILR = itemCount % numCols; //num Items on Incompl. Last Row
return newIndex >= 0 ?
newIndex :
curCol === 0 ?
// Wrap to the bottom of the right-most column, may not be on last row:
(numFullRows * numCols) - 1 :
/* If we're on the
top row but not in the first column, we want to move to the bottom of the
column to the left, even though that may not be the bottom of the grid.
*/
numIOILR && curCol > numIOILR ?
((numFullRows - 1) * numCols) + curCol - 1:
((numRows - 1) * numCols) + curCol - 1;
}
};

if (symbol === Clutter.Down) {
result = calcNewIndex(1);
}
if (symbol === Clutter.Up) {
result = calcNewIndex(-1);
}
}
else if (symbol === Clutter.Left || symbol === Clutter.Up) {
result = (currentIndex < 1 ? itemCount : currentIndex) - 1;
}
else if (symbol === Clutter.Right || symbol === Clutter.Down) {
result = (currentIndex + 1) % itemCount;
}
else if (symbol === Clutter.Home) {
result = 0;
}
else if (symbol === Clutter.End) {
result = itemCount - 1;
}
return result;
}
21 changes: 21 additions & 0 deletions js/misc/pointerTracker.js
@@ -0,0 +1,21 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
const Gdk = imports.gi.Gdk;

const PointerTracker = new Lang.Class({
Name: 'PointerTracker',
_init: function() {
let display = Gdk.Display.get_default();
let deviceManager = display.get_device_manager();
let pointer = deviceManager.get_client_pointer();
let [lastScreen, lastPointerX, lastPointerY] = pointer.get_position();
this.hasMoved = function() {
let [screen, pointerX, pointerY] = pointer.get_position();
try {
return !(screen == lastScreen && pointerX == lastPointerX && pointerY == lastPointerY);
} finally {
[lastScreen, lastPointerX, lastPointerY] = [screen, pointerX, pointerY];
}
}
}
});
9 changes: 0 additions & 9 deletions js/perf/core.js
Expand Up @@ -110,15 +110,6 @@ function run() {

Main.overview.show();
yield Scripting.waitLeisure();

for (let i = 0; i < 2; i++) {
Scripting.scriptEvent('applicationsShowStart');
Main.overview._viewSelector.switchTab('applications');
yield Scripting.waitLeisure();
Scripting.scriptEvent('applicationsShowDone');
Main.overview._viewSelector.switchTab('windows');
yield Scripting.waitLeisure();
}
}

let showingOverview = false;
Expand Down
18 changes: 17 additions & 1 deletion js/ui/main.js
Expand Up @@ -241,7 +241,7 @@ function start() {
layoutManager = new Layout.LayoutManager();
xdndHandler = new XdndHandler.XdndHandler();
// This overview object is just a stub for non-user sessions
overview = new Overview.Overview({ isDummy: false });
overview = new Overview.Overview();
expo = new Expo.Expo({ isDummy: false });
magnifier = new Magnifier.Magnifier();
statusIconDispatcher = new StatusIconDispatcher.StatusIconDispatcher();
Expand Down Expand Up @@ -416,6 +416,20 @@ function _removeWorkspace(workspace) {
return true;
}

function moveWindowToNewWorkspace(metaWindow, switchToNewWorkspace) {
if (switchToNewWorkspace) {
let targetCount = global.screen.n_workspaces + 1;
let nnwId = global.screen.connect('notify::n-workspaces', function() {
global.screen.disconnect(nnwId);
if (global.screen.n_workspaces === targetCount) {
let newWs = global.screen.get_workspace_by_index(global.screen.n_workspaces - 1);
newWs.activate(global.get_current_time());
}
});
}
metaWindow.change_workspace_by_index(global.screen.n_workspaces, true, global.get_current_time());
}

function _staticWorkspaces() {
let i;
let dif = nWorks - global.screen.n_workspaces;
Expand Down Expand Up @@ -537,8 +551,10 @@ function _queueCheckWorkspaces() {
}

function _nWorkspacesChanged() {
nWorks = global.screen.n_workspaces;
if (!dynamicWorkspaces)
return false;

let oldNumWorkspaces = _workspaces.length;
let newNumWorkspaces = global.screen.n_workspaces;

Expand Down

0 comments on commit 069a4a1

Please sign in to comment.