Compare commits

..

13 Commits

Author SHA1 Message Date
Debarshi Ray
28585a817a workspace: Use the schema for the current mode to get 'button-layout'
https://bugzilla.gnome.org/show_bug.cgi?id=689234
2012-11-28 19:25:46 +01:00
Debarshi Ray
8b5d07c1a5 main: Use the schema for the current mode to override 'button-layout'
https://bugzilla.gnome.org/show_bug.cgi?id=689234
2012-11-28 19:25:46 +01:00
Debarshi Ray
6cbdb6beae sessionMode: Define a new foo mode
A new parameter called buttonLayout was introduced to parametrize the
schema used for the 'button-layout' setting.

https://bugzilla.gnome.org/show_bug.cgi?id=689234
2012-11-28 19:25:46 +01:00
Debarshi Ray
b8f9a108f9 data: Add a new schema for foo mode
The foo mode will have a different default value for button-layout as
compared to the standard GNOME 3 mode. To avoid one mode from
overwriting the setting from another, lets use a different schema
for this mode.

https://bugzilla.gnome.org/show_bug.cgi?id=689234
2012-11-28 19:25:46 +01:00
Giovanni Campagna
d517c13d7a Telepathy: ignore errors from ack_all_pending_messages()
Invalid ID errors from that function are normal, because the set
of IDs to acknowledge may not match the set in the connection manager
due to race conditions.
This is also what empathy does.

https://bugzilla.gnome.org/show_bug.cgi?id=683449
2012-11-28 17:46:39 +01:00
Jasper St. Pierre
bb88265d78 workspacesViews: Update new padding rules for workspacesOnlyOnPrimary
Tim Lunn fixed this for the !workspacesOnlyOnPrimary case, but not the
other.
2012-11-27 17:46:53 -05:00
Jasper St. Pierre
858694f4cc wanda: Update code to use Panel.Animation
This simplifies our code tremendously.
2012-11-27 13:25:18 -05:00
Jasper St. Pierre
a46321baa0 panel: Make Animation visible by default
None of the other widget actors hide themselves by default;
that's a GTK+ thing.
2012-11-27 13:25:18 -05:00
Jasper St. Pierre
9808e8ab0d panel: Split off Animation code from AnimatedIcon
This is to share with wanda.
2012-11-27 13:16:30 -05:00
Jasper St. Pierre
7bd7b53845 panel: Remove a bit of duplicated code
The play() method does what we want here.
2012-11-27 13:16:30 -05:00
Cosimo Cecchi
056cfc9dc6 wanda: fix a refactor fallout
load_sliced_image() would need an additional parameter, but fold the
notify::mapped callback into the load callback while we're at it.
2012-11-27 12:56:40 -05:00
Nilamdyuti Goswami
b7b60d103e Assamese translation updated 2012-11-27 14:41:28 +05:30
Giovanni Campagna
14fd0eb73e StWidget: don't dispose the theme node when destroyed
Theme nodes are interned and shared with other widgets, so they cannot
be disposed, otherwise we blow useful resources, and in particular we
break the parent-child chain.

https://bugzilla.gnome.org/show_bug.cgi?id=689029
2012-11-26 22:59:22 +01:00
26 changed files with 824 additions and 467 deletions

View File

@@ -114,6 +114,14 @@ AC_SUBST([GNOME_KEYBINDINGS_KEYSDIR])
GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_MIN_VERSION])
saved_CFLAGS=$CFLAGS
saved_LIBS=$LIBS
CFLAGS=$GNOME_SHELL_CFLAGS
LIBS=$GNOME_SHELL_LIBS
AC_CHECK_FUNCS(JS_NewGlobalObject XFixesCreatePointerBarrier)
CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS
PKG_CHECK_MODULES(GNOME_SHELL_JS, gio-2.0 gjs-internals-1.0 >= $GJS_MIN_VERSION)
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.8 x11)
PKG_CHECK_MODULES(TRAY, gtk+-3.0)

View File

@@ -54,7 +54,9 @@ keys_in_files = \
$(NULL)
keys_DATA = $(keys_in_files:.xml.in=.xml)
gsettings_SCHEMAS = org.gnome.shell.gschema.xml
gsettings_SCHEMAS = \
org.gnome.shell.gschema.xml \
org.gnome.shell-foo.gschema.xml
@INTLTOOL_XML_NOMERGE_RULE@
@@ -81,7 +83,8 @@ EXTRA_DIST = \
$(menu_DATA) \
$(convert_DATA) \
$(keys_in_files) \
org.gnome.shell.gschema.xml.in.in
org.gnome.shell.gschema.xml.in.in \
org.gnome.shell-foo.gschema.xml.in.in
CLEANFILES = \
gnome-shell.desktop.in \
@@ -91,4 +94,6 @@ CLEANFILES = \
$(gsettings_SCHEMAS) \
gschemas.compiled \
org.gnome.shell.gschema.valid \
org.gnome.shell.gschema.xml.in
org.gnome.shell.gschema.xml.in \
org.gnome.shell-foo.gschema.valid \
org.gnome.shell-foo.gschema.xml.in

View File

@@ -0,0 +1,13 @@
<schemalist>
<schema id="org.gnome.shell-foo.overrides" path="/org/gnome/shell-foo/overrides/"
gettext-domain="@GETTEXT_PACKAGE@">
<key name="button-layout" type="s">
<default>":minimize,close"</default>
<_summary>Arrangement of buttons on the titlebar</_summary>
<_description>
This key overrides the key in org.gnome.desktop.wm.preferences when
running GNOME Shell in Foo mode.
</_description>
</key>
</schema>
</schemalist>

View File

@@ -48,16 +48,18 @@ const AlphabeticalView = new Lang.Class({
style_class: 'vfade' });
this.actor.add_actor(box);
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
let action = new Clutter.PanAction({ interpolate: true });
action.connect('pan', Lang.bind(this, this._onPan));
this.actor.add_action(action);
},
this.actor.connect('notify::mapped', Lang.bind(this,
function() {
if (!this.actor.mapped)
return;
_onPan: function(action) {
let [dist, dx, dy] = action.get_motion_delta(0);
let adjustment = this.actor.vscroll.adjustment;
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
return false;
let adjustment = this.actor.vscroll.adjustment;
let direction = Overview.SwipeScrollDirection.VERTICAL;
Main.overview.setScrollAdjustment(adjustment, direction);
// Reset scroll on mapping
adjustment.value = 0;
}));
},
removeAll: function() {

View File

@@ -730,8 +730,7 @@ const ChatSource = new Lang.Class({
_ackMessages: function() {
// Don't clear our messages here, tp-glib will send a
// 'pending-message-removed' for each one.
this._channel.ack_all_pending_messages_async(Lang.bind(this, function(src, result) {
this._channel.ack_all_pending_messages_finish(result);}));
this._channel.ack_all_pending_messages_async(null);
}
});

View File

@@ -43,6 +43,7 @@ const GrabHelper = new Lang.Class({
this._actors = [];
this._capturedEventId = 0;
this._eventId = 0;
this._keyFocusNotifyId = 0;
this._focusWindowChangedId = 0;
this._ignoreRelease = false;
@@ -76,25 +77,10 @@ const GrabHelper = new Lang.Class({
}
},
_actorInGrabStack: function(actor) {
while (actor) {
for (let i = 0; i < this._grabStack.length; i++) {
let grab = this._grabStack[i];
if (grab.actor == actor)
return i;
}
actor = actor.get_parent();
}
return -1;
},
_isWithinGrabbedActor: function(actor) {
let currentActor = this.currentGrab.actor;
while (actor) {
if (this._actors.indexOf(actor) != -1)
return true;
if (actor == currentActor)
return true;
actor = actor.get_parent();
}
return false;
@@ -104,14 +90,6 @@ const GrabHelper = new Lang.Class({
return this._grabStack[this._grabStack.length - 1] || {};
},
get grabbed() {
return this._grabStack.length > 0;
},
get grabStack() {
return this._grabStack;
},
_findStackIndex: function(actor) {
if (!actor)
return -1;
@@ -193,6 +171,7 @@ const GrabHelper = new Lang.Class({
return false;
this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
this._eventId = global.stage.connect('event', Lang.bind(this, this._onEvent));
}
this._modalCount++;
@@ -209,6 +188,11 @@ const GrabHelper = new Lang.Class({
this._capturedEventId = 0;
}
if (this._eventId > 0) {
global.stage.disconnect(this._eventId);
this._eventId = 0;
}
Main.popModal(this._owner);
global.sync_pointer();
},
@@ -339,24 +323,29 @@ const GrabHelper = new Lang.Class({
if (Main.keyboard.shouldTakeEvent(event))
return false;
if (type == Clutter.EventType.KEY_PRESS &&
event.get_key_symbol() == Clutter.KEY_Escape) {
this.ungrab();
return true;
}
if (button) {
// If we have a press event, ignore the next event,
// which should be a release event.
if (press)
this._ignoreRelease = true;
let i = this._actorInGrabStack(event.get_source()) + 1;
this.ungrab({ actor: this._grabStack[i].actor });
this.ungrab({ actor: this._grabStack[0].actor });
}
return this._modalCount > 0;
},
// We catch 'event' rather than 'key-press-event' so that we get
// a chance to run before the overview's own Escape check
_onEvent: function(actor, event) {
if (event.type() == Clutter.EventType.KEY_PRESS &&
event.get_key_symbol() == Clutter.KEY_Escape) {
this.ungrab();
return true;
}
return false;
},
_onKeyFocusChanged: function() {
let focus = global.stage.key_focus;
if (!focus || !this._isWithinGrabbedActor(focus))

View File

@@ -19,12 +19,6 @@ const STARTUP_ANIMATION_TIME = 0.2;
const KEYBOARD_ANIMATION_TIME = 0.5;
const PLYMOUTH_TRANSITION_TIME = 1;
const MESSAGE_TRAY_PRESSURE_THRESHOLD = 200;
// The maximium amount that the user is allowed to travel
// perpendicular to the barrier before we release the accumulated
// pressure.
const MESSAGE_TRAY_MAX_SKIRT = 100;
const MonitorConstraint = new Lang.Class({
Name: 'MonitorConstraint',
Extends: Clutter.Constraint,
@@ -112,9 +106,9 @@ const LayoutManager = new Lang.Class({
this._keyboardIndex = -1;
this._hotCorners = [];
this._background = null;
this._leftPanelBarrier = null;
this._rightPanelBarrier = null;
this._trayBarrier = null;
this._leftPanelBarrier = 0;
this._rightPanelBarrier = 0;
this._trayBarrier = 0;
this._chrome = new Chrome(this);
@@ -135,8 +129,6 @@ const LayoutManager = new Lang.Class({
this.trayBox = new St.Widget({ name: 'trayBox',
layout_manager: new Clutter.BinLayout() });
this.addChrome(this.trayBox);
this.trayBox.connect('allocation-changed',
Lang.bind(this, this._updateTrayBarrier));
this.keyboardBox = new St.BoxLayout({ name: 'keyboardBox',
reactive: true,
@@ -265,50 +257,24 @@ const LayoutManager = new Lang.Class({
},
_updatePanelBarriers: function() {
if (this._leftPanelBarrier) {
this._leftPanelBarrier.destroy();
this._leftPanelBarrier = null;
}
if (this._rightPanelBarrier) {
this._rightPanelBarrier.destroy();
this._rightPanelBarrier = null;
}
if (this._leftPanelBarrier)
global.destroy_pointer_barrier(this._leftPanelBarrier);
if (this._rightPanelBarrier)
global.destroy_pointer_barrier(this._rightPanelBarrier);
if (this.panelBox.height) {
let primary = this.primaryMonitor;
this._leftPanelBarrier = new Meta.Barrier({ display: global.display,
x1: primary.x, y1: primary.y,
x2: primary.x, y2: primary.y + this.panelBox.height,
directions: Meta.BarrierDirection.POSITIVE_X });
this._rightPanelBarrier = new Meta.Barrier({ display: global.display,
x1: primary.x + primary.width, y1: primary.y,
x2: primary.x + primary.width, y2: primary.y + this.panelBox.height,
directions: Meta.BarrierDirection.NEGATIVE_X });
}
},
_updateTrayBarrier: function() {
let monitor = this.bottomMonitor;
if (this._trayBarrier) {
this._trayBarrier.destroy();
this._trayBarrier = null;
}
if (Main.messageTray) {
this._trayBarrier = new Meta.Barrier({ display: global.display,
x1: monitor.x, x2: monitor.x + monitor.width,
y1: monitor.y + monitor.height - 1, y2: monitor.y + monitor.height - 1,
directions: Meta.BarrierDirection.NEGATIVE_Y });
this._trayPressure = new PressureBarrier(this._trayBarrier,
MESSAGE_TRAY_PRESSURE_THRESHOLD,
MESSAGE_TRAY_MAX_SKIRT);
this._trayPressure.connect('trigger', function() {
Main.messageTray.openTray();
});
this._leftPanelBarrier =
global.create_pointer_barrier(primary.x, primary.y,
primary.x, primary.y + this.panelBox.height,
1 /* BarrierPositiveX */);
this._rightPanelBarrier =
global.create_pointer_barrier(primary.x + primary.width, primary.y,
primary.x + primary.width, primary.y + this.panelBox.height,
4 /* BarrierNegativeX */);
} else {
this._leftPanelBarrier = 0;
this._rightPanelBarrier = 0;
}
},
@@ -1161,69 +1127,5 @@ const Chrome = new Lang.Class({
return false;
}
});
Signals.addSignalMethods(Chrome.prototype);
const PressureBarrier = new Lang.Class({
Name: 'TrayPressure',
_init: function(barrier, pressureThreshold, perpThreshold) {
this._barrier = barrier;
this._pressureThreshold = pressureThreshold;
this._perpThreshold = perpThreshold;
this._getVelocityAndPerp = this._makeGetVelocityAndPerp(barrier);
this._reset(0);
this._barrierHitId = this._barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
},
destroy: function() {
this._barrier.disconnect(this._barrierHitId);
this._barrier = null;
},
_reset: function(eventId) {
this._currentEventId = eventId;
this._currentPressure = 0;
this._perpAccumulator = 0;
},
_makeGetVelocityAndPerp: function(barrier) {
if (barrier.y1 === barrier.y2) {
return function(event) {
return [Math.abs(event.dy), event.dx];
};
} else {
return function(event) {
return [Math.abs(event.dx), event.dy];
};
}
},
_onBarrierHit: function(barrier, event) {
// Event IDs are incremented every time the user stops
// hitting the barrier. So, if the event ID switches,
// reset the current state, and start over.
if (this._currentEventId != event.event_id) {
this._reset(event.event_id);
}
let [velocity, perp] = this._getVelocityAndPerp(event);
this._perpAccumulator += perp;
// If the user travels too far in the direction perpendicular
// to the barrier, start over from scratch -- the user is simply
// trying to skirt along the barrier.
if (Math.abs(this._perpAccumulator) >= this._perpThreshold) {
this._reset(0);
return;
}
this._currentPressure += velocity;
if (this._currentPressure >= this._pressureThreshold) {
this.emit('trigger');
this._reset(0);
}
}
});
Signals.addSignalMethods(PressureBarrier.prototype);

View File

@@ -109,6 +109,8 @@ function start() {
Gio.DesktopAppInfo.set_desktop_env('GNOME');
sessionMode = new SessionMode.SessionMode();
Meta.prefs_override_preference_schema(sessionMode.buttonLayout[0], sessionMode.buttonLayout[1]);
shellDBusService = new ShellDBus.GnomeShell();
shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();

View File

@@ -40,6 +40,11 @@ const LONGER_HIDE_TIMEOUT = 0.6;
// range from the point where it left the tray.
const MOUSE_LEFT_ACTOR_THRESHOLD = 20;
// Time the user needs to leave the mouse on the bottom pixel row to open the tray
const TRAY_DWELL_TIME = 1000; // ms
// Time resolution when tracking the mouse to catch the open tray dwell
const TRAY_DWELL_CHECK_INTERVAL = 100; // ms
const IDLE_TIME = 1000;
const State = {
@@ -1436,6 +1441,7 @@ const MessageTray = new Lang.Class({
this._clickedSummaryItem = null;
this._clickedSummaryItemMouseButton = -1;
this._clickedSummaryItemAllocationChangedId = 0;
this._pointerBarrier = 0;
this._closeButton = makeCloseButton();
this._closeButton.hide();
@@ -1531,6 +1537,12 @@ const MessageTray = new Lang.Class({
this._summaryItems = [];
this._chatSummaryItemsCount = 0;
let pointerWatcher = PointerWatcher.getPointerWatcher();
pointerWatcher.addWatch(TRAY_DWELL_CHECK_INTERVAL, Lang.bind(this, this._checkTrayDwell));
this._trayDwellTimeoutId = 0;
this._trayDwelling = false;
this._trayDwellUserTime = 0;
this._sessionUpdated();
this._updateNoMessagesLabel();
},
@@ -1560,7 +1572,52 @@ const MessageTray = new Lang.Class({
this._updateState();
},
openTray: function() {
_checkTrayDwell: function(x, y) {
let monitor = Main.layoutManager.bottomMonitor;
let shouldDwell = (x >= monitor.x && x <= monitor.x + monitor.width &&
y == monitor.y + monitor.height - 1);
if (shouldDwell) {
// We only set up dwell timeout when the user is not hovering over the tray
// (!this.actor.hover). This avoids bringing up the message tray after the
// user clicks on a notification with the pointer on the bottom pixel
// of the monitor. The _trayDwelling variable is used so that we only try to
// fire off one tray dwell - if it fails (because, say, the user has the mouse down),
// we don't try again until the user moves the mouse up and down again.
if (!this._trayDwelling && !this.actor.hover && this._trayDwellTimeoutId == 0) {
// Save the interaction timestamp so we can detect user input
let focusWindow = global.display.focus_window;
this._trayDwellUserTime = focusWindow ? focusWindow.user_time : 0;
this._trayDwellTimeoutId = Mainloop.timeout_add(TRAY_DWELL_TIME,
Lang.bind(this, this._trayDwellTimeout));
}
this._trayDwelling = true;
} else {
this._cancelTrayDwell();
this._trayDwelling = false;
}
},
_cancelTrayDwell: function() {
if (this._trayDwellTimeoutId != 0) {
Mainloop.source_remove(this._trayDwellTimeoutId);
this._trayDwellTimeoutId = 0;
}
},
_trayDwellTimeout: function() {
this._trayDwellTimeoutId = 0;
if (Main.modalCount > 0)
return false;
// If the user interacted with the focus window since we started the tray
// dwell (by clicking or typing), don't activate the message tray
let focusWindow = global.display.focus_window;
let currentUserTime = focusWindow ? focusWindow.user_time : 0;
if (currentUserTime != this._trayDwellUserTime)
return false;
this._traySummoned = true;
this._updateState();
@@ -1792,6 +1849,9 @@ const MessageTray = new Lang.Class({
_onTrayHoverChanged: function() {
if (this.actor.hover) {
// No dwell inside notifications at the bottom of the screen
this._cancelTrayDwell();
// Don't do anything if the one pixel area at the bottom is hovered over while the tray is hidden.
if (this._trayState == State.HIDDEN && this._notificationState == State.HIDDEN)
return;

View File

@@ -46,6 +46,18 @@ const GLSL_DIM_EFFECT_CODE = '\
cogl_color_out.xyz = cogl_color_out.xyz * (1.0 - a); \
cogl_color_out.a = 1.0;';
const SwipeScrollDirection = {
NONE: 0,
HORIZONTAL: 1,
VERTICAL: 2
};
const SwipeScrollResult = {
CANCEL: 0,
SWIPE: 1,
CLICK: 2
};
const ShellInfo = new Lang.Class({
Name: 'ShellInfo',
@@ -153,6 +165,8 @@ const Overview = new Lang.Class({
}
}));
this._scrollDirection = SwipeScrollDirection.NONE;
this._scrollAdjustment = null;
this._capturedEventId = 0;
this._buttonPressId = 0;
@@ -327,11 +341,159 @@ const Overview = new Lang.Class({
return DND.DragMotionResult.CONTINUE;
},
addAction: function(action) {
setScrollAdjustment: function(adjustment, direction) {
if (this.isDummy)
return;
this._group.add_action(action);
this._scrollAdjustment = adjustment;
if (this._scrollAdjustment == null)
this._scrollDirection = SwipeScrollDirection.NONE;
else
this._scrollDirection = direction;
},
_onButtonPress: function(actor, event) {
if (this._scrollDirection == SwipeScrollDirection.NONE
|| event.get_button() != 1)
return;
let [stageX, stageY] = event.get_coords();
this._dragStartX = this._dragX = stageX;
this._dragStartY = this._dragY = stageY;
this._dragStartValue = this._scrollAdjustment.value;
this._lastMotionTime = -1; // used to track "stopping" while swipe-scrolling
this._capturedEventId = global.stage.connect('captured-event',
Lang.bind(this, this._onCapturedEvent));
this.emit('swipe-scroll-begin');
},
_onCapturedEvent: function(actor, event) {
let stageX, stageY;
let threshold = Gtk.Settings.get_default().gtk_dnd_drag_threshold;
switch(event.type()) {
case Clutter.EventType.BUTTON_RELEASE:
[stageX, stageY] = event.get_coords();
// default to snapping back to the original value
let newValue = this._dragStartValue;
let minValue = this._scrollAdjustment.lower;
let maxValue = this._scrollAdjustment.upper - this._scrollAdjustment.page_size;
let direction;
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
direction = stageX > this._dragStartX ? -1 : 1;
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
direction *= -1;
} else {
direction = stageY > this._dragStartY ? -1 : 1;
}
// We default to scroll a full page size; both the first
// and the last page may be smaller though, so we need to
// adjust difference in those cases.
let difference = direction * this._scrollAdjustment.page_size;
if (this._dragStartValue + difference > maxValue)
difference = maxValue - this._dragStartValue;
else if (this._dragStartValue + difference < minValue)
difference = minValue - this._dragStartValue;
// If the user has moved more than half the scroll
// difference, we want to "settle" to the new value
// even if the user stops dragging rather "throws" by
// releasing during the drag.
let distance = this._dragStartValue - this._scrollAdjustment.value;
let noStop = Math.abs(distance / difference) > 0.5;
// We detect if the user is stopped by comparing the
// timestamp of the button release with the timestamp of
// the last motion. Experimentally, a difference of 0 or 1
// millisecond indicates that the mouse is in motion, a
// larger difference indicates that the mouse is stopped.
if ((this._lastMotionTime > 0 &&
this._lastMotionTime > event.get_time() - 2) ||
noStop) {
if (this._dragStartValue + difference >= minValue &&
this._dragStartValue + difference <= maxValue)
newValue += difference;
}
let result;
// See if the user has moved the mouse enough to trigger
// a drag
if (Math.abs(stageX - this._dragStartX) < threshold &&
Math.abs(stageY - this._dragStartY) < threshold) {
// no motion? It's a click!
result = SwipeScrollResult.CLICK;
this.emit('swipe-scroll-end', result);
} else {
if (newValue == this._dragStartValue)
result = SwipeScrollResult.CANCEL;
else
result = SwipeScrollResult.SWIPE;
// The event capture handler is disconnected
// while scrolling to the final position, so
// to avoid undesired prelights we raise
// the cover pane.
this._coverPane.raise_top();
this._coverPane.show();
Tweener.addTween(this._scrollAdjustment,
{ value: newValue,
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onCompleteScope: this,
onComplete: function() {
this._coverPane.hide();
this.emit('swipe-scroll-end',
result);
}
});
}
global.stage.disconnect(this._capturedEventId);
this._capturedEventId = 0;
return result != SwipeScrollResult.CLICK;
case Clutter.EventType.MOTION:
[stageX, stageY] = event.get_coords();
let dx = this._dragX - stageX;
let dy = this._dragY - stageY;
let primary = Main.layoutManager.primaryMonitor;
this._dragX = stageX;
this._dragY = stageY;
this._lastMotionTime = event.get_time();
// See if the user has moved the mouse enough to trigger
// a drag
if (Math.abs(stageX - this._dragStartX) < threshold &&
Math.abs(stageY - this._dragStartY) < threshold)
return true;
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
this._scrollAdjustment.value -= (dx / primary.width) * this._scrollAdjustment.page_size;
else
this._scrollAdjustment.value += (dx / primary.width) * this._scrollAdjustment.page_size;
} else {
this._scrollAdjustment.value += (dy / primary.height) * this._scrollAdjustment.page_size;
}
return true;
// Block enter/leave events to avoid prelights
// during swipe-scroll
case Clutter.EventType.ENTER:
case Clutter.EventType.LEAVE:
return true;
}
return false;
},
_getDesktopClone: function() {
@@ -434,6 +596,9 @@ const Overview = new Lang.Class({
this._modal = true;
this._animateVisible();
this._shown = true;
this._buttonPressId = this._group.connect('button-press-event',
Lang.bind(this, this._onButtonPress));
},
fadeInDesktop: function() {
@@ -533,6 +698,10 @@ const Overview = new Lang.Class({
this._shown = false;
this._syncInputMode();
if (this._buttonPressId > 0)
this._group.disconnect(this._buttonPressId);
this._buttonPressId = 0;
},
// hideTemporarily:

View File

@@ -75,19 +75,19 @@ function _unpremultiply(color) {
blue: blue, alpha: color.alpha });
};
const Animation = new Lang.Class({
Name: 'Animation',
const AnimatedIcon = new Lang.Class({
Name: 'AnimatedIcon',
_init: function(name, size) {
this.actor = new St.Bin({ visible: false });
_init: function(filename, width, height, speed) {
this.actor = new St.Bin();
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._speed = speed;
this._isLoaded = false;
this._isPlaying = false;
this._timeoutId = 0;
this._frame = 0;
this._animations = St.TextureCache.get_default().load_sliced_image (global.datadir + '/theme/' + name, size, size,
this._animations = St.TextureCache.get_default().load_sliced_image (filename, width, height,
Lang.bind(this, this._animationsLoaded));
this.actor.set_child(this._animations);
},
@@ -97,7 +97,7 @@ const AnimatedIcon = new Lang.Class({
if (this._frame == 0)
this._showFrame(0);
this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
this._timeoutId = Mainloop.timeout_add(this._speed, Lang.bind(this, this._update));
}
this._isPlaying = true;
@@ -132,10 +132,8 @@ const AnimatedIcon = new Lang.Class({
_animationsLoaded: function() {
this._isLoaded = true;
if (this._isPlaying) {
this._showFrame(0);
this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
}
if (this._isPlaying)
this.play();
},
_onDestroy: function() {
@@ -143,6 +141,15 @@ const AnimatedIcon = new Lang.Class({
}
});
const AnimatedIcon = new Lang.Class({
Name: 'AnimatedIcon',
Extends: Animation,
_init: function(name, size) {
this.parent(global.datadir + '/theme/' + name, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
}
});
const TextShadower = new Lang.Class({
Name: 'TextShadower',
@@ -294,6 +301,7 @@ const AppMenuButton = new Lang.Class({
this._spinner = new AnimatedIcon('process-working.svg',
PANEL_ICON_SIZE);
this._container.add_actor(this._spinner.actor);
this._spinner.actor.hide();
this._spinner.actor.lower_bottom();
let tracker = Shell.WindowTracker.get_default();

View File

@@ -12,7 +12,6 @@ const St = imports.gi.St;
const Atk = imports.gi.Atk;
const BoxPointer = imports.ui.boxpointer;
const GrabHelper = imports.ui.grabHelper;
const Main = imports.ui.main;
const Params = imports.misc.params;
const Tweener = imports.ui.tweener;
@@ -659,23 +658,14 @@ const PopupSliderMenuItem = new Lang.Class({
_onScrollEvent: function (actor, event) {
let direction = event.get_scroll_direction();
let delta;
if (event.is_pointer_emulated())
return;
if (direction == Clutter.ScrollDirection.DOWN) {
delta = -SLIDER_SCROLL_STEP;
} else if (direction == Clutter.ScrollDirection.UP) {
delta = +SLIDER_SCROLL_STEP;
} else if (direction == Clutter.ScrollDirection.SMOOTH) {
let [dx, dy] = event.get_scroll_delta();
// Even though the slider is horizontal, use dy to match
// the UP/DOWN above.
delta = -dy / 10;
this._value = Math.max(0, this._value - SLIDER_SCROLL_STEP);
}
else if (direction == Clutter.ScrollDirection.UP) {
this._value = Math.min(1, this._value + SLIDER_SCROLL_STEP);
}
this._value = Math.min(Math.max(0, this._value + delta), 1);
this._slider.queue_repaint();
this.emit('value-changed', this._value);
},
@@ -1214,6 +1204,7 @@ const PopupMenu = new Lang.Class({
this.actor = this._boxPointer.actor;
this.actor._delegate = this;
this.actor.style_class = 'popup-menu-boxpointer';
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
this._boxWrapper = new Shell.GenericContainer();
this._boxWrapper.connect('get-preferred-width', Lang.bind(this, this._boxGetPreferredWidth));
@@ -1243,6 +1234,15 @@ const PopupMenu = new Lang.Class({
this.box.allocate(box, flags);
},
_onKeyPressEvent: function(actor, event) {
if (event.get_key_symbol() == Clutter.Escape) {
this.close(BoxPointer.PopupAnimation.FULL);
return true;
}
return false;
},
setArrowOrigin: function(origin) {
this._boxPointer.setArrowOrigin(origin);
},
@@ -1537,6 +1537,7 @@ const PopupComboMenu = new Lang.Class({
this.actor = this.box;
this.actor._delegate = this;
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
this.actor.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
sourceActor.connect('style-changed',
Lang.bind(this, this._onSourceActorStyleChanged));
@@ -1544,6 +1545,15 @@ const PopupComboMenu = new Lang.Class({
global.focus_manager.add_group(this.actor);
},
_onKeyPressEvent: function(actor, event) {
if (event.get_key_symbol() == Clutter.Escape) {
this.close(BoxPointer.PopupAnimation.FULL);
return true;
}
return false;
},
_onKeyFocusIn: function(actor) {
let items = this._getMenuItems();
let activeItem = items[this._activeItemPos];
@@ -2034,8 +2044,17 @@ const PopupMenuManager = new Lang.Class({
_init: function(owner) {
this._owner = owner;
this._grabHelper = new GrabHelper.GrabHelper(owner.actor);
this.grabbed = false;
this._eventCaptureId = 0;
this._enterEventId = 0;
this._leaveEventId = 0;
this._keyFocusNotifyId = 0;
this._activeMenu = null;
this._menus = [];
this._menuStack = [];
this._preGrabInputMode = null;
this._grabbedFromKeynav = false;
},
addMenu: function(menu, position) {
@@ -2054,8 +2073,6 @@ const PopupMenuManager = new Lang.Class({
let source = menu.sourceActor;
if (source) {
if (!menu.blockSourceEvents)
this._grabHelper.addActor(source);
menudata.enterId = source.connect('enter-event', Lang.bind(this, function() { this._onMenuSourceEnter(menu); }));
menudata.focusInId = source.connect('key-focus-in', Lang.bind(this, function() { this._onMenuSourceEnter(menu); }));
}
@@ -2068,7 +2085,7 @@ const PopupMenuManager = new Lang.Class({
removeMenu: function(menu) {
if (menu == this._activeMenu)
this._closeMenu(menu);
this._closeMenu();
let position = this._findMenu(menu);
if (position == -1) // not a menu we manage
@@ -2085,25 +2102,79 @@ const PopupMenuManager = new Lang.Class({
if (menudata.focusInId)
menu.sourceActor.disconnect(menudata.focusInId);
if (menu.sourceActor)
this._grabHelper.removeActor(menu.sourceActor);
this._menus.splice(position, 1);
},
get activeMenu() {
let actor = this._grabHelper.currentGrab.actor;
if (actor)
return actor._delegate;
else
return null;
_grab: function() {
Main.pushModal(this._owner.actor);
this._eventCaptureId = global.stage.connect('captured-event', Lang.bind(this, this._onEventCapture));
// captured-event doesn't see enter/leave events
this._enterEventId = global.stage.connect('enter-event', Lang.bind(this, this._onEventCapture));
this._leaveEventId = global.stage.connect('leave-event', Lang.bind(this, this._onEventCapture));
this._keyFocusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged));
this.grabbed = true;
},
_ungrab: function() {
global.stage.disconnect(this._eventCaptureId);
this._eventCaptureId = 0;
global.stage.disconnect(this._enterEventId);
this._enterEventId = 0;
global.stage.disconnect(this._leaveEventId);
this._leaveEventId = 0;
global.stage.disconnect(this._keyFocusNotifyId);
this._keyFocusNotifyId = 0;
this.grabbed = false;
Main.popModal(this._owner.actor);
},
_onMenuOpenState: function(menu, open) {
if (open) {
this._grabHelper.grab({ actor: menu.actor, modal: true,
onUngrab: Lang.bind(this, this._closeMenu, menu) });
if (this._activeMenu && this._activeMenu.isChildMenu(menu)) {
this._menuStack.push(this._activeMenu);
menu.actor.grab_key_focus();
}
this._activeMenu = menu;
} else {
this._grabHelper.ungrab({ actor: menu.actor });
if (this._menuStack.length > 0) {
this._activeMenu = this._menuStack.pop();
if (menu.sourceActor)
menu.sourceActor.grab_key_focus();
this._didPop = true;
}
}
// Check what the focus was before calling pushModal/popModal
let focus = global.stage.key_focus;
let hadFocus = focus && this._activeMenuContains(focus);
if (open) {
if (!this.grabbed) {
this._preGrabInputMode = global.stage_input_mode;
this._grabbedFromKeynav = hadFocus;
this._grab();
}
if (hadFocus)
focus.grab_key_focus();
else
menu.actor.grab_key_focus();
} else if (menu == this._activeMenu) {
if (this.grabbed)
this._ungrab();
this._activeMenu = null;
if (this._grabbedFromKeynav) {
if (this._preGrabInputMode == Shell.StageInputMode.FOCUSED)
global.stage_input_mode = Shell.StageInputMode.FOCUSED;
if (hadFocus && menu.sourceActor)
menu.sourceActor.grab_key_focus();
else if (focus)
focus.grab_key_focus();
}
}
},
@@ -2115,37 +2186,87 @@ const PopupMenuManager = new Lang.Class({
this.removeMenu(childMenu);
},
// change the currently-open menu without dropping grab
_changeMenu: function(newMenu) {
if (this.activeMenu) {
this._closeMenu(this.activeMenu);
newMenu.open(false);
} else {
newMenu.open(true);
}
if (this._activeMenu) {
// _onOpenMenuState will drop the grab if it sees
// this._activeMenu being closed; so clear _activeMenu
// before closing it to keep that from happening
let oldMenu = this._activeMenu;
this._activeMenu = null;
for (let i = this._menuStack.length - 1; i >= 0; i--)
this._menuStack[i].close(BoxPointer.PopupAnimation.FADE);
oldMenu.close(BoxPointer.PopupAnimation.FADE);
newMenu.open(BoxPointer.PopupAnimation.FADE);
} else
newMenu.open(BoxPointer.PopupAnimation.FULL);
},
_onMenuSourceEnter: function(menu) {
if (!this._grabHelper.grabbed)
if (!this.grabbed || menu == this._activeMenu)
return false;
if (this._grabHelper.isActorGrabbed(menu.actor))
if (this._activeMenu && this._activeMenu.isChildMenu(menu))
return false;
let isChildMenu = this._grabHelper.grabStack.some(function(grab) {
let existingMenu = grab.actor._delegate;
return existingMenu.isChildMenu(menu);
});
if (isChildMenu)
if (this._menuStack.indexOf(menu) != -1)
return false;
if (this._menuStack.length > 0 && this._menuStack[0].isChildMenu(menu))
return false;
this._changeMenu(menu);
return false;
},
_onKeyFocusChanged: function() {
if (!this.grabbed || !this._activeMenu)
return;
let focus = global.stage.key_focus;
if (focus) {
if (this._activeMenuContains(focus))
return;
if (this._menuStack.length > 0)
return;
if (focus._delegate && focus._delegate.menu &&
this._findMenu(focus._delegate.menu) != -1)
return;
}
this._closeMenu();
},
_onMenuDestroy: function(menu) {
this.removeMenu(menu);
},
_activeMenuContains: function(actor) {
return this._activeMenu != null
&& (this._activeMenu.actor.contains(actor) ||
(this._activeMenu.sourceActor && this._activeMenu.sourceActor.contains(actor)));
},
_eventIsOnActiveMenu: function(event) {
return this._activeMenuContains(event.get_source());
},
_shouldBlockEvent: function(event) {
let src = event.get_source();
if (this._activeMenu != null && this._activeMenu.actor.contains(src))
return false;
for (let i = 0; i < this._menus.length; i++) {
let menu = this._menus[i].menu;
if (menu.sourceActor && !menu.blockSourceEvents && menu.sourceActor.contains(src)) {
return false;
}
}
return true;
},
_findMenu: function(item) {
for (let i = 0; i < this._menus.length; i++) {
let menudata = this._menus[i];
@@ -2155,7 +2276,41 @@ const PopupMenuManager = new Lang.Class({
return -1;
},
_closeMenu: function(menu) {
menu.close(BoxPointer.PopupAnimation.FULL);
_onEventCapture: function(actor, event) {
if (!this.grabbed)
return false;
if (this._owner.menuEventFilter &&
this._owner.menuEventFilter(event))
return true;
if (this._didPop) {
this._didPop = false;
return true;
}
let activeMenuContains = this._eventIsOnActiveMenu(event);
let eventType = event.type();
if (eventType == Clutter.EventType.BUTTON_RELEASE) {
if (activeMenuContains) {
return false;
} else {
this._closeMenu();
return true;
}
} else if (eventType == Clutter.EventType.BUTTON_PRESS && !activeMenuContains) {
this._closeMenu();
return true;
} else if (!this._shouldBlockEvent(event)) {
return false;
}
return true;
},
_closeMenu: function() {
if (this._activeMenu != null)
this._activeMenu.close(BoxPointer.PopupAnimation.FULL);
}
});

View File

@@ -194,9 +194,15 @@ const SearchResults = new Lang.Class({
expand: true,
x_align: St.Align.START,
y_align: St.Align.START });
let action = new Clutter.PanAction({ interpolate: true });
action.connect('pan', Lang.bind(this, this._onPan));
this.actor.add_action(action);
this.actor.connect('notify::mapped', Lang.bind(this,
function() {
if (!this.actor.mapped)
return;
let adjustment = scrollView.vscroll.adjustment;
let direction = Overview.SwipeScrollDirection.VERTICAL;
Main.overview.setScrollAdjustment(adjustment, direction);
}));
this._statusText = new St.Label({ style_class: 'search-statustext' });
this._statusBin = new St.Bin({ x_align: St.Align.MIDDLE,
@@ -213,13 +219,6 @@ const SearchResults = new Lang.Class({
this._defaultResult = null;
},
_onPan: function(action) {
let [dist, dx, dy] = action.get_motion_delta(0);
let adjustment = this.actor.vscroll.adjustment;
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
return false;
},
createProviderMeta: function(provider) {
let providerBox = new St.BoxLayout({ style_class: 'search-section',
vertical: true });

View File

@@ -21,6 +21,7 @@ const _modes = {
isLocked: false,
isGreeter: false,
isPrimary: false,
buttonLayout: ['button-layout', 'org.gnome.shell.overrides'],
unlockDialog: null,
components: [],
panel: {
@@ -101,6 +102,29 @@ const _modes = {
right: ['a11y', 'keyboard', 'volume', 'bluetooth',
'network', 'battery', 'userMenu']
}
},
'foo': {
hasOverview: true,
showCalendarEvents: true,
allowSettings: true,
allowExtensions: true,
hasRunDialog: true,
hasWorkspaces: true,
hasWindows: true,
hasNotifications: true,
isLocked: false,
isPrimary: true,
buttonLayout: ['button-layout', 'org.gnome.shell-foo.overrides'],
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
components: ['networkAgent', 'polkitAgent', 'telepathyClient',
'keyring', 'recorder', 'autorunManager', 'automountManager'],
panel: {
left: ['activities', 'appMenu'],
center: ['dateMenu'],
right: ['a11y', 'keyboard', 'volume', 'bluetooth',
'network', 'battery', 'userMenu']
}
}
};

View File

@@ -66,32 +66,24 @@ const VolumeMenu = new Lang.Class({
this._onControlStateChanged();
},
scroll: function(event) {
let direction = event.get_scroll_direction();
scroll: function(direction) {
let currentVolume = this._output.volume;
let delta;
if (event.is_pointer_emulated())
return;
if (direction == Clutter.ScrollDirection.DOWN) {
delta = -VOLUME_ADJUSTMENT_STEP;
} else if (direction == Clutter.ScrollDirection.UP) {
delta = +VOLUME_ADJUSTMENT_STEP;
} else if (direction == Clutter.ScrollDirection.SMOOTH) {
let [dx, dy] = event.get_scroll_delta();
// Use the same math as in the slider.
delta = -dy / 10;
let prev_muted = this._output.is_muted;
this._output.volume = Math.max(0, currentVolume - this._volumeMax * VOLUME_ADJUSTMENT_STEP);
if (this._output.volume < 1) {
this._output.volume = 0;
if (!prev_muted)
this._output.change_is_muted(true);
}
this._output.push_volume();
}
let prev_muted = this._output.is_muted;
this._output.volume = Math.max(0, currentVolume + this._volumeMax * delta);
if (this._output.volume < 1) {
this._output.volume = 0;
if (!prev_muted)
this._output.change_is_muted(true);
else if (direction == Clutter.ScrollDirection.UP) {
this._output.volume = Math.min(this._volumeMax, currentVolume + this._volumeMax * VOLUME_ADJUSTMENT_STEP);
this._output.change_is_muted(false);
this._output.push_volume();
}
this._output.push_volume();
this._notifyVolumeChange();
},
@@ -250,6 +242,6 @@ const Indicator = new Lang.Class({
},
_onScrollEvent: function(actor, event) {
this._volumeMenu.scroll(event);
this._volumeMenu.scroll(event.get_scroll_direction());
}
});

View File

@@ -172,7 +172,6 @@ const UnlockDialog = new Lang.Class({
this._workSpinner = new Panel.AnimatedIcon('process-working.svg', LoginDialog.WORK_SPINNER_ICON_SIZE);
this._workSpinner.actor.opacity = 0;
this._workSpinner.actor.show();
this.allowCancel = false;
this.buttonLayout.visible = true;

View File

@@ -211,19 +211,18 @@ const ViewSelector = new Lang.Class({
return;
if(this._activePage) {
let oldPage = this._activePage;
Tweener.addTween(this._activePage,
{ opacity: 0,
time: 0.1,
transition: 'easeOutQuad',
onComplete: Lang.bind(this,
function() {
oldPage.hide();
this._activePage.hide();
this._activePage = page;
})
});
}
this._activePage = page;
page.show();
Tweener.addTween(page,
{ opacity: 255,

View File

@@ -9,6 +9,7 @@ const St = imports.gi.St;
const IconGrid = imports.ui.iconGrid;
const Layout = imports.ui.layout;
const Main = imports.ui.main;
const Panel = imports.ui.panel;
const Search = imports.ui.search;
// we could make these gsettings
@@ -53,20 +54,9 @@ const WandaIcon = new Lang.Class({
icon_size: iconSize });
}
this._animations = St.TextureCache.get_default().load_sliced_image(this._imageFile, this._imgWidth, this._imgHeight);
this._animations.connect('notify::mapped', Lang.bind(this, function() {
if (this._animations.mapped && !this._timeoutId) {
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, FISH_SPEED, Lang.bind(this, this._update));
this._i = 0;
this._update();
} else if (!this._animations.mapped && this._timeoutId) {
GLib.source_remove(this._timeoutId);
this._timeoutId = 0;
}
}));
return this._animations;
this._animations = new Panel.Animation(this._imageFile, this._imgWidth, this._imgHeight, FISH_SPEED);
this._animations.play();
return this._animations.actor;
},
_createIconTexture: function(size) {
@@ -74,20 +64,7 @@ const WandaIcon = new Lang.Class({
return;
this.parent(size);
},
_update: function() {
let n = this._animations.get_n_children();
if (n == 0) {
return true;
}
this._animations.get_child_at_index(this._i).hide();
this._i = (this._i + 1) % n;
this._animations.get_child_at_index(this._i).show();
return true;
},
}
});
const WandaIconBin = new Lang.Class({

View File

@@ -30,9 +30,6 @@ const CLOSE_BUTTON_FADE_TIME = 0.1;
const DRAGGING_WINDOW_OPACITY = 100;
const BUTTON_LAYOUT_SCHEMA = 'org.gnome.shell.overrides';
const BUTTON_LAYOUT_KEY = 'button-layout';
// When calculating a layout, we calculate the scale of windows and the percent
// of the available area the new layout uses. If the values for the new layout,
// when weighted with the values as below, are worse than the previous layout's,
@@ -265,37 +262,23 @@ const WindowClone = new Lang.Class({
_onScroll : function (actor, event) {
let direction = event.get_scroll_direction();
let delta;
if (event.is_pointer_emulated())
return;
if (direction == Clutter.ScrollDirection.DOWN) {
delta = -SCROLL_SCALE_AMOUNT;
} else if (direction == Clutter.ScrollDirection.UP) {
delta = +SCROLL_SCALE_AMOUNT;
} else if (direction == Clutter.ScrollDirection.SMOOTH) {
let [dx, dy] = event.get_scroll_delta();
delta = -dy * 10;
}
if (delta > 0) {
if (direction == Clutter.ScrollDirection.UP) {
if (this._zoomStep == undefined)
this._zoomStart();
if (this._zoomStep < 100) {
this._zoomStep += delta;
this._zoomStep = Math.min(100, this._zoomStep);
this._zoomStep += SCROLL_SCALE_AMOUNT;
this._zoomUpdate();
}
} else if (delta < 0) {
} else if (direction == Clutter.ScrollDirection.DOWN) {
if (this._zoomStep > 0) {
this._zoomStep += delta;
this._zoomStep -= SCROLL_SCALE_AMOUNT;
this._zoomStep = Math.max(0, this._zoomStep);
this._zoomUpdate();
}
if (this._zoomStep <= 0.0)
this._zoomEnd();
}
},
_zoomUpdate : function () {
@@ -568,8 +551,8 @@ const WindowOverlay = new Lang.Class({
let button = this.closeButton;
let title = this.title;
let settings = new Gio.Settings({ schema: BUTTON_LAYOUT_SCHEMA });
let layout = settings.get_string(BUTTON_LAYOUT_KEY);
let settings = new Gio.Settings({ schema: Main.sessionMode.buttonLayout[1] });
let layout = settings.get_string(Main.sessionMode.buttonLayout[0]);
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
let split = layout.split(":");

View File

@@ -128,8 +128,11 @@ const WorkspacesView = new Lang.Class({
continue;
let ws = new Workspace.Workspace(null, i);
ws.setGeometry(monitors[i].x, monitors[i].y,
monitors[i].width, monitors[i].height);
let overviewSpacing = Main.overview._spacing;
ws.setGeometry(monitors[i].x + overviewSpacing/2,
monitors[i].y + overviewSpacing/2,
monitors[i].width - overviewSpacing,
monitors[i].height - overviewSpacing);
global.overlay_group.add_actor(ws.actor);
this._extraWorkspaces.push(ws);
}
@@ -205,11 +208,11 @@ const WorkspacesView = new Lang.Class({
this._workspaces[w].positionWindows(Workspace.WindowPositionFlags.ANIMATE);
},
_scrollToActive: function() {
_scrollToActive: function(showAnimation) {
let active = global.screen.get_active_workspace_index();
this._updateWorkspaceActors(true);
this._updateScrollAdjustment(active);
this._updateWorkspaceActors(showAnimation);
this._updateScrollAdjustment(active, showAnimation);
},
// Update workspace actors parameters
@@ -267,21 +270,26 @@ const WorkspacesView = new Lang.Class({
}
},
_updateScrollAdjustment: function(index) {
_updateScrollAdjustment: function(index, showAnimation) {
if (this._scrolling)
return;
this._animatingScroll = true;
Tweener.addTween(this.scrollAdjustment, {
value: index,
time: WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad',
onComplete: Lang.bind(this,
function() {
this._animatingScroll = false;
})
});
if (showAnimation) {
Tweener.addTween(this.scrollAdjustment, {
value: index,
time: WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad',
onComplete: Lang.bind(this,
function() {
this._animatingScroll = false;
})
});
} else {
this.scrollAdjustment.value = index;
this._animatingScroll = false;
}
},
updateWorkspaces: function(oldNumWorkspaces, newNumWorkspaces) {
@@ -308,7 +316,7 @@ const WorkspacesView = new Lang.Class({
if (this._scrolling)
return;
this._scrollToActive();
this._scrollToActive(true);
},
_onDestroy: function() {
@@ -382,11 +390,24 @@ const WorkspacesView = new Lang.Class({
this._scrolling = true;
},
endSwipeScroll: function() {
endSwipeScroll: function(result) {
this._scrolling = false;
if (result == Overview.SwipeScrollResult.CLICK) {
let [x, y, mod] = global.get_pointer();
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL,
x, y);
// Only switch to the workspace when there's no application
// windows open. The problem is that it's too easy to miss
// an app window and get the wrong one focused.
let active = global.screen.get_active_workspace_index();
if (this._workspaces[active].isEmpty() &&
this.actor.contains(actor))
Main.overview.hide();
}
// Make sure title captions etc are shown as necessary
this._scrollToActive();
this._updateVisibility();
},
@@ -438,23 +459,9 @@ const WorkspacesDisplay = new Lang.Class({
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
this.actor.connect('allocate', Lang.bind(this, this._allocate));
this.actor.connect('notify::mapped', Lang.bind(this, this._setupSwipeScrolling));
this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
this.actor.set_clip_to_allocation(true);
let action = new Clutter.PanAction();
action.connect('pan', Lang.bind(this, this._onPan));
action.connect('gesture-begin', Lang.bind(this, function() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].startSwipeScroll();
return true;
}));
action.connect('gesture-end', Lang.bind(this, function() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll();
}));
Main.overview.addAction(action);
this.actor.connect('notify::mapped', Lang.bind(this, function() {
action.enabled = this.actor.mapped;
}));
let controls = new St.Bin({ style_class: 'workspace-controls',
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT,
@@ -527,13 +534,6 @@ const WorkspacesDisplay = new Lang.Class({
Lang.bind(this, this._updateSwitcherVisibility));
},
_onPan: function(action) {
let [dist, dx, dy] = action.get_motion_delta(0);
let adjustment = this._scrollAdjustment;
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
return false;
},
_updateSwitcherVisibility: function() {
this._thumbnailsBox.actor.visible =
this._settings.get_boolean('dynamic-workspaces') ||
@@ -643,6 +643,33 @@ const WorkspacesDisplay = new Lang.Class({
}
},
_setupSwipeScrolling: function() {
if (this._swipeScrollBeginId)
Main.overview.disconnect(this._swipeScrollBeginId);
this._swipeScrollBeginId = 0;
if (this._swipeScrollEndId)
Main.overview.disconnect(this._swipeScrollEndId);
this._swipeScrollEndId = 0;
if (!this.actor.mapped)
return;
let direction = Overview.SwipeScrollDirection.VERTICAL;
Main.overview.setScrollAdjustment(this._scrollAdjustment,
direction);
this._swipeScrollBeginId = Main.overview.connect('swipe-scroll-begin',
Lang.bind(this, function() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].startSwipeScroll();
}));
this._swipeScrollEndId = Main.overview.connect('swipe-scroll-end',
Lang.bind(this, function(overview, result) {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll(result);
}));
},
_workspacesOnlyOnPrimaryChanged: function() {
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
@@ -682,6 +709,7 @@ const WorkspacesDisplay = new Lang.Class({
this._scrollAdjustment = view.scrollAdjustment;
this._scrollAdjustment.connect('notify::value',
Lang.bind(this, this._scrollValueChanged));
this._setupSwipeScrolling();
}
this._workspacesViews.push(view);
}

136
po/as.po
View File

@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: gnome-shell master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-"
"shell&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2012-11-26 09:33+0000\n"
"PO-Revision-Date: 2012-11-26 15:51+0530\n"
"POT-Creation-Date: 2012-11-26 14:01+0000\n"
"PO-Revision-Date: 2012-11-27 14:40+0530\n"
"Last-Translator: Nilamdyuti Goswami <ngoswami@redhat.com>\n"
"Language-Team: as_IN <kde-i18n-doc@kde.org>\n"
"Language: as_IN\n"
@@ -165,7 +165,6 @@ msgstr ""
"স্বচালিতভাৱে লুকুৱা অভাৰৰাইড কৰে।"
#: ../data/org.gnome.shell.gschema.xml.in.in.h:15
#| msgid "Always show the 'Log out' menuitem in the user menu."
msgid "Show full name in the user menu"
msgstr "ব্যৱহাৰকাৰী মেনুত সম্পূৰ্ণ নাম দেখুৱাওক"
@@ -749,58 +748,54 @@ msgstr "কল"
msgid "File Transfer"
msgstr "ফাইল স্থানান্তৰ"
#: ../js/ui/components/telepathyClient.js:394
msgid "Subscription request"
msgstr "স্বাক্ষৰণ অনুৰোধ"
#: ../js/ui/components/telepathyClient.js:417
msgid "Chat"
msgstr "চেট"
#: ../js/ui/components/telepathyClient.js:430
msgid "Connection error"
msgstr "সংযোগ ত্ৰুটি"
#: ../js/ui/components/telepathyClient.js:491
#: ../js/ui/components/telepathyClient.js:477
msgid "Unmute"
msgstr "অমৌন কৰক"
#: ../js/ui/components/telepathyClient.js:491
#: ../js/ui/components/telepathyClient.js:477
msgid "Mute"
msgstr "মোন কৰক"
#. Translators: this is a time format string followed by the word "Yesterday". i.e. "14:30 on Yesterday"
#: ../js/ui/components/telepathyClient.js:946
#: ../js/ui/components/telepathyClient.js:932
#, no-c-format
msgid "<b>%H:%M</b> on Yesterday"
msgstr "<b>%H:%M</b> যোৱাকালী"
#. Translators: this is a time format string followed by a week day name. i.e. "14:30 on Monday
#: ../js/ui/components/telepathyClient.js:952
#: ../js/ui/components/telepathyClient.js:938
#, no-c-format
msgid "<b>%H:%M</b> on <b>%A</b>"
msgstr "<b>%A</b> ত <b>%H:%M</b>"
#. Translators: this is a time format in the style of "14:30 on Wednesday, May 25",
#. shown when you get a chat message in the same year
#: ../js/ui/components/telepathyClient.js:958
#: ../js/ui/components/telepathyClient.js:944
#, no-c-format
msgid "<b>%H:%M</b> on <b>%A</b>, <b>%B</b> <b>%d</b>"
msgstr "<b>%A</b> ত <b>%H:%M</b>, <b>%B</b> <b>%d</b>"
#. Translators: this is a time format in the style of "14:30 on Wednesday, May 25, 2012",
#. shown when you get a chat message in a different year
#: ../js/ui/components/telepathyClient.js:963
#: ../js/ui/components/telepathyClient.js:949
#, no-c-format
msgid "<b>%H:%M</b> on <b>%A</b>, <b>%B</b> <b>%d</b>, %Y"
msgstr "<b>%A</b> ত <b>%H:%M</b>, <b>%B</b> <b>%d</b>, %Y"
#. Translators: this is the other person changing their old IM name to their new
#. IM name.
#: ../js/ui/components/telepathyClient.js:991
#: ../js/ui/components/telepathyClient.js:977
#, c-format
msgid "%s is now known as %s"
msgstr "%s এতিয়া %s হিচাপে জনাজাত"
#. translators: argument is a room name like
#. * room@jabber.org for example.
#: ../js/ui/components/telepathyClient.js:1090
#: ../js/ui/components/telepathyClient.js:1076
#, c-format
msgid "Invitation to %s"
msgstr "%s লে নিমন্ত্ৰণ"
@@ -808,38 +803,38 @@ msgstr "%s লে নিমন্ত্ৰণ"
#. translators: first argument is the name of a contact and the second
#. * one the name of a room. "Alice is inviting you to join room@jabber.org
#. * for example.
#: ../js/ui/components/telepathyClient.js:1098
#: ../js/ui/components/telepathyClient.js:1084
#, c-format
msgid "%s is inviting you to join %s"
msgstr "%s এ আপোনাক %s ত অংশগ্ৰহণ কৰিবলে আমন্ত্ৰণ জনাইছে"
#: ../js/ui/components/telepathyClient.js:1100
#: ../js/ui/components/telepathyClient.js:1139
#: ../js/ui/components/telepathyClient.js:1179
#: ../js/ui/components/telepathyClient.js:1242
#: ../js/ui/components/telepathyClient.js:1086
#: ../js/ui/components/telepathyClient.js:1125
#: ../js/ui/components/telepathyClient.js:1165
#: ../js/ui/components/telepathyClient.js:1228
msgid "Decline"
msgstr "নাকচ কৰক"
#: ../js/ui/components/telepathyClient.js:1101
#: ../js/ui/components/telepathyClient.js:1180
#: ../js/ui/components/telepathyClient.js:1243
#: ../js/ui/components/telepathyClient.js:1087
#: ../js/ui/components/telepathyClient.js:1166
#: ../js/ui/components/telepathyClient.js:1229
msgid "Accept"
msgstr "গ্ৰহন কৰক"
#. translators: argument is a contact name like Alice for example.
#: ../js/ui/components/telepathyClient.js:1131
#: ../js/ui/components/telepathyClient.js:1117
#, c-format
msgid "Video call from %s"
msgstr "%s ৰ পৰা ভিডিঅ' কল"
#. translators: argument is a contact name like Alice for example.
#: ../js/ui/components/telepathyClient.js:1134
#: ../js/ui/components/telepathyClient.js:1120
#, c-format
msgid "Call from %s"
msgstr "%s ৰ পৰা কল"
#. translators: this is a button label (verb), not a noun
#: ../js/ui/components/telepathyClient.js:1141
#: ../js/ui/components/telepathyClient.js:1127
msgid "Answer"
msgstr "উত্তৰ দিয়ক"
@@ -848,110 +843,110 @@ msgstr "উত্তৰ দিয়ক"
#. * file name. The string will be something
#. * like: "Alice is sending you test.ogg"
#.
#: ../js/ui/components/telepathyClient.js:1173
#: ../js/ui/components/telepathyClient.js:1159
#, c-format
msgid "%s is sending you %s"
msgstr "%s এ আপোনাক %s পঠাই আছে"
#. To translators: The parameter is the contact's alias
#: ../js/ui/components/telepathyClient.js:1208
#: ../js/ui/components/telepathyClient.js:1194
#, c-format
msgid "%s would like permission to see when you are online"
msgstr "আপুনি কেতিয়া অনলাইন আছে চাবলে %s এ অনুমতি বিচাৰিব"
#: ../js/ui/components/telepathyClient.js:1300
#: ../js/ui/components/telepathyClient.js:1286
msgid "Network error"
msgstr "নেটৱাৰ্ক ত্ৰুটি"
#: ../js/ui/components/telepathyClient.js:1302
#: ../js/ui/components/telepathyClient.js:1288
msgid "Authentication failed"
msgstr "প্ৰমাণীকৰণ ব্যৰ্থ"
#: ../js/ui/components/telepathyClient.js:1304
#: ../js/ui/components/telepathyClient.js:1290
msgid "Encryption error"
msgstr "ইনক্ৰিপষণ ত্ৰুটি"
#: ../js/ui/components/telepathyClient.js:1306
#: ../js/ui/components/telepathyClient.js:1292
msgid "Certificate not provided"
msgstr "প্ৰমাণপত্ৰ প্ৰদান কৰা হোৱা নাই"
#: ../js/ui/components/telepathyClient.js:1308
#: ../js/ui/components/telepathyClient.js:1294
msgid "Certificate untrusted"
msgstr "প্ৰমাণপত্ৰক ভৰষা কৰিব নোৱাৰি"
#: ../js/ui/components/telepathyClient.js:1310
#: ../js/ui/components/telepathyClient.js:1296
msgid "Certificate expired"
msgstr "প্ৰমাণপত্ৰৰ অৱসান ঘটিছে"
#: ../js/ui/components/telepathyClient.js:1312
#: ../js/ui/components/telepathyClient.js:1298
msgid "Certificate not activated"
msgstr "প্ৰমাণপত্ৰ সক্ৰিয় কৰা হোৱা নাই"
#: ../js/ui/components/telepathyClient.js:1314
#: ../js/ui/components/telepathyClient.js:1300
msgid "Certificate hostname mismatch"
msgstr "প্ৰমাণপত্ৰ হস্টনাম অমিল"
#: ../js/ui/components/telepathyClient.js:1316
#: ../js/ui/components/telepathyClient.js:1302
msgid "Certificate fingerprint mismatch"
msgstr "প্ৰমাণপত্ৰ ফিংগাৰপ্ৰিন্ট অমিল"
#: ../js/ui/components/telepathyClient.js:1318
#: ../js/ui/components/telepathyClient.js:1304
msgid "Certificate self-signed"
msgstr "প্ৰমাণপত্ৰ স্ব-স্বাক্ষৰীত"
#: ../js/ui/components/telepathyClient.js:1320
#: ../js/ui/components/telepathyClient.js:1306
msgid "Status is set to offline"
msgstr "অৱস্থা অফলাইনলে সংহতি কৰা হৈছে"
#: ../js/ui/components/telepathyClient.js:1322
#: ../js/ui/components/telepathyClient.js:1308
msgid "Encryption is not available"
msgstr "ইনক্ৰিপষণ উপলব্ধ নহয়"
#: ../js/ui/components/telepathyClient.js:1324
#: ../js/ui/components/telepathyClient.js:1310
msgid "Certificate is invalid"
msgstr "প্ৰমাণপত্ৰ অবৈধ"
#: ../js/ui/components/telepathyClient.js:1326
#: ../js/ui/components/telepathyClient.js:1312
msgid "Connection has been refused"
msgstr "সংযোগ নাকচ কৰা হৈছে"
#: ../js/ui/components/telepathyClient.js:1328
#: ../js/ui/components/telepathyClient.js:1314
msgid "Connection can't be established"
msgstr "সংযোগ স্থাপন কৰিব নোৱাৰি"
#: ../js/ui/components/telepathyClient.js:1330
#: ../js/ui/components/telepathyClient.js:1316
msgid "Connection has been lost"
msgstr "সংযোগ হেৰাইছে"
#: ../js/ui/components/telepathyClient.js:1332
#: ../js/ui/components/telepathyClient.js:1318
msgid "This account is already connected to the server"
msgstr "এই একাওন্ট ইতিমধ্যে চাৰ্ভাৰৰ সৈতে সংযোগিত"
#: ../js/ui/components/telepathyClient.js:1334
#: ../js/ui/components/telepathyClient.js:1320
msgid ""
"Connection has been replaced by a new connection using the same resource"
msgstr "সংযোগক একে সম্পদ ব্যৱহাৰ কৰি এটা নতুন সংযোগৰে প্ৰতিস্থাপন কৰা হৈছে"
#: ../js/ui/components/telepathyClient.js:1336
#: ../js/ui/components/telepathyClient.js:1322
msgid "The account already exists on the server"
msgstr "একাওন্ট ইতিমধ্যে চাৰ্ভাৰত উপস্থিত"
#: ../js/ui/components/telepathyClient.js:1338
#: ../js/ui/components/telepathyClient.js:1324
msgid "Server is currently too busy to handle the connection"
msgstr "চাৰ্ভাৰ সংযোগ ব্যৱস্থাপনা কৰিবলে বৰ্তমানে অতি ব্যস্ত"
#: ../js/ui/components/telepathyClient.js:1340
#: ../js/ui/components/telepathyClient.js:1326
msgid "Certificate has been revoked"
msgstr "প্ৰমাণপত্ৰ প্ৰত্যাহাৰ কৰা হৈছে"
#: ../js/ui/components/telepathyClient.js:1342
#: ../js/ui/components/telepathyClient.js:1328
msgid ""
"Certificate uses an insecure cipher algorithm or is cryptographically weak"
msgstr ""
"প্ৰমাণপত্ৰয় এটা অসুৰক্ষিত চিফাৰ এলগৰিথম ব্যৱহাৰ কৰে অথবা ক্ৰিপ্টোগ্ৰাফিয়ভাৱে "
"দুৰ্বল"
#: ../js/ui/components/telepathyClient.js:1344
#: ../js/ui/components/telepathyClient.js:1330
msgid ""
"The length of the server certificate, or the depth of the server certificate "
"chain, exceed the limits imposed by the cryptography library"
@@ -960,26 +955,23 @@ msgstr ""
"ক্ৰিপ্টোগ্ৰাফী "
"লাইব্ৰেৰীয়ে প্ৰণয়ন কৰা সীমাসমূহত অতিক্ৰম কৰে"
#: ../js/ui/components/telepathyClient.js:1346
#: ../js/ui/components/telepathyClient.js:1332
msgid "Internal error"
msgstr "অভ্যন্তৰীক ত্ৰুটি"
#. translators: argument is the account name, like
#. * name@jabber.org for example.
#: ../js/ui/components/telepathyClient.js:1356
#: ../js/ui/components/telepathyClient.js:1342
#, c-format
msgid "Connection to %s failed"
msgstr "%s ে সংযোগ ব্যৰ্থ"
msgid "Unable to connect to %s"
msgstr "%s ৰ সৈতে সংযোগ কৰিবলে অক্ষম"
#: ../js/ui/components/telepathyClient.js:1365
msgid "Reconnect"
msgstr "পুনৰ সংযোগ কৰক"
#: ../js/ui/components/telepathyClient.js:1347
#| msgid "Edit account"
msgid "View account"
msgstr "একাওন্ট দৰ্শন কৰক"
#: ../js/ui/components/telepathyClient.js:1366
msgid "Edit account"
msgstr "একাওন্ট সম্পাদন কৰক"
#: ../js/ui/components/telepathyClient.js:1411
#: ../js/ui/components/telepathyClient.js:1387
msgid "Unknown reason"
msgstr "অজ্ঞাত কাৰণ"
@@ -1852,6 +1844,18 @@ msgstr "অবিকল্পিত"
msgid "Authentication dialog was dismissed by the user"
msgstr "প্ৰমাণীকৰণ ডাইলগ ব্যৱহাৰকাৰী দ্বাৰা নাকচ কৰা হৈছিল"
#~ msgid "Subscription request"
#~ msgstr "স্বাক্ষৰণ অনুৰোধ"
#~ msgid "Connection error"
#~ msgstr "সংযোগ ত্ৰুটি"
#~ msgid "Connection to %s failed"
#~ msgstr "%s লে সংযোগ ব্যৰ্থ"
#~ msgid "Reconnect"
#~ msgstr "পুনৰ সংযোগ কৰক"
#~ msgid "Browse Files..."
#~ msgstr "ফাইলসমূহ ব্ৰাউছ কৰক..."

View File

@@ -174,8 +174,6 @@ shell_prefs_init (void)
OVERRIDES_SCHEMA);
meta_prefs_override_preference_schema ("workspaces-only-on-primary",
OVERRIDES_SCHEMA);
meta_prefs_override_preference_schema ("button-layout",
OVERRIDES_SCHEMA);
meta_prefs_override_preference_schema ("edge-tiling",
OVERRIDES_SCHEMA);
meta_prefs_override_preference_schema ("focus-change-on-pointer-rest",

View File

@@ -1007,6 +1007,54 @@ shell_global_end_modal (ShellGlobal *global,
meta_plugin_end_modal (global->plugin, timestamp);
}
/**
* shell_global_create_pointer_barrier:
* @global: a #ShellGlobal
* @x1: left X coordinate
* @y1: top Y coordinate
* @x2: right X coordinate
* @y2: bottom Y coordinate
* @directions: The directions we're allowed to pass through
*
* If supported by X creates a pointer barrier.
*
* Return value: value you can pass to shell_global_destroy_pointer_barrier()
*/
guint32
shell_global_create_pointer_barrier (ShellGlobal *global,
int x1, int y1, int x2, int y2,
int directions)
{
#if HAVE_XFIXESCREATEPOINTERBARRIER
return (guint32)
XFixesCreatePointerBarrier (global->xdisplay,
DefaultRootWindow (global->xdisplay),
x1, y1,
x2, y2,
directions,
0, NULL);
#else
return 0;
#endif
}
/**
* shell_global_destroy_pointer_barrier:
* @global: a #ShellGlobal
* @barrier: a pointer barrier
*
* Destroys the @barrier created by shell_global_create_pointer_barrier().
*/
void
shell_global_destroy_pointer_barrier (ShellGlobal *global, guint32 barrier)
{
#if HAVE_XFIXESCREATEPOINTERBARRIER
g_return_if_fail (barrier > 0);
XFixesDestroyPointerBarrier (global->xdisplay, (PointerBarrier)barrier);
#endif
}
/* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.
*
* Authors: Padraig O'Briain, Matthias Clasen, Lennart Poettering

View File

@@ -70,6 +70,15 @@ void shell_global_set_cursor (ShellGlobal *global,
ShellCursor type);
void shell_global_unset_cursor (ShellGlobal *global);
guint32 shell_global_create_pointer_barrier (ShellGlobal *global,
int x1,
int y1,
int x2,
int y2,
int directions);
void shell_global_destroy_pointer_barrier (ShellGlobal *global,
guint32 barrier);
void shell_global_get_pointer (ShellGlobal *global,
int *x,
int *y,

View File

@@ -665,45 +665,6 @@ st_scroll_view_allocate (ClutterActor *actor,
}
static void
adjust_with_delta (StAdjustment *adj,
gdouble delta)
{
gdouble new_value, page_size, scroll_unit;
g_object_get (adj,
"page-size", &page_size,
NULL);
scroll_unit = pow (page_size, 2.0 / 3.0);
new_value = st_adjustment_get_value (adj) + delta * scroll_unit;
st_adjustment_set_value (adj, new_value);
}
static void
adjust_with_direction (StAdjustment *adj,
ClutterScrollDirection direction)
{
gdouble delta;
switch (direction)
{
case CLUTTER_SCROLL_UP:
case CLUTTER_SCROLL_LEFT:
delta = -1.0;
break;
case CLUTTER_SCROLL_RIGHT:
case CLUTTER_SCROLL_DOWN:
delta = 1.0;
break;
case CLUTTER_SCROLL_SMOOTH:
g_assert_not_reached ();
break;
}
adjust_with_delta (adj, delta);
}
static void
st_scroll_view_style_changed (StWidget *widget)
{
@@ -726,32 +687,57 @@ st_scroll_view_scroll_event (ClutterActor *self,
ClutterScrollEvent *event)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
gdouble value, step, hvalue, vvalue, delta_x, delta_y;
/* don't handle scroll events if requested not to */
if (!priv->mouse_scroll)
return FALSE;
/* throw away this garbage event. we want smooth scrolling. */
if (clutter_event_is_pointer_emulated ((ClutterEvent *) event))
return TRUE;
switch (event->direction)
{
case CLUTTER_SCROLL_SMOOTH:
clutter_event_get_scroll_delta ((ClutterEvent *)event,
&delta_x, &delta_y);
g_object_get (priv->hadjustment,
"value", &hvalue,
NULL);
g_object_get (priv->vadjustment,
"value", &vvalue,
NULL);
break;
case CLUTTER_SCROLL_UP:
case CLUTTER_SCROLL_DOWN:
g_object_get (priv->vadjustment,
"step-increment", &step,
"value", &value,
NULL);
break;
case CLUTTER_SCROLL_LEFT:
case CLUTTER_SCROLL_RIGHT:
g_object_get (priv->hadjustment,
"step-increment", &step,
"value", &value,
NULL);
break;
}
switch (event->direction)
{
case CLUTTER_SCROLL_SMOOTH:
{
gdouble delta_x, delta_y;
clutter_event_get_scroll_delta ((ClutterEvent *)event, &delta_x, &delta_y);
adjust_with_delta (priv->hadjustment, delta_x);
adjust_with_delta (priv->vadjustment, delta_y);
}
st_adjustment_set_value (priv->hadjustment, hvalue + delta_x);
st_adjustment_set_value (priv->vadjustment, vvalue + delta_y);
break;
case CLUTTER_SCROLL_UP:
st_adjustment_set_value (priv->vadjustment, value - step);
break;
case CLUTTER_SCROLL_DOWN:
adjust_with_direction (priv->vadjustment, event->direction);
st_adjustment_set_value (priv->vadjustment, value + step);
break;
case CLUTTER_SCROLL_LEFT:
st_adjustment_set_value (priv->hadjustment, value - step);
break;
case CLUTTER_SCROLL_RIGHT:
adjust_with_direction (priv->hadjustment, event->direction);
st_adjustment_set_value (priv->hadjustment, value + step);
break;
}

View File

@@ -316,7 +316,6 @@ st_widget_dispose (GObject *gobject)
if (priv->theme_node)
{
g_object_run_dispose (G_OBJECT (priv->theme_node));
g_object_unref (priv->theme_node);
priv->theme_node = NULL;
}