Compare commits

...

101 Commits

Author SHA1 Message Date
Florian Müllner
078a1bda14 shellDBus: Return error on invalid app IDs
When passing an invalid or unknown app ID to FocusApp(), we currently
open the app picker and silently fail to select the desired app.
Instead of half-working like that, make it clear that the argument
was invalid by returning an appropriate error. (It's easy to get the
ID wrong, as unlike appstream/flatpak IDs, we include the ".desktop"
suffix).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/337
2019-01-08 22:40:56 +01:00
Ryuta Fujii
5edceba588 Update Japanese translation 2019-01-03 07:25:23 +00:00
Michael Catanzaro
49133c7245 Remove the browser plugin
The browser plugin is crashy and broken; there are dozens of bugs filed
against it on Bugzilla and nobody is looking at them. Chrome and Firefox
have both dropped support for NPAPI plugins. Epiphany still has support,
but it's hidden behind a gsetting and all the UI to enable it has been
removed, so very few users would be able to figure out how to enable.
I've even previously considered blacklisting this plugin in the past due
to all the crashes.

Since this plugin has not actually worked in any browsers for a long
time now, time to delete it.

https://bugzilla.gnome.org/show_bug.cgi?id=766776
2018-12-31 13:25:05 -06:00
Anders Jonsson
c1c00a8c1d Update Swedish translation 2018-12-28 13:43:24 +00:00
Emin Tufan Çetin
d3bf1a9ee7 Update Turkish translation 2018-12-25 16:47:26 +00:00
Fabio Tomat
f43f9557e4 Update Friulian translation 2018-12-24 18:05:47 +00:00
Andre Klapper
a92ad59595 Replace Bugzilla by Gitlab URL in DOAP file 2018-12-15 23:26:54 +01:00
RyuzakiKK
616852cf2b thunderbolt: fix missing variable underscore for enrolling
The variable `this.enrolling` is a typo because it has not been defined
before and is also never used.
`this._enrolling` is what it was meant to be.
2018-12-07 11:19:57 +00:00
Florian Müllner
e5ce3d541e messageTray: Re-enable unredirection when banner is destroyed
The intention of commit 4dc20398 was to disable unredirection while
banners are shown, but the ::done-displaying signal currently used for
re-enabling unredirection is only emitted under some circumstances, so
it's possible that unredirection is left disabled indefinitely, whoops.

Fix this by tying disabling unredirection explicitly to the lifetime
of the banner actor.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/799
2018-12-05 18:11:39 +00:00
Florian Müllner
925a25da17 st: Avoid integer overflow on unpremultiply
When computing the effective border color, we operate on colors with
premultiplied alpha to simplify the calculations, then unpremultiply
the result. However we miss a bounds check in the last check, so any
color component can overflow the allowed maximum of 0xff and shift the
result in unexpected ways.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/305
2018-12-04 15:55:39 +00:00
Cosimo Cecchi
6743c18fdf StWidget: don't forget to invalidate the paint state if not on stage
If the actor is not on the stage yet (i.e. does not have a theme
node), but has a paint state cached, we currently fail to invalidate
it, which will lead to the actor painting with old contents once it
gets onto the stage.

This commit fixes the issue by changing our invalidation strategy;
previously we were looking at the widget's own theme node to determine
if it should be invalidated or not.
Now we look at the theme nodes of our cached paint states. When the
widget is mapped on stage, those are the same as the widget's own
theme node, but when the widget is not on the stage, we'll still be
able to invalidate them.

As part of this, we move the invalidation API to StThemeNodePaintState,
which is a more natural place for our use case.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/314
2018-12-04 15:52:36 +00:00
Daniel Mustieles
4d649d6ee8 Updated Spanish translation 2018-12-04 16:39:42 +01:00
Matej Urbančič
121c427438 Updated Slovenian translation 2018-12-02 18:06:02 +01:00
Kristjan SCHMIDT
25fbffc454 Update Esperanto translation 2018-11-28 09:05:52 +00:00
Daniel van Vugt
0e0574a0b4 iconGrid: Eliminate JavaScript for painting/picking
The only reason for `vfunc_paint` and `vfunc_pick` existing was to
implement a culling optimization. Although that optimization actually
made performance worse than none at all because it forced the painting
and picking cycles to spend more time calling into JavaScript.

Turns out we don't have to choose between native code and culling though.
Just reimplement the culling using native ClutterActor functions and we
get the benefits of both.

Performance on an i7-7700:

Moving the cursor over the icon grid:
Before: 70% CPU, 5.5ms per frame
After : 60% CPU, 4.5ms per frame

Scrolling the icon grid:
Before: 60% CPU, 4.4ms per frame
After : 50% CPU, 3.3ms per frame

Helps with https://gitlab.gnome.org/GNOME/gnome-shell/issues/174
2018-11-27 13:25:37 +00:00
Marco Trevisan (Treviño)
4c11d15a07 st-button: Ignore pointer emulated touch events
In X11, pointer emulated touch events are replicated with normal PRESS, RELEASE
pair events which are generated by the server. Thus for a single tap we get:
 - TOUCH_BEGIN -> TOUCH_END, PRESS -> RELEASE

This will cause st-button to send two "clicked" signals, instead of just one,
breaking extensions (like dash-to-dock) that show buttons in the main stage
which will be checked two times or that will receive the same signal two times.
2018-11-26 21:18:25 +00:00
daniruiz
3217c10ff2 theme: Replace calendar arrow images with symbolic icons and CSS
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/301
2018-11-26 15:34:08 +00:00
Jonas Ådahl
264050742b meson.build: Bump compatible mutter API version to 4 2018-11-23 14:46:51 +01:00
Carlos Garnacho
cdb8ac3a2f shell: Hide/drop unused public API
These static methods won't work as-is as MetaStartupSequence API in
JS bindings. Luckily those are used nowhere there.
2018-11-23 13:58:35 +01:00
Carlos Garnacho
10b3671a99 shell: Use MetaStartupNotification
This is "API compatible" with ShellStartupNotification, so only
C changes are necessary.
2018-11-23 13:58:35 +01:00
Sam Hewitt
4d2dce2c52 theme: Drop custom assets for window close buttons in overview
They can be replaced by a themed icon and some CSS styling.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/782
2018-11-22 23:50:24 +01:00
Sam Hewitt
27c660d2a9 theme: Replace page indicator assets with css
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/297
2018-11-22 19:28:14 +01:00
Sam Hewitt
8e7c90b930 theme: Replace corner ripple png assets with css
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/298
2018-11-22 19:23:24 +01:00
Andrea Azzarone
ff2fbf5ae4 dash: destroy items's child before tooltip
Destroy the DashItemContainer's child from the same handler as the tooltip. This
will prevent invalid reads when the item is destroyed while its quicklist is
still open.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/781
2018-11-19 15:51:32 +00:00
Florian Müllner
e77463b875 altSwitcher: Fix error when all alternatives are disabled
While we do consider the case that we don't have a child to show for the
visibility, we are still trying to move the click action unconditionally.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/783
2018-11-17 12:18:23 +00:00
Florian Müllner
74bb9e6249 ibusManager: Don't pass undefined callback to ibus
Since commit 551e827841, we don't always pass a callback parameter.
However passing it on as undefined to ibus doesn't work, as gjs doesn't
accept that as a valid callback value and throw an error. As a result,
we can end up with no layout selected in the keyboard menu and an "empty"
indicator. Fix this by explicitly passing null if no callback has been
provided.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/293
2018-11-17 12:15:46 +00:00
Jasper St. Pierre
43041f0464 app-usage: Remove more unused things
https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +00:00
Jasper St. Pierre
c3ec813f6f app-usage: Remove unused open-window-count attribute
Since this has already been unused and was inaccessible, this shouldn't
matter too much.

https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +00:00
Jasper St. Pierre
04d7069d83 app-usage: Remove crufty old "context"s idea
Back in the day, there was a proposed system of tracking apps in a
specific context.

The inspiration was that you may have used apps in multiple modes:
Firefox may have been used in both "Programmer Reference" and
"Kitten Videos" contexts. Early user response to the feedback wasn't
too positive - context switching is something that humans have trouble
doing implicitly, let alone explicitly. The old codebase still has a
few remnants of this around; let's finally put them to rest.

Note that we still write out a dummy context tag to the XML file - old
versions of the shell will flat out crash if you don't have one of those
in there, so just leave it in for compatibility sake.

https://bugzilla.gnome.org/show_bug.cgi?id=673767
2018-11-17 12:08:33 +00:00
João Paulo Rechi Vita
52c59ac0dd power: Label the PENDING_CHARGE state as "Not Charging"
The pending-charge state means AC power is on but the battery is not
being charged. This can happen because its charge is above a certain
threshold, to avoid short charging cycles and prolong the battery's
life, or because the PSU is not powerful enough to charge the batteries.

Instead of lying to the user about something being estimated, we should
simply tell the truth and set the label to "Not Charging".

Closes: #701.
2018-11-14 13:51:26 -08:00
Florian Müllner
240f3faf6e windowAttentionHandler: Fix syntax errors
Gah, why didn't we catch those?!
2018-11-14 19:38:33 +01:00
Florian Müllner
284978757e windowAttentionHandler: Handle XUrgencyHint as well
While it's not commonly used, it is easy enough to handle it the
same as the demands-attention hint, so do just that.

https://bugzilla.gnome.org/show_bug.cgi?id=643595
2018-11-14 13:42:33 +00:00
Florian Müllner
50c28714df Bump version to 3.31.2
Update NEWS.
2018-11-14 01:03:45 +01:00
Florian Müllner
6099e92df5 workspace: Confine caption width to workspace area
When we started to only show a single caption at a time, we allowed
title captions to be wider than their corresponding window preview.
But while overlapping neighboring previews is fine, we shouldn't
allow the captions to leak outside the workspace area itself and
overlap unrelated elements like workspace switcher or dash.

This partly reverts commit b3b30f239d.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/214
2018-11-13 18:12:59 +00:00
Florian Müllner
a4d09b4264 workspace: Remove dead code
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/214
2018-11-13 18:12:59 +00:00
Carlos Garnacho
6f5a099184 inputMethod: Keep track of preedit string visibility
So we can silence update-preedit-text signals that keep the
preedit string invisible.

https://gitlab.gnome.org/GNOME/gtk/issues/1447
2018-11-13 18:52:15 +01:00
Carlos Garnacho
8c3811a866 inputMethod: Avoid calling set_preedit_text() if unnecessary
This is easier down on clients.
2018-11-13 18:52:15 +01:00
Erik Duxstad
118cab1766 windowManager: make TouchpadWorkspaceSwitchAction respect natural-scroll
Instead of defaulting to a natural scroll behavior,
have the workspace switch action use the natural-scroll setting
in org.gnome.peripherals.touchpad to determine the correct
direction of travel when swiping. 4 finger swipes will then
match the behavior of the rest of the UI.

Reference: https://gitlab.gnome.org/GNOME/gnome-shell/issues/516
2018-11-13 14:56:11 +00:00
Marco Trevisan (Treviño)
367b1c0627 notificationDaemon: Don't pass unused extra hints value
Probably this is a leftover of old implementations of _iconForNotificationData,
but right now this only takes a value, so just pass one.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/285
2018-11-13 15:39:56 +01:00
Marco Trevisan (Treviño)
33b8537bf5 notificationDaemon: support file:// or icon theme names for image-path
While this sounds counter-intuitive, the image-path hint value might also
be used with URIs or icon names.

As per freedesktop standard:
  The "app_icon" parameter and "image-path" hint should be either an URI
  (file:// is the only URI schema supported right now) or a name in a
  freedesktop.org-compliant icon theme (not a GTK+ stock ID).

Thus the image-path hint should also be parsed as it happens for the
app_icon.

Reuse same logic, by falling back on _iconForNotificationData with the
hint value.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/285
2018-11-13 15:39:46 +01:00
Georges Basile Stavracas Neto
361cc6cf92 st: Remove deprecated cogl_texture_new()
cogl_texture_new() is used in a few places in GNOME Shell, but
it's a deprecated Cogl function. The replacement is the less
verbose cogl_texture_2d_new_with_size(), that is very much a
straightforward replacement.

Remove the few places where this function is used, replacing
it by the CoglTexture2d counterpart.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/287
2018-11-12 21:59:36 -02:00
Cosimo Cecchi
5fb8d4f730 calendar: do not call destroy() recursively
We have a callback that will call close() when the notification is
destroyed, and a callback that will call destroy() on the notification
when the message is closed.

Currently, if the notification is destroyed we'll execute our callback
that will call again destroy() on the notification. That's bad
practice in general, and it also has the side effect of resetting the
destroy reason.

This commit avoids re-destroying the notification by dropping the
notification reference on destroy.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Cosimo Cecchi
a98ed08a54 notificationDaemon: use different reason when replacing notification
Differently from the fd.o notifications, Gtk notifications do not
have a mechanism to update themselves. Instead, when a new
notification is received for an ID already known to the notification
daemon, the old notification is dismissed and a replaced with a new
one.

Currently though, there is no way to distinguish a notification that
was dismissed because of an user interaction, or because it was
replaced. That is an useful piece of information, so add a new value
to the NotificationDestroyedReason enum to account for it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Cosimo Cecchi
80a7547129 notificationDaemon: separate out GtkNotification creation
This way, source subclasses can easily use a notification subclass
if different functionality is required.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/258
2018-11-10 10:56:49 +00:00
Cosimo Cecchi
ca3f4cfb41 StTextureCache: use right event to detect file changes
StTextureCache installs file monitors that invalidate caches when
contents of the underlying file change.
At the moment, the cache uses the Gio.FileMonitorEvent.CHANGED event
type to make that determination.

However, that is suboptimal for at least two reasons:
- while a file is being written to disk, many CHANGED events will be
  emitted in sequence. That will cause needless cache invalidations,
  and we will risk loading the file before it's fully loaded.
- if an existing file is replaced, e.g. with g_file_replace(), we may
  not get a CHANGED event but a CREATED one instead, so the cache ends
  up never getting invalidated.

The good news is that in both of those cases GFileMonitor will send a
CHANGES_DONE_HINT event after changes have settled, or after the file
is replaced.

This commit fixes both cases by switching from the CHANGED event to
CHANGES_DONE_HINT to determine that a file has in fact changed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/286
2018-11-10 00:42:49 +01:00
Takao Fujiwara
551e827841 keyboard: Do not call KeyboardManager.holdKeyboard() with set-content-type
When gnome-shell receives the signal of 'set-content-type' from ibus,
gnome-shell calls KeyboardManager.holdKeyboard() and
KeyboardManager.releaseKeyboard() and the functions change the current
input focus in GNOME Xorg and it could result in closing a popup window
which has a password entry by focusing on the entry.
The solution is to stop to call the APIs on 'set-content-type' signal.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/391
2018-11-09 10:55:30 +00:00
Florian Müllner
4dc2039859 messageTray: Disable unredirection while showing banners
We don't usually show notification banners while the monitor is in
fullscreen, but when we do - the notification is urgent - we should
actually show the banner, even if the top-most window is unredirected.
To achieve that, disable unredirection while the banner is showing.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/430
2018-11-08 12:51:27 +00:00
Florian Müllner
f1195ecb01 workspaces: Use correct schema for workspace settings
The custom overrides system is gone, we need to use the original
mutter schema.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/768
2018-11-08 10:50:32 +01:00
Georges Basile Stavracas Neto
127ba318fd polkit: Only unregister registered handles
If the initialization fails for some reason, for example by
running 'gnome-shell --replace', we should not crash because
of an attempt of unregistering an unregistered agent handle.

Fix that by checking if the handle is not NULL before calling
the unregistering routines.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
2018-11-06 13:05:29 -02:00
Georges Basile Stavracas Neto
72fa44d0fd polkit: Port to G_DECLARE_FINAL_CLASS
So we can remove this old boilerplate code. In order to be able
to use that, the autoptr function for PolkitAgentListener was
added as well.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
2018-11-06 13:05:15 -02:00
Daniel Mustieles
b96cc9a161 Update Spanish translation 2018-11-06 11:04:19 +00:00
Rafael Fontenelle
5f2c167947 Update Brazilian Portuguese translation
(cherry picked from commit e55bdb0fbb)
2018-11-05 19:58:53 +00:00
Jakub Steiner
86a78c340f Theme: fix modal dialog button
- allow for focused hover state

Fixes issue #727
2018-11-02 14:45:05 +01:00
Daniel van Vugt
1acdff822a iconGrid: Keep icons reactive during pulse animation
The `reactive` property of icon actors was being restored multiple times
over the course of the pulse animation, all at slightly different times
as each icon finished animating at different times.

The problem is that toggling `reactive` on an `StWidget` incurs a style
change of the `insensitive` pseudo class, and style changes would quickly
queue relayouts incurring full stage reallocation. This occurred many times
during a pulse animation, limiting its smoothness and performance.

The solution is to not toggle the `reactive` property in the pulse
animation at all, which avoids incurring multiple full stage relayouts.

As a bonus, this means the icon under the cursor pulses with the correct
selection highlight, appearing more seamless and responsive.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/261
2018-10-30 19:58:52 +01:00
Daniel van Vugt
a5e6dd52d2 iconGrid: Defer and group animation cleanup
The `reactive` property of icon actors was being restored 24 times over
the course of the spring animation, all at slightly different times as
each icon finished animating at different times.

The problem is that toggling `reactive` on an `StWidget` incurs a style
change of the `insensitive` pseudo class, and style changes would quickly
queue relayouts incurring full stage reallocation. This occurred many times
during a spring animation hogging the CPU and limiting the frame rate.

The solution is defer and batch the cleanup for all icons until after the
last icon has finished animating. This way the CPU impact of the style
change and stage relayout isn't felt during the animation so the frame
rate remains higher and smoother. The overall CPU usage of the animation
is also reduced as the remaining relayouts are much more likely to be
grouped into a single frame.

Icon spring animation performance on an i7-7700:
Before: 83% CPU and 47 FPS
After : 78% CPU and 54 FPS
which is about a 22% increase in performance per clock (FPS/CPU).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/253
2018-10-30 18:01:05 +00:00
Anish Sheela
14953041cc Update Malayalam translation 2018-10-28 14:08:07 +00:00
Matej Urbančič
4e422a527f Updated Slovenian translation 2018-10-25 21:40:05 +02:00
Georges Basile Stavracas Neto
c0b561dd4a switcherPopup: Bind to the stage, not the monitor
The switcher popup is a large, mostly transparent actor that
should cover all the clickable area of GNOME Shell. In Clutter
terms, it should cover the whole stage.

By binding it to the primary monitor, the Alt+Tab behavior
becomes a bit inconsistent. For example, by not hiding when
clicking at empty spaces at other monitors.

Fix that by binding the SwitcherPopup to the whole stage,
and not only the primary monitor.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/647
2018-10-25 12:33:10 -03:00
Carmen Bianca Bakker
0f542c2e16 Remove padding from date strings
The padding is removed by using %-d instead of %e or %d.

Examples:

"%B %d %Y"  -> "October 04 2018"

"%B %e %Y"  -> "October  4 2018"

"%B %-d %Y" -> "October 4 2018"

https://gitlab.gnome.org/GNOME/gnome-shell/issues/666
2018-10-25 13:05:47 +02:00
Carmen Bianca Bakker
cff9eaf5aa Change a translator comment to be less ambiguous
https://gitlab.gnome.org/GNOME/gnome-shell/issues/666
2018-10-25 13:05:08 +02:00
Dušan Kazik
468117583a Update Slovak translation 2018-10-24 06:31:09 +00:00
Sebastian Pinnau
7026a6fd32 automountManager: Add handling of udisks errors for no/wrong passwords
If no password or a wrong password is entered after automounting an
encrypted device, then the password should be reasked. However, this
does not happen because the relevant udisks error messages for this
cases are missing in the exception handler that calls _reaskPassword.

Fix this issue by adding the relevant udisks error strings to the
exception handling in the _onVolumeMounted method.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/640
2018-10-24 00:13:10 +02:00
verdre
ceed3e07e4 build: Include params.js in portal-helper gresources
Fix a regression causing the portal helper to crash.
In 94423151b2 we moved the dbus interface
descriptions into seperate files which is why we had to include the
fileUtils js module. This module imports the params js module, so add
params.js to the gresources file for the portal helper.
2018-10-23 15:38:31 +00:00
Florian Müllner
a0dc8dc7ef panel: Also ignore hidden windows for proximity
We currently only ignore minimized windows, not windows that are
hidden for other reasons - namely on wayland windows are initially
hidden until they are placed.

This fixes a flicker in the transparent top bar on wayland when the
"position" of an unplaced window wrongly suggests the window is
overlapping the top bar.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/693
2018-10-23 16:24:22 +02:00
Carlos Garnacho
b405ed6442 keyboardManager: Avoid idempotent calls to meta_backend_set_keymap()
But still try to apply the keymap whenever the input sources changed. This
is a different approach to gnome-shell#240 that still avoid redundant
changes to the current keymap, but actually trigger one when input sources
are added.

https://bugzilla.redhat.com/show_bug.cgi?id=1637418

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/691
2018-10-23 09:45:02 +00:00
Florian Müllner
8566ec2ee5 osdWindow: Disconnect signals on destroy
Since we started to show OSD windows on all monitors, OSD windows are
destroyed when the corresponding monitor is disconnected. We shouldn't
leave any signal handlers around in that case - they prevent the object
from being garbage collected, and trigger warnings for accessing proper-
ties of invalidated GObjects.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/602
2018-10-22 14:58:50 +00:00
Didier Roche
ae7dd5e2db osdWindow: Ensure we setMaxLevel before setting Level itself
When maxLevel is > 100%, first OSD appearance was capping the current
level to 100%. Consecutives key press were then OK.
Ensure we setMaxLevel before setting Level itself, so that correct cap
value is applied.
2018-10-19 16:18:41 +02:00
Kristjan SCHMIDT
9f3c85fdc8 Update Esperanto translation 2018-10-16 21:02:53 +00:00
Sergio Costas
aa685310bb Fix enumeration in HACKING.md
The HACKING.md file contains an enumeration in the Indentation and
whitespace section, but the sentences look incorrectly divided.

This patch proposes a fix for that section, reordering all its
contents in a single enumeration, instead of a paragraph and
an enumeration, and also reconstruct the sentences.
2018-10-14 14:05:04 +02:00
Florian Müllner
76117fd306 appFolder: Don't block all shortcuts
App folder popups take a grab when opened, and as we don't pass any
particular pushModal() parameters, all keybindings are blocked. While
this makes sense for most keybindings that would interfere with the
popup interaction, others like volume/brightness keys or screenshots
can be allowed safely.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/648
2018-10-11 20:12:54 +02:00
Andrea Azzarone
8855622666 popupMenu: Handle keypress if numlock is enabled
Add exception to handle a keypress if numlock is enabled as we already do for
capslock. This uses Clutter.ModifierType.MOD2_MASK because at the moment there
is not a more explicit way to refer to the numlock mask.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/550
2018-10-11 07:45:44 +00:00
Georges Basile Stavracas Neto
655234e6c3 shell: Remove ShellGenericContainer
Now that it is no longer used in GNOME Shell, let's
remove this old workaround. This commit also removes
the docs reference from the sgml file.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:44:14 -03:00
Georges Basile Stavracas Neto
38c1ebba62 dash: expand and center align DashItemContainer
This is necessary to keep the small actor that shows up
during drag motion center aligned.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
557b232c89 panel: Delegate container destruction to PanelMenu.ButtonBox
Instead of taking care of the PanelMenu.ButtonBox.container
destruction by itself, delegate that to the very object that
created it in the first place: PanelMenu.ButtonBox itself.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
b719744e75 st-bin: Destroy child in ClutterActor:destroy vfunc
According to Clutter documentation, "[…] actors implementing the
ClutterContainer interface should override the default implementation
of the class handler of this signal and call clutter_actor_destroy()
on their  children."

StBin was doing that in GObject:dispose() instead. Move the child
destruction to a new ClutterActor:destroy() vfunc override.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
038f8b6ea5 keyboard: Stop using Shell.GenericContainer
This is the last remaining usage of Shell.GenericContainer
in the codebase, and posed small challenges compared to the
other removals.

A new St.Widget subclass called InputSourceIndicatorContainer
was added as a replacement to the Shell.GenericContainer. It
was needed because GNOME Shell needs to override the regular
size allocation functions, but InputSourceIndicator already
is a St.Widget with its own size allocation overrides.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
2ee321e0d8 tests: Stop using Shell.GenericContainer
The test doesn't look and behave like before, but they are
already broken in master anyway. This commit makes it work
without Shell.GenericContainer, but the test itself remains
to be fixed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
b4c674900f inspector: Stop using Shell.GenericContainer
No alarms and no surprises here.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
3fa19e58ac boxPointer: Stop using Shell.GenericContainer
An easy removal too.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
f460f2748d boxPointer: Add compatibility API
Because we're late in the cycle, and don't know how many
extensions actually rely on this API, this commit adds
back the BoxPointer.show() and .hide() functions, with
warning messages to notify consumers that this is going
to be removed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:43:01 -03:00
Georges Basile Stavracas Neto
8b215b2446 boxPointer: Rename show/hide to open/close
Pretty much like dd4709bb2, BoxPointer's show() and hide()
functions will clash with Clutter.Actor's ones.

In addition to that, on a conceptual level, the current API
is not great, because calling boxPointer.hide() won't result
in boxPointer.actor.visible == false.

For these reasons, rename show() and hide() to open() and
close(). A compatibility layer will be added in a following
commit, warning about the usage of show() and hide().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:53 -03:00
Georges Basile Stavracas Neto
0c0d76f7d6 loginDialog: Stop using Shell.GenericContainer
Removing the Shell.GenericContainer from the login dialog
was remarkably easier, since it only overrides 'allocate'.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
dd225713a1 layoutManager: Subclass GObject.Object
LayoutManager is currently a pure JavaScript class that
relies on the rudimentary Signals.addSignalMethods() to
handle signals. This is an inefficient implementation of
one of the most central classes in GNOME Shell.

In addition to removing Shell.GenericContainer, then,
turn LayoutManager into a proper GObject.Object subclass.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
f4682748fa layoutManager: Stop using Shell.GenericContainer
This one was remarkably easy to port. In order to make it,
replace the Shell.GenericContainer handlers by a constraint
and simply replace it by a St.Widget.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
b058e89166 workspaceSwitcherPopup: Stop using Shell.GenericContainer
Removing Shell.GenericContainer here was slightly trickier
because it required factoring out a new JavaScript class.

It's nevertheless a straightforward removal.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
ac314cfb05 messageTray: Drop Shell.GenericContainer usage
Nothing particularly outstanding with this class - it was
a straightforward removal and subclassing.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:26 -03:00
Georges Basile Stavracas Neto
fc342fe8c5 buttonBox: Drop Shell.GenericContainer usage
Another easy port.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
dd4709bb27 appMenuButton: Rename show/hide to fadeIn/fadeOut
In the next commit, we will turn PanelMenu.ButtonBox into a
St.Widget subclass. As a domino effect, PanelMenu.Button will
become one too, and so will Panel.AppMenuButton.

When that happens, the current show() and hide() functions in
Panel.AppMenuButton will clash with Clutter.Actor's ones.

To avoid that, rename these functions to fadeIn() and fadeOut()
and avoid a name clash.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
e9f4f2e8ae thumbnailBox: Stop using Shell.GenericContainer
This is another straight port from Shell.GenericContainer.
The important thing to notice is that the calculation is
broken if the StThemeNode helpers (adjust_preferred_* and
adjust_for_*) aren't used.

The downside of this patch is that it removed the skip_paint
from the thumbnails. Keeping it would add an unecessarily
large amount of code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
197c0eee29 iconGrid: Stop using Shell.GenericContainer
Removing Shell.GenericContainer from the IconGrid class was
challenging because it needs the "skip paint" API from it.
This API was added, too, as a workaround to the inability
to override vfuncs from GJS.

The overrides are largely copy-pasted and translated versions
of the Shell.GenericContainer code.

The IconGrid:key-focus-in signal was renamed to :child-focused
to avoid clashing with ClutterActor:key-focus-in.

In GridSearchResults, the internal IconGrid had it's y_expand
set to false, so it doesn't push other search elements (the
list results mainly) to the bottom of the screen.

Because skip paint wasn't and still isn't a GObject property,
rename it to _skipPaint to reflect that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
034a723677 iconGrid: Rename ::key-focus-in signal
As part of our quest to obsolete Shell.GenericContainer, IconGrid will
become a Clutter.Actor subclass. As the ::key-focus-in signal would
clash with Clutter.Actor::key-focus-in, rename it to ::child-focused.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Georges Basile Stavracas Neto
efb3025d8c dash: Set scale and opacity on parent actor
DashItemContainer currently animates the scale and opacity
of its child when zooming in. This is visible when adding
a new favorite item to the dash; the items will zoom in from
the center.

After the previous commit, however, the zoom animation got
slightly broken, and looked like the icon was coming from
the bottom instead of the center.

Fix that by setting the scale and opacity of DashItemContainer
itself, instead of its child. Remove the unused code after that
too.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
81ec8215a0 baseIcon: Stop using Shell.GenericContainer
Pretty much like the previous patches, this extends St.Bin. The
most interesting aspect of this patch is that most of the sizing
routines of the icons is now delegated to the actors and layout
managers, removing quite a bunch of code.

The 'spacing' theme property is now redirected to StBoxLayout's
spacing property. Also adjust the Dash code to stop forcing a
potentially invalid width in the first icon too.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
4be66ecf01 windowIcon: Subclass St.BoxLayout
Following the previous work, turn WindowIcon into a
St.BoxLayout subclass, and remove the this.actor
field from it.
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
2717ca9d08 st-box-layout: Pass correct allocation box to layout manager
StBoxLayout implements StScrollable, which, semantically, means that
the StBoxLayout size may not match the minimum size reported by the
layout manager. In this specific case, the layout manager by is a
ClutterBoxLayout by default. For example:

        +--------------+
        |   Viewport   |
 +------+--------------+-----------------+
 |      |              |                 |
 |      |              |     Content     |
 |      |              |                 |
 +------+--------------+-----------------+
        |              |
        +--------------+

So, assuming that:

 - ContentSize = the minimum size of the content;
 - ViewportSize = the allocated size of the viewport;

When allocating StBoxLayout, it must assume ViewportSize, but must
pass ContentSize to the layout manager. That way, the children of
StBoxLayout are correctly placed within it, even if it's bigger than
ViewportSize.

And here's the problem: right now, StBoxLayout assumes ViewportSize
AND also passes it to layout manager. Commit 77c4c6b6d specifically
exposed this bug by relying entirely on StBoxLayout to arrange the
app and window icons.

Fix that by using ViewportSize to allocate StBoxLayout itself, but
passing ContentSize to the layout manager.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
c6cea277eb switcherList: Stop using Shell.GenericContainer
This commit removes all the uses of Shell.GenericContainer from
SwitcherPopup.SwitcherList. Compared to the other patches, this
one was specially trickier to get right, and a few invasive
changes needed to be done.

The most noticeable one is that the allocation of the items is
done entirely by St.BoxLayout -- we don't manually allocate them
anymore. To make it work, get_preferred_width() had to calculate
the correct value. It now assumes that:

 * Minimum width: the minimum width of the widest child.
 * Natural width: the minimum width of the StBoxLayout (use it
   instead of the natural width to force the labels to ellipsize
   when too long.)

The AppIcon class became a St.Widget subclass as well, to override
get_preferred_width() and be able to keep the squared shape.

Besides that, add a new SwitcherButton class to reimplement squared
icons without having to resort to hacks in the size allocation
machinery. This class has a single vfunc override to ensure that it
is squared when the SwitcherList is.

The arrows indicating multiple windows are now in this._list
actor to the SwitcherPopup itself, since this._list automatically
manages its own children now.

At last, adapt (but preserve) the hack in CyclerPopup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
9a47b4b343 switcherList: Remove unused variable
The title is self-explanatory, 'primary' was not being used
anywhere.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:24 -03:00
Georges Basile Stavracas Neto
0ec36fc5cf switcherPopup: Use MonitorConstraint instead of vfunc overrides
Instead of overriding vfunc_get_preferred_width|height(), use the
already available Layout.MonitorConstraint to bind SwitcherPopup
to the primary monitor.
2018-10-08 22:42:23 -03:00
Georges Basile Stavracas Neto
a315e75e95 switcherPopup: Subclass St.Widget
This commit turns SwitcherPopup.SwitcherPopup into a St.Widget
subclass, and gets rid of Shell.GenericContainer usage. Subclasses
were adapted to that too.

This class introduced a new challenge: it overrides show(). As per
discussions, we now call this.visible = true inside show().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
Georges Basile Stavracas Neto
e82c68accd switcherPopup: Rename destroy() to fadeAndDestroy()
In the process of purging all usages of Shell.GenericContainer
of GNOME Shell, one specific problematic situation that might
occur is when classes have functions that would clash with any
ClutterActor or StWidget function name.

One of such example is SwitcherPopup.destroy(). Right now, this
class is a pure JavaScript class that wraps a real actor, but
soon this will change, and it'll become a St.Widget subclass.

Another problem with functions that mimic the toolkit ones is
the predictability of them; after calling destroy(), that widget
is expected to not be available anymore. In SwitcherPopup case,
it is still available for a short while. In this case, that's not
a big problem, but the show() and hide() functions in other clases
are more problematic because the actor's visibility does not
follow that.

This commit is a first step in cleaning that up, and changes the
SwitcherPopup.destroy() to fadeAndDestroy().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
Georges Basile Stavracas Neto
286ffbe2b6 panel: Stop using Shell.GenericContainer
Shell.GenericContainer exposes the size negotiation machinery
through the use of signals. Signals are not specially performant.
One of the reasons is that they acquire a global lock for signal
handlers lookup. GNOME Shell has more than 2,000 actors at any
given point in time, up to 20 levels deep in hierarchy, making
size negotiation and painting non-trivial tasks. Such a critical
section of Clutter's machinery shouldn't rely on signals
whatsoever.

Regardless of that, Shell.GenericContainer is a workaround to
a non-existing issue anymore. It shouldn't be used anyway, and
any performance improvements that removing it can potentially
yield are bonuses to it.

This commit starts this work by removing Shell.GenericContainer
usage from Panel.Panel class. The class now extends St.Widget,
and as such, it has no "this.actor" field set anymore. A couple
of places where this actor field was used are adjuste as well.

It is important to notice that we now allocate the Panel itself
inside vfunc_allocate(). This was previously done before emitting
the signal by Shell.GenericContainer.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:23 -03:00
100 changed files with 5980 additions and 9117 deletions

View File

@@ -10,15 +10,15 @@ Life isn't fun if you can't break the rules. If a rule seems unnecessarily
restrictive while you're coding, ignore it, and let the patch reviewer decide
what to do.
## Indentation and whitespace
## Indentation, braces and whitespace
Use four-space indents. Braces are on the same line as their associated
statements. You should only omit braces if *both* sides of the statement are
on one line.
* Use four-space indents.
* Braces are on the same line as their associated statements.
* You should only omit braces if *both* sides of the statement are on one line.
* One space after the `function` keyword.
* No space between the function name in a declaration or a call.
* One space before the parens in the `if` statements, or `while`, or `for` loops.
* One space after the `function` keyword. No space between the function name
* in a declaration or a call. One space before the parens in the `if`
* statements, or `while`, or `for` loops.
```javascript
function foo(a, b) {
let bar;

25
NEWS
View File

@@ -1,3 +1,28 @@
3.31.2
======
* Port away from and remove ShellGenericContainer [Georges; !153]
* popupMenu: Fix keyboard activation when numlock is active [Andrea; #550]
* Do not block all shortcuts while app folders are expanded [Florian; #648]
* Fix regression in handling new input sources [Carlos; #691]
* Reask password after udisk errors for no/wrong passwords [Sebastian; #640]
* Improve performance of app icon animations [Daniel; !253, !261]
* Avoid focus changes when updating keyboard options [Takao; #391]
* notifications: Support icon theme names in 'image-path' hint [Marco; !285]
* Respect natural-scroll setting for workspace swipe gesture [Erik; #516]
* Confine window preview titles to workspace area [Florian; !214]
* Misc. bug fixes [Florian, Carmen, Georges, Cosimo, Carlos; #602, #693,
#666, #647, !66, #768, #430, !286, !258, !287, gtk#1447]
Contributors:
Andrea Azzarone, Carmen Bianca Bakker, Cosimo Cecchi, Sergio Costas,
Erik Duxstad, Takao Fujiwara, Carlos Garnacho, Florian Müllner,
Georges Basile Stavracas Neto, Sebastian Pinnau, Didier Roche, Jakub Steiner,
Marco Trevisan (Treviño), verdre, Daniel van Vugt
Translators:
Kristjan SCHMIDT [eo], Dušan Kazik [sk], Matej Urbančič [sl],
Anish Sheela [ml], Rafael Fontenelle [pt_BR], Daniel Mustieles [es]
3.30.1
======
* Cancel search on overview hiding [Marco; !205]

View File

@@ -1,17 +0,0 @@
The GNOME Shell Browser Plugin provides integration with gnome-shell and the
corresponding extensions repository, codenamed "SweetTooth". The plugin allows
the extensions repository to provide good integration, letting the website
know which extensions are enabled and disabled, and allowing the website to
enable, disable and install them.
Bugs should be reported to the GNOME [bug tracking system][bug-tracker].
## License
The GNOME Shell Browser Plugin, like GNOME Shell itself is distributed under
the GNU General Public License, version 2 or later. The plugin also contains
header files from the "NPAPI SDK" project, tri-licensed under MPL 1.1, GPL 2.0
and LGPL 2.1. These headers are third-party sources and can be retrieved from:
http://code.google.com/p/npapi-sdk/
[bug-tracker]: https://gitlab.gnome.org/GNOME/gnome-shell/issues

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
plugin_sources = [
'browser-plugin.c',
'npapi/npapi.h',
'npapi/npfunctions.h',
'npapi/npruntime.h',
'npapi/nptypes.h'
]
shared_module('gnome-shell-browser-plugin', plugin_sources,
dependencies: [gio_dep, json_glib_dep],
c_args: ['-DG_LOG_DOMAIN="GnomeShellBrowserPlugin"'],
# Browsers can unload and reload the module while browsing, which is not
# supported by GObject.
# We pass -Wl,-z,nodelete to the linker to ensure the module is never
# unloaded. See https://bugzilla.gnome.org/show_bug.cgi?id=737932.
link_args: ['-Wl,-z,nodelete'],
install: true,
install_dir: plugindir
)

View File

@@ -1,893 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef npapi_h_
#define npapi_h_
#if defined(__OS2__)
#pragma pack(1)
#endif
#include "nptypes.h"
#if defined(__OS2__) || defined(OS2)
#ifndef XP_OS2
#define XP_OS2 1
#endif
#endif
#if defined(_WIN32) && !defined(__SYMBIAN32__)
#include <windef.h>
#ifndef XP_WIN
#define XP_WIN 1
#endif
#endif
#if defined(__SYMBIAN32__)
#ifndef XP_SYMBIAN
#define XP_SYMBIAN 1
#undef XP_WIN
#endif
#endif
#if defined(__APPLE_CC__) && !defined(XP_UNIX)
#ifndef XP_MACOSX
#define XP_MACOSX 1
#endif
#endif
#if defined(XP_MACOSX) && defined(__LP64__)
#define NP_NO_QUICKDRAW
#define NP_NO_CARBON
#endif
#if defined(XP_MACOSX)
#include <ApplicationServices/ApplicationServices.h>
#include <OpenGL/OpenGL.h>
#ifndef NP_NO_CARBON
#include <Carbon/Carbon.h>
#endif
#endif
#if defined(XP_UNIX)
#include <stdio.h>
#if defined(MOZ_X11)
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#endif
#if defined(XP_SYMBIAN)
#include <QEvent>
#include <QRegion>
#endif
/*----------------------------------------------------------------------*/
/* Plugin Version Constants */
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
#define NP_VERSION_MINOR 27
/* The OS/2 version of Netscape uses RC_DATA to define the
mime types, file extensions, etc that are required.
Use a vertical bar to separate types, end types with \0.
FileVersion and ProductVersion are 32bit ints, all other
entries are strings that MUST be terminated with a \0.
AN EXAMPLE:
RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
RCDATA NP_INFO_MIMEType { "video/x-video|",
"video/x-flick\0" }
RCDATA NP_INFO_FileExtents { "avi|",
"flc\0" }
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
"MMOS2 Flc/Fli player(*.flc)\0" }
RCDATA NP_INFO_FileVersion { 1,0,0,1 }
RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
RCDATA NP_INFO_InternalName { "NPAVI32\0" )
RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
*/
/* RC_DATA types for version info - required */
#define NP_INFO_ProductVersion 1
#define NP_INFO_MIMEType 2
#define NP_INFO_FileOpenName 3
#define NP_INFO_FileExtents 4
/* RC_DATA types for version info - used if found */
#define NP_INFO_FileDescription 5
#define NP_INFO_ProductName 6
/* RC_DATA types for version info - optional */
#define NP_INFO_CompanyName 7
#define NP_INFO_FileVersion 8
#define NP_INFO_InternalName 9
#define NP_INFO_LegalCopyright 10
#define NP_INFO_OriginalFilename 11
#ifndef RC_INVOKED
/*----------------------------------------------------------------------*/
/* Definition of Basic Types */
/*----------------------------------------------------------------------*/
typedef unsigned char NPBool;
typedef int16_t NPError;
typedef int16_t NPReason;
typedef char* NPMIMEType;
/*----------------------------------------------------------------------*/
/* Structures and definitions */
/*----------------------------------------------------------------------*/
#if !defined(__LP64__)
#if defined(XP_MACOSX)
#pragma options align=mac68k
#endif
#endif /* __LP64__ */
/*
* NPP is a plug-in's opaque instance handle
*/
typedef struct _NPP
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
} NPP_t;
typedef NPP_t* NPP;
typedef struct _NPStream
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
const char* url;
uint32_t end;
uint32_t lastmodified;
void* notifyData;
const char* headers; /* Response headers from host.
* Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
* Used for HTTP only; NULL for non-HTTP.
* Available from NPP_NewStream onwards.
* Plugin should copy this data before storing it.
* Includes HTTP status line and all headers,
* preferably verbatim as received from server,
* headers formatted as in HTTP ("Header: Value"),
* and newlines (\n, NOT \r\n) separating lines.
* Terminated by \n\0 (NOT \n\n\0). */
} NPStream;
typedef struct _NPByteRange
{
int32_t offset; /* negative offset means from the end */
uint32_t length;
struct _NPByteRange* next;
} NPByteRange;
typedef struct _NPSavedData
{
int32_t len;
void* buf;
} NPSavedData;
typedef struct _NPRect
{
uint16_t top;
uint16_t left;
uint16_t bottom;
uint16_t right;
} NPRect;
typedef struct _NPSize
{
int32_t width;
int32_t height;
} NPSize;
typedef enum {
NPFocusNext = 0,
NPFocusPrevious = 1
} NPFocusDirection;
/* Return values for NPP_HandleEvent */
#define kNPEventNotHandled 0
#define kNPEventHandled 1
/* Exact meaning must be spec'd in event model. */
#define kNPEventStartIME 2
#if defined(XP_UNIX)
/*
* Unix specific structures and definitions
*/
/*
* Callback Structures.
*
* These are used to pass additional platform specific information.
*/
enum {
NP_SETWINDOW = 1,
NP_PRINT
};
typedef struct
{
int32_t type;
} NPAnyCallbackStruct;
typedef struct
{
int32_t type;
#if defined(MOZ_X11)
Display* display;
Visual* visual;
Colormap colormap;
unsigned int depth;
#endif
} NPSetWindowCallbackStruct;
typedef struct
{
int32_t type;
FILE* fp;
} NPPrintCallbackStruct;
#endif /* XP_UNIX */
#if defined(XP_MACOSX)
typedef enum {
#ifndef NP_NO_QUICKDRAW
NPDrawingModelQuickDraw = 0,
#endif
NPDrawingModelCoreGraphics = 1,
NPDrawingModelOpenGL = 2,
NPDrawingModelCoreAnimation = 3,
NPDrawingModelInvalidatingCoreAnimation = 4
} NPDrawingModel;
typedef enum {
#ifndef NP_NO_CARBON
NPEventModelCarbon = 0,
#endif
NPEventModelCocoa = 1
} NPEventModel;
#endif
/*
* The following masks are applied on certain platforms to NPNV and
* NPPV selectors that pass around pointers to COM interfaces. Newer
* compilers on some platforms may generate vtables that are not
* compatible with older compilers. To prevent older plugins from
* not understanding a new browser's ABI, these masks change the
* values of those selectors on those platforms. To remain backwards
* compatible with different versions of the browser, plugins can
* use these masks to dynamically determine and use the correct C++
* ABI that the browser is expecting. This does not apply to Windows
* as Microsoft's COM ABI will likely not change.
*/
#define NP_ABI_GCC3_MASK 0x10000000
/*
* gcc 3.x generated vtables on UNIX and OSX are incompatible with
* previous compilers.
*/
#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
#else
#define _NP_ABI_MIXIN_FOR_GCC3 0
#endif
#if defined(XP_MACOSX)
#define NP_ABI_MACHO_MASK 0x01000000
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
#else
#define _NP_ABI_MIXIN_FOR_MACHO 0
#endif
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
/*
* List of variable names for which NPP_GetValue shall be implemented
*/
typedef enum {
NPPVpluginNameString = 1,
NPPVpluginDescriptionString,
NPPVpluginWindowBool,
NPPVpluginTransparentBool,
NPPVjavaClass,
NPPVpluginWindowSize,
NPPVpluginTimerInterval,
NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
NPPVpluginScriptableIID = 11,
NPPVjavascriptPushCallerBool = 12,
NPPVpluginKeepLibraryInMemory = 13,
NPPVpluginNeedsXEmbed = 14,
/* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14.
*/
NPPVpluginScriptableNPObject = 15,
/* Get the plugin value (as \0-terminated UTF-8 string data) for
* form submission if the plugin is part of a form. Use
* NPN_MemAlloc() to allocate memory for the string data. Introduced
* in NPAPI minor version 15.
*/
NPPVformValue = 16,
NPPVpluginUrlRequestsDisplayedBool = 17,
/* Checks if the plugin is interested in receiving the http body of
* all http requests (including failed ones, http status != 200).
*/
NPPVpluginWantsAllNetworkStreams = 18,
/* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
NPPVpluginNativeAccessibleAtkPlugId = 19,
/* Checks to see if the plug-in would like the browser to load the "src" attribute. */
NPPVpluginCancelSrcStream = 20,
NPPVsupportsAdvancedKeyHandling = 21,
NPPVpluginUsesDOMForCursorBool = 22
#if defined(XP_MACOSX)
/* Used for negotiating drawing models */
, NPPVpluginDrawingModel = 1000
/* Used for negotiating event models */
, NPPVpluginEventModel = 1001
/* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */
, NPPVpluginCoreAnimationLayer = 1003
#endif
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
, NPPVpluginWindowlessLocalBool = 2002
#endif
} NPPVariable;
/*
* List of variable names for which NPN_GetValue should be implemented.
*/
typedef enum {
NPNVxDisplay = 1,
NPNVxtAppContext,
NPNVnetscapeWindow,
NPNVjavascriptEnabledBool,
NPNVasdEnabledBool,
NPNVisOfflineBool,
NPNVserviceManager = (10 | NP_ABI_MASK),
NPNVDOMElement = (11 | NP_ABI_MASK),
NPNVDOMWindow = (12 | NP_ABI_MASK),
NPNVToolkit = (13 | NP_ABI_MASK),
NPNVSupportsXEmbedBool = 14,
/* Get the NPObject wrapper for the browser window. */
NPNVWindowNPObject = 15,
/* Get the NPObject wrapper for the plugins DOM element. */
NPNVPluginElementNPObject = 16,
NPNVSupportsWindowless = 17,
NPNVprivateModeBool = 18,
NPNVsupportsAdvancedKeyHandling = 21
#if defined(XP_MACOSX)
/* Used for negotiating drawing models */
, NPNVpluginDrawingModel = 1000
#ifndef NP_NO_QUICKDRAW
, NPNVsupportsQuickDrawBool = 2000
#endif
, NPNVsupportsCoreGraphicsBool = 2001
, NPNVsupportsOpenGLBool = 2002
, NPNVsupportsCoreAnimationBool = 2003
, NPNVsupportsInvalidatingCoreAnimationBool = 2004
#ifndef NP_NO_CARBON
, NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
#endif
, NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
, NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated
Cocoa text input specification. */
, NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
CA model compositing */
#endif
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
, NPNVSupportsWindowlessLocal = 2002
#endif
} NPNVariable;
typedef enum {
NPNURLVCookie = 501,
NPNURLVProxy
} NPNURLVariable;
/*
* The type of Toolkit the widgets use
*/
typedef enum {
NPNVGtk12 = 1,
NPNVGtk2
} NPNToolkitType;
/*
* The type of a NPWindow - it specifies the type of the data structure
* returned in the window field.
*/
typedef enum {
NPWindowTypeWindow = 1,
NPWindowTypeDrawable
} NPWindowType;
typedef struct _NPWindow
{
void* window; /* Platform specific window handle */
/* OS/2: x - Position of bottom left corner */
/* OS/2: y - relative to visible netscape window */
int32_t x; /* Position of top left corner relative */
int32_t y; /* to a netscape page. */
uint32_t width; /* Maximum window size */
uint32_t height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX)
void * ws_info; /* Platform-dependent additional data */
#endif /* XP_UNIX */
NPWindowType type; /* Is this a window or a drawable? */
} NPWindow;
typedef struct _NPImageExpose
{
char* data; /* image pointer */
int32_t stride; /* Stride of data image pointer */
int32_t depth; /* Depth of image pointer */
int32_t x; /* Expose x */
int32_t y; /* Expose y */
uint32_t width; /* Expose width */
uint32_t height; /* Expose height */
NPSize dataSize; /* Data buffer size */
float translateX; /* translate X matrix value */
float translateY; /* translate Y matrix value */
float scaleX; /* scale X matrix value */
float scaleY; /* scale Y matrix value */
} NPImageExpose;
typedef struct _NPFullPrint
{
NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
NPBool printOne; /* TRUE if plugin should print one copy to default
printer */
void* platformPrint; /* Platform-specific printing info */
} NPFullPrint;
typedef struct _NPEmbedPrint
{
NPWindow window;
void* platformPrint; /* Platform-specific printing info */
} NPEmbedPrint;
typedef struct _NPPrint
{
uint16_t mode; /* NP_FULL or NP_EMBED */
union
{
NPFullPrint fullPrint; /* if mode is NP_FULL */
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
} print;
} NPPrint;
#if defined(XP_MACOSX)
#ifndef NP_NO_CARBON
typedef EventRecord NPEvent;
#endif
#elif defined(XP_SYMBIAN)
typedef QEvent NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16_t event;
uintptr_t wParam;
uintptr_t lParam;
} NPEvent;
#elif defined(XP_OS2)
typedef struct _NPEvent
{
uint32_t event;
uint32_t wParam;
uint32_t lParam;
} NPEvent;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
#endif
#if defined(XP_MACOSX)
typedef void* NPRegion;
#ifndef NP_NO_QUICKDRAW
typedef RgnHandle NPQDRegion;
#endif
typedef CGPathRef NPCGRegion;
#elif defined(XP_WIN)
typedef HRGN NPRegion;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef Region NPRegion;
#elif defined(XP_SYMBIAN)
typedef QRegion* NPRegion;
#else
typedef void *NPRegion;
#endif
typedef struct _NPNSString NPNSString;
typedef struct _NPNSWindow NPNSWindow;
typedef struct _NPNSMenu NPNSMenu;
#if defined(XP_MACOSX)
typedef NPNSMenu NPMenu;
#else
typedef void *NPMenu;
#endif
typedef enum {
NPCoordinateSpacePlugin = 1,
NPCoordinateSpaceWindow,
NPCoordinateSpaceFlippedWindow,
NPCoordinateSpaceScreen,
NPCoordinateSpaceFlippedScreen
} NPCoordinateSpace;
#if defined(XP_MACOSX)
#ifndef NP_NO_QUICKDRAW
typedef struct NP_Port
{
CGrafPtr port;
int32_t portx; /* position inside the topmost window */
int32_t porty;
} NP_Port;
#endif /* NP_NO_QUICKDRAW */
/*
* NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics
* as its drawing model.
*/
typedef struct NP_CGContext
{
CGContextRef context;
void *window; /* A WindowRef under the Carbon event model. */
} NP_CGContext;
/*
* NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
* drawing model.
*/
typedef struct NP_GLContext
{
CGLContextObj context;
#ifdef NP_NO_CARBON
NPNSWindow *window;
#else
void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
#endif
} NP_GLContext;
typedef enum {
NPCocoaEventDrawRect = 1,
NPCocoaEventMouseDown,
NPCocoaEventMouseUp,
NPCocoaEventMouseMoved,
NPCocoaEventMouseEntered,
NPCocoaEventMouseExited,
NPCocoaEventMouseDragged,
NPCocoaEventKeyDown,
NPCocoaEventKeyUp,
NPCocoaEventFlagsChanged,
NPCocoaEventFocusChanged,
NPCocoaEventWindowFocusChanged,
NPCocoaEventScrollWheel,
NPCocoaEventTextInput
} NPCocoaEventType;
typedef struct _NPCocoaEvent {
NPCocoaEventType type;
uint32_t version;
union {
struct {
uint32_t modifierFlags;
double pluginX;
double pluginY;
int32_t buttonNumber;
int32_t clickCount;
double deltaX;
double deltaY;
double deltaZ;
} mouse;
struct {
uint32_t modifierFlags;
NPNSString *characters;
NPNSString *charactersIgnoringModifiers;
NPBool isARepeat;
uint16_t keyCode;
} key;
struct {
CGContextRef context;
double x;
double y;
double width;
double height;
} draw;
struct {
NPBool hasFocus;
} focus;
struct {
NPNSString *text;
} text;
} data;
} NPCocoaEvent;
#ifndef NP_NO_CARBON
/* Non-standard event types that can be passed to HandleEvent */
enum NPEventType {
NPEventType_GetFocusEvent = (osEvt + 16),
NPEventType_LoseFocusEvent,
NPEventType_AdjustCursorEvent,
NPEventType_MenuCommandEvent,
NPEventType_ClippingChangedEvent,
NPEventType_ScrollingBeginsEvent = 1000,
NPEventType_ScrollingEndsEvent
};
#endif /* NP_NO_CARBON */
#endif /* XP_MACOSX */
/*
* Values for mode passed to NPP_New:
*/
#define NP_EMBED 1
#define NP_FULL 2
/*
* Values for stream type passed to NPP_NewStream:
*/
#define NP_NORMAL 1
#define NP_SEEK 2
#define NP_ASFILE 3
#define NP_ASFILEONLY 4
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
/*
* Flags for NPP_ClearSiteData.
*/
#define NP_CLEAR_ALL 0
#define NP_CLEAR_CACHE (1 << 0)
#if !defined(__LP64__)
#if defined(XP_MACOSX)
#pragma options align=reset
#endif
#endif /* __LP64__ */
/*----------------------------------------------------------------------*/
/* Error and Reason Code definitions */
/*----------------------------------------------------------------------*/
/*
* Values of type NPError:
*/
#define NPERR_BASE 0
#define NPERR_NO_ERROR (NPERR_BASE + 0)
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
#define NPERR_INVALID_URL (NPERR_BASE + 10)
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
#define NPERR_NO_DATA (NPERR_BASE + 12)
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
#define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
/*
* Values of type NPReason:
*/
#define NPRES_BASE 0
#define NPRES_DONE (NPRES_BASE + 0)
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
#define NPRES_USER_BREAK (NPRES_BASE + 2)
/*
* Don't use these obsolete error codes any more.
*/
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
/*
* Version feature information
*/
#define NPVERS_HAS_STREAMOUTPUT 8
#define NPVERS_HAS_NOTIFICATION 9
#define NPVERS_HAS_LIVECONNECT 9
#define NPVERS_68K_HAS_LIVECONNECT 11
#define NPVERS_HAS_WINDOWLESS 11
#define NPVERS_HAS_XPCONNECT_SCRIPTING 13
#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14
#define NPVERS_HAS_FORM_VALUES 15
#define NPVERS_HAS_POPUPS_ENABLED_STATE 16
#define NPVERS_HAS_RESPONSE_HEADERS 17
#define NPVERS_HAS_NPOBJECT_ENUM 18
#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
#define NPVERS_HAS_ALL_NETWORK_STREAMS 20
#define NPVERS_HAS_URL_AND_AUTH_INFO 21
#define NPVERS_HAS_PRIVATE_MODE 22
#define NPVERS_MACOSX_HAS_COCOA_EVENTS 23
#define NPVERS_HAS_ADVANCED_KEY_HANDLING 25
#define NPVERS_HAS_URL_REDIRECT_HANDLING 26
#define NPVERS_HAS_CLEAR_SITE_DATA 27
/*----------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------*/
#if defined(__OS2__)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* NPP_* functions are provided by the plugin and called by the navigator. */
#if defined(XP_UNIX)
const char* NPP_GetMIMEDescription(void);
#endif
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16_t mode, int16_t argc, char* argn[],
char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16_t* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
int32_t len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
void NP_LOADDS NPP_LostFocus(NPP instance);
void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
char** NP_LOADDS NPP_GetSitesWithData(void);
/* NPN_* functions are provided by the navigator and called by the plugin. */
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor);
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
const char* target, void* notifyData);
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
const char* target);
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32_t len,
const char* buf, NPBool file,
void* notifyData);
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
const char* target, uint32_t len,
const char* buf, NPBool file);
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream);
int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
void* buffer);
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
void NP_LOADDS NPN_Status(NPP instance, const char* message);
const char* NP_LOADDS NPN_UserAgent(NPP instance);
void* NP_LOADDS NPN_MemAlloc(uint32_t size);
void NP_LOADDS NPN_MemFree(void* ptr);
uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
void *value);
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
void *value);
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
void NP_LOADDS NPN_InvalidateRegion(NPP instance,
NPRegion invalidRegion);
void NP_LOADDS NPN_ForceRedraw(NPP instance);
void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
void (*func) (void *),
void *userData);
NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
const char *url, char **value,
uint32_t *len);
NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
const char *url, const char *value,
uint32_t len);
NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
const char *protocol,
const char *host, int32_t port,
const char *scheme,
const char *realm,
char **username, uint32_t *ulen,
char **password,
uint32_t *plen);
uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* RC_INVOKED */
#if defined(__OS2__)
#pragma pack()
#endif
#endif /* npapi_h_ */

View File

@@ -1,322 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef npfunctions_h_
#define npfunctions_h_
#ifdef __OS2__
#pragma pack(1)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#include "npapi.h"
#include "npruntime.h"
typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
/* Any NPObjects returned to the browser via NPP_GetValue should be retained
by the plugin on the way out. The browser is responsible for releasing. */
typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't
depend on it sticking around and don't free it. */
typedef const char* (*NPN_UserAgentProcPtr)(NPP instance);
typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
typedef void (*NPN_MemFreeProcPtr)(void* ptr);
typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
typedef void* (*NPN_GetJavaEnvProcPtr)(void);
typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name);
typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers);
typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid);
typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier);
typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier);
typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier);
typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass);
typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj);
typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj);
typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant);
typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message);
typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled);
typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp);
typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData);
typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len);
typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len);
typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen);
typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID);
typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu);
typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);
typedef struct _NPPluginFuncs {
uint16_t size;
uint16_t version;
NPP_NewProcPtr newp;
NPP_DestroyProcPtr destroy;
NPP_SetWindowProcPtr setwindow;
NPP_NewStreamProcPtr newstream;
NPP_DestroyStreamProcPtr destroystream;
NPP_StreamAsFileProcPtr asfile;
NPP_WriteReadyProcPtr writeready;
NPP_WriteProcPtr write;
NPP_PrintProcPtr print;
NPP_HandleEventProcPtr event;
NPP_URLNotifyProcPtr urlnotify;
void* javaClass;
NPP_GetValueProcPtr getvalue;
NPP_SetValueProcPtr setvalue;
NPP_GotFocusPtr gotfocus;
NPP_LostFocusPtr lostfocus;
NPP_URLRedirectNotifyPtr urlredirectnotify;
NPP_ClearSiteDataPtr clearsitedata;
NPP_GetSitesWithDataPtr getsiteswithdata;
} NPPluginFuncs;
typedef struct _NPNetscapeFuncs {
uint16_t size;
uint16_t version;
NPN_GetURLProcPtr geturl;
NPN_PostURLProcPtr posturl;
NPN_RequestReadProcPtr requestread;
NPN_NewStreamProcPtr newstream;
NPN_WriteProcPtr write;
NPN_DestroyStreamProcPtr destroystream;
NPN_StatusProcPtr status;
NPN_UserAgentProcPtr uagent;
NPN_MemAllocProcPtr memalloc;
NPN_MemFreeProcPtr memfree;
NPN_MemFlushProcPtr memflush;
NPN_ReloadPluginsProcPtr reloadplugins;
NPN_GetJavaEnvProcPtr getJavaEnv;
NPN_GetJavaPeerProcPtr getJavaPeer;
NPN_GetURLNotifyProcPtr geturlnotify;
NPN_PostURLNotifyProcPtr posturlnotify;
NPN_GetValueProcPtr getvalue;
NPN_SetValueProcPtr setvalue;
NPN_InvalidateRectProcPtr invalidaterect;
NPN_InvalidateRegionProcPtr invalidateregion;
NPN_ForceRedrawProcPtr forceredraw;
NPN_GetStringIdentifierProcPtr getstringidentifier;
NPN_GetStringIdentifiersProcPtr getstringidentifiers;
NPN_GetIntIdentifierProcPtr getintidentifier;
NPN_IdentifierIsStringProcPtr identifierisstring;
NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
NPN_IntFromIdentifierProcPtr intfromidentifier;
NPN_CreateObjectProcPtr createobject;
NPN_RetainObjectProcPtr retainobject;
NPN_ReleaseObjectProcPtr releaseobject;
NPN_InvokeProcPtr invoke;
NPN_InvokeDefaultProcPtr invokeDefault;
NPN_EvaluateProcPtr evaluate;
NPN_GetPropertyProcPtr getproperty;
NPN_SetPropertyProcPtr setproperty;
NPN_RemovePropertyProcPtr removeproperty;
NPN_HasPropertyProcPtr hasproperty;
NPN_HasMethodProcPtr hasmethod;
NPN_ReleaseVariantValueProcPtr releasevariantvalue;
NPN_SetExceptionProcPtr setexception;
NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
NPN_EnumerateProcPtr enumerate;
NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
NPN_ConstructProcPtr construct;
NPN_GetValueForURLPtr getvalueforurl;
NPN_SetValueForURLPtr setvalueforurl;
NPN_GetAuthenticationInfoPtr getauthenticationinfo;
NPN_ScheduleTimerPtr scheduletimer;
NPN_UnscheduleTimerPtr unscheduletimer;
NPN_PopUpContextMenuPtr popupcontextmenu;
NPN_ConvertPointPtr convertpoint;
NPN_HandleEventPtr handleevent;
NPN_UnfocusInstancePtr unfocusinstance;
NPN_URLRedirectResponsePtr urlredirectresponse;
} NPNetscapeFuncs;
#ifdef XP_MACOSX
/*
* Mac OS X version(s) of NP_GetMIMEDescription(const char *)
* These can be called to retreive MIME information from the plugin dynamically
*
* Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
* to get mime info from the plugin only on OSX and may not be supported
* in furture version -- use NP_GetMIMEDescription instead
*/
enum
{
kBPSupportedMIMETypesStructVers_1 = 1
};
typedef struct _BPSupportedMIMETypes
{
SInt32 structVersion; /* struct version */
Handle typeStrings; /* STR# formated handle, allocated by plug-in */
Handle infoStrings; /* STR# formated handle, allocated by plug-in */
} BPSupportedMIMETypes;
OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
#endif
#if defined(_WIN32)
#define OSCALL WINAPI
#else
#if defined(__OS2__)
#define OSCALL _System
#else
#define OSCALL
#endif
#endif
#if defined(XP_UNIX)
/* GCC 3.3 and later support the visibility attribute. */
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define NP_VISIBILITY_DEFAULT __global
#else
#define NP_VISIBILITY_DEFAULT
#endif
#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
#endif
#if defined(_WIN32) || defined (__OS2__)
#ifdef __cplusplus
extern "C" {
#endif
/* plugin meta member functions */
#if defined(__OS2__)
typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
char *pMimeTypes;
char *pFileExtents;
char *pFileOpenTemplate;
char *pProductName;
char *pProductDescription;
unsigned long dwProductVersionMS;
unsigned long dwProductVersionLS;
} NPPluginData;
typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*);
NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
#endif
typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs);
typedef NPError (*NP_ShutdownFunc)(void);
NPError OSCALL NP_Shutdown(void);
typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
const char* NP_GetMIMEDescription(void);
#ifdef __cplusplus
}
#endif
#endif
#if defined(__OS2__)
#pragma pack()
#endif
#ifdef XP_UNIX
#ifdef __cplusplus
extern "C" {
#endif
typedef char* (*NP_GetPluginVersionFunc)(void);
NP_EXPORT(char*) NP_GetPluginVersion(void);
typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
NP_EXPORT(const char*) NP_GetMIMEDescription(void);
#ifdef XP_MACOSX
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*);
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs);
typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*);
NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs);
#else
typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*);
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs);
#endif
typedef NPError (*NP_ShutdownFunc)(void);
NP_EXPORT(NPError) NP_Shutdown(void);
typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *);
NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
#ifdef __cplusplus
}
#endif
#endif
#endif /* npfunctions_h_ */

View File

@@ -1,393 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
* Foundation ("Mozilla") nor the names of their contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
* THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _NP_RUNTIME_H_
#define _NP_RUNTIME_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "nptypes.h"
/*
This API is used to facilitate binding code written in C to script
objects. The API in this header does not assume the presence of a
user agent. That is, it can be used to bind C code to scripting
environments outside of the context of a user agent.
However, the normal use of the this API is in the context of a
scripting environment running in a browser or other user agent.
In particular it is used to support the extended Netscape
script-ability API for plugins (NP-SAP). NP-SAP is an extension
of the Netscape plugin API. As such we have adopted the use of
the "NP" prefix for this API.
The following NP{N|P}Variables were added to the Netscape plugin
API (in npapi.h):
NPNVWindowNPObject
NPNVPluginElementNPObject
NPPVpluginScriptableNPObject
These variables are exposed through NPN_GetValue() and
NPP_GetValue() (respectively) and are used to establish the
initial binding between the user agent and native code. The DOM
objects in the user agent can be examined and manipulated using
the NPN_ functions that operate on NPObjects described in this
header.
To the extent possible the assumptions about the scripting
language used by the scripting environment have been minimized.
*/
#define NP_BEGIN_MACRO do {
#define NP_END_MACRO } while (0)
/*
Objects (non-primitive data) passed between 'C' and script is
always wrapped in an NPObject. The 'interface' of an NPObject is
described by an NPClass.
*/
typedef struct NPObject NPObject;
typedef struct NPClass NPClass;
typedef char NPUTF8;
typedef struct _NPString {
const NPUTF8 *UTF8Characters;
uint32_t UTF8Length;
} NPString;
typedef enum {
NPVariantType_Void,
NPVariantType_Null,
NPVariantType_Bool,
NPVariantType_Int32,
NPVariantType_Double,
NPVariantType_String,
NPVariantType_Object
} NPVariantType;
typedef struct _NPVariant {
NPVariantType type;
union {
bool boolValue;
int32_t intValue;
double doubleValue;
NPString stringValue;
NPObject *objectValue;
} value;
} NPVariant;
/*
NPN_ReleaseVariantValue is called on all 'out' parameters
references. Specifically it is to be called on variants that own
their value, as is the case with all non-const NPVariant*
arguments after a successful call to any methods (except this one)
in this API.
After calling NPN_ReleaseVariantValue, the type of the variant
will be NPVariantType_Void.
*/
void NPN_ReleaseVariantValue(NPVariant *variant);
#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32)
#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double)
#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String)
#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object)
#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue)
#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue)
#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue)
#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue)
#define VOID_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Void; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define NULL_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Null; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define BOOLEAN_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Bool; \
(_v).value.boolValue = !!(_val); \
NP_END_MACRO
#define INT32_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Int32; \
(_v).value.intValue = _val; \
NP_END_MACRO
#define DOUBLE_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Double; \
(_v).value.doubleValue = _val; \
NP_END_MACRO
#define STRINGZ_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, (uint32_t)(strlen(_val)) }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define STRINGN_TO_NPVARIANT(_val, _len, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, (uint32_t)(_len) }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define OBJECT_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Object; \
(_v).value.objectValue = _val; \
NP_END_MACRO
/*
Type mappings (JavaScript types have been used for illustration
purposes):
JavaScript to C (NPVariant with type:)
undefined NPVariantType_Void
null NPVariantType_Null
Boolean NPVariantType_Bool
Number NPVariantType_Double or NPVariantType_Int32
String NPVariantType_String
Object NPVariantType_Object
C (NPVariant with type:) to JavaScript
NPVariantType_Void undefined
NPVariantType_Null null
NPVariantType_Bool Boolean
NPVariantType_Int32 Number
NPVariantType_Double Number
NPVariantType_String String
NPVariantType_Object Object
*/
typedef void *NPIdentifier;
/*
NPObjects have methods and properties. Methods and properties are
identified with NPIdentifiers. These identifiers may be reflected
in script. NPIdentifiers can be either strings or integers, IOW,
methods and properties can be identified by either strings or
integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
compared using ==. In case of any errors, the requested
NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled
by the browser. Plugins do not need to worry about memory management
with regards to NPIdentifiers.
*/
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
bool NPN_IdentifierIsString(NPIdentifier identifier);
/*
The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
*/
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
/*
Get the integer represented by identifier. If identifier is not an
integer identifier, the behaviour is undefined.
*/
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
/*
NPObject behavior is implemented using the following set of
callback functions.
The NPVariant *result argument of these functions (where
applicable) should be released using NPN_ReleaseVariantValue().
*/
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
const NPVariant *args,
uint32_t argCount,
NPVariant *result);
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
NPIdentifier name);
typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value,
uint32_t *count);
typedef bool (*NPConstructFunctionPtr)(NPObject *npobj,
const NPVariant *args,
uint32_t argCount,
NPVariant *result);
/*
NPObjects returned by create, retain, invoke, and getProperty pass
a reference count to the caller. That is, the callee adds a
reference count which passes to the caller. It is the caller's
responsibility to release the returned object.
NPInvokeFunctionPtr function may return 0 to indicate a void
result.
NPInvalidateFunctionPtr is called by the scripting environment
when the native code is shutdown. Any attempt to message a
NPObject instance after the invalidate callback has been
called will result in undefined behavior, even if the native code
is still retaining those NPObject instances. (The runtime
will typically return immediately, with 0 or NULL, from an attempt
to dispatch to a NPObject, but this behavior should not be
depended upon.)
The NPEnumerationFunctionPtr function may pass an array of
NPIdentifiers back to the caller. The callee allocs the memory of
the array using NPN_MemAlloc(), and it's the caller's responsibility
to release it using NPN_MemFree().
*/
struct NPClass
{
uint32_t structVersion;
NPAllocateFunctionPtr allocate;
NPDeallocateFunctionPtr deallocate;
NPInvalidateFunctionPtr invalidate;
NPHasMethodFunctionPtr hasMethod;
NPInvokeFunctionPtr invoke;
NPInvokeDefaultFunctionPtr invokeDefault;
NPHasPropertyFunctionPtr hasProperty;
NPGetPropertyFunctionPtr getProperty;
NPSetPropertyFunctionPtr setProperty;
NPRemovePropertyFunctionPtr removeProperty;
NPEnumerationFunctionPtr enumerate;
NPConstructFunctionPtr construct;
};
#define NP_CLASS_STRUCT_VERSION 3
#define NP_CLASS_STRUCT_VERSION_ENUM 2
#define NP_CLASS_STRUCT_VERSION_CTOR 3
#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \
((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM)
#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \
((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)
struct NPObject {
NPClass *_class;
uint32_t referenceCount;
/*
* Additional space may be allocated here by types of NPObjects
*/
};
/*
If the class has an allocate function, NPN_CreateObject invokes
that function, otherwise a NPObject is allocated and
returned. This method will initialize the referenceCount member of
the NPObject to 1.
*/
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
/*
Increment the NPObject's reference count.
*/
NPObject *NPN_RetainObject(NPObject *npobj);
/*
Decremented the NPObject's reference count. If the reference
count goes to zero, the class's destroy function is invoke if
specified, otherwise the object is freed directly.
*/
void NPN_ReleaseObject(NPObject *npobj);
/*
Functions to access script objects represented by NPObject.
Calls to script objects are synchronous. If a function returns a
value, it will be supplied via the result NPVariant
argument. Successful calls will return true, false will be
returned in case of an error.
Calls made from plugin code to script must be made from the thread
on which the plugin was initialized.
*/
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result);
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
NPVariant *result);
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
NPVariant *result);
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
const NPVariant *value);
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
uint32_t *count);
bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
/*
NPN_SetException may be called to trigger a script exception upon
return from entry points into NPObjects. Typical usage:
NPN_SetException (npobj, message);
*/
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,121 +0,0 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Johnny Stenback <jst@mozilla.org> (Original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nptypes_h_
#define nptypes_h_
/*
* Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and
* true/false macros are available.
*/
#if defined(WIN32) || defined(OS2)
/*
* Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
* is predefined tho, both in C and C++.
*/
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
/*
* AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
* but not bool for C.
*/
#include <inttypes.h>
#ifndef __cplusplus
typedef int bool;
#define true 1
#define false 0
#endif
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)
/*
* BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and
* u_int32_t.
*/
#include <sys/types.h>
/*
* BSD/OS ships no header that defines uint32_t, nor bool (for C)
*/
#if defined(bsdi)
typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
#if !defined(__cplusplus)
typedef int bool;
#define true 1
#define false 0
#endif
#else
/*
* FreeBSD and OpenBSD define uint32_t and bool.
*/
#include <inttypes.h>
#include <stdbool.h>
#endif
#elif defined(BEOS)
#include <inttypes.h>
#else
/*
* For those that ship a standard C99 stdint.h header file, include
* it. Can't do the same for stdbool.h tho, since some systems ship
* with a stdbool.h file that doesn't compile!
*/
#include <stdint.h>
#ifndef __cplusplus
#if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
#include <stdbool.h>
#else
/*
* GCC 2.91 can't deal with a typedef for bool, but a #define
* works.
*/
#define bool int
#define true 1
#define false 0
#endif
#endif
#endif
#endif /* nptypes_h_ */

View File

@@ -1,18 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/theme">
<file>calendar-arrow-left.svg</file>
<file>calendar-arrow-right.svg</file>
<file>calendar-today.svg</file>
<file>checkbox-focused.svg</file>
<file>checkbox-off-focused.svg</file>
<file>checkbox-off.svg</file>
<file>checkbox.svg</file>
<file>close-window.svg</file>
<file>close-window-active.svg</file>
<file>close-window-hover.svg</file>
<file>corner-ripple-ltr.png</file>
<file>corner-ripple-rtl.png</file>
<file>dash-placeholder.svg</file>
<file>gnome-shell.css</file>
<file>gnome-shell-high-contrast.css</file>
@@ -27,10 +20,6 @@
<file>no-notifications.svg</file>
<file>noise-texture.png</file>
<file>pad-osd.css</file>
<file>page-indicator-active.svg</file>
<file>page-indicator-inactive.svg</file>
<file>page-indicator-checked.svg</file>
<file>page-indicator-hover.svg</file>
<file>process-working.svg</file>
<file>toggle-off-us.svg</file>
<file>toggle-off-intl.svg</file>

View File

@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg2"
version="1.1"
inkscape:version="0.48+devel r9942 custom"
sodipodi:docname="New document 4">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="8.984481"
inkscape:cy="5.6224906"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:window-width="930"
inkscape:window-height="681"
inkscape:window-x="1892"
inkscape:window-y="272"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid17403"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1036.3622)">
<path
sodipodi:type="star"
style="fill:#5f5f5f;fill-opacity:1;stroke:#5f5f5f;stroke-width:0.43015847;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="path18028"
sodipodi:sides="3"
sodipodi:cx="84.5"
sodipodi:cy="337.5"
sodipodi:r1="5"
sodipodi:r2="2.5"
sodipodi:arg1="0.52359878"
sodipodi:arg2="1.5707963"
inkscape:flatsided="true"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 88.830127,340 80.169873,340 84.5,332.5 z"
transform="matrix(0,1.3621708,0.99186247,0,-325.48222,929.32667)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg2"
version="1.1"
inkscape:version="0.48+devel r9942 custom"
sodipodi:docname="arrow-left.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="7.7366092"
inkscape:cy="6.4536271"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:window-width="930"
inkscape:window-height="681"
inkscape:window-x="1892"
inkscape:window-y="272"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid17403"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1036.3622)">
<path
sodipodi:type="star"
style="fill:#5f5f5f;fill-opacity:1;stroke:#5f5f5f;stroke-width:0.43015847;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="path18028"
sodipodi:sides="3"
sodipodi:cx="84.5"
sodipodi:cy="337.5"
sodipodi:r1="5"
sodipodi:r2="2.5"
sodipodi:arg1="0.52359878"
sodipodi:arg2="1.5707963"
inkscape:flatsided="true"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 88.830127,340 80.169873,340 84.5,332.5 z"
transform="matrix(0,1.3621708,-0.99186247,0,342.48324,929.32667)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
id="Foreground"
x="0px"
y="0px"
width="32"
height="32"
viewBox="0 0 32 32"
enable-background="new 0 0 16 16"
xml:space="preserve"
sodipodi:version="0.32"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="close-window-active.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
id="metadata2399"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs2397"><linearGradient
id="linearGradient3173"><stop
style="stop-color:#c4c4c4;stop-opacity:1;"
offset="0"
id="stop3175" /><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3177" /></linearGradient><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 11 : 1"
inkscape:vp_y="0 : 1375 : 0"
inkscape:vp_z="22 : 11 : 1"
inkscape:persp3d-origin="11 : 7.3333334 : 1"
id="perspective2401" /></defs><sodipodi:namedview
inkscape:window-height="1106"
inkscape:window-width="1700"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#797979"
id="base"
showgrid="false"
inkscape:zoom="4"
inkscape:cx="28.483745"
inkscape:cy="67.714004"
inkscape:window-x="1427"
inkscape:window-y="127"
inkscape:current-layer="Foreground"
showguides="true"
inkscape:guide-bbox="true"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:window-maximized="0"
inkscape:document-rotation="0"><inkscape:grid
type="xygrid"
id="grid11246"
empspacing="32"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" /></sodipodi:namedview><path
d="m 4.4362021,16 c 0,-6.410121 5.1728276,-11.60728 11.5529359,-11.60728 6.380109,0 11.552937,5.197159 11.552937,11.60728 0,6.410122 -5.172828,11.607281 -11.552937,11.607281 C 9.6090297,27.607281 4.4362021,22.410122 4.4362021,16 Z"
id="path883"
style="color:#000000;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;fill:#a5c8ec;fill-opacity:1;fill-rule:nonzero;stroke:#2975c4;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
sodipodi:nodetypes="csssc"
inkscape:connector-curvature="0" /><path
d="m 11.718386,11.764547 h 1.055207 c 0.01091,-1.26e-4 0.02193,-4.86e-4 0.03298,0 0.269026,0.01183 0.538019,0.135679 0.725455,0.329752 l 2.407192,2.407192 2.440166,-2.407192 c 0.28029,-0.243226 0.471333,-0.322366 0.725455,-0.329752 h 1.055207 v 1.055208 c 0,0.302285 -0.03623,0.581049 -0.263801,0.791405 l -2.407191,2.407191 2.374217,2.374216 c 0.198577,0.198559 0.296768,0.478484 0.296775,0.758432 v 1.055206 h -1.055211 c -0.279947,-10e-6 -0.559877,-0.09824 -0.75843,-0.296777 l -2.407192,-2.407192 -2.407192,2.407192 c -0.198551,0.198579 -0.478493,0.296777 -0.758429,0.296777 H 11.71839 v -1.055206 c -3e-6,-0.279936 0.0982,-0.559873 0.296777,-0.758432 L 14.422359,16.018351 12.015167,13.61116 C 11.79279,13.405784 11.69527,13.116003 11.71839,12.819755 Z"
inkscape:connector-curvature="0"
id="path887"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#4a90d9;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.87958801;marker:none;enable-background:new"
sodipodi:nodetypes="ccsccccccccccccccccccccccc" /></svg>

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
id="Foreground"
x="0px"
y="0px"
width="32"
height="32"
viewBox="0 0 32 32"
enable-background="new 0 0 16 16"
xml:space="preserve"
sodipodi:version="0.32"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="close-window-hover.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
id="metadata2399"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs2397"><linearGradient
id="linearGradient3173"><stop
style="stop-color:#c4c4c4;stop-opacity:1;"
offset="0"
id="stop3175" /><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3177" /></linearGradient><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 11 : 1"
inkscape:vp_y="0 : 1375 : 0"
inkscape:vp_z="22 : 11 : 1"
inkscape:persp3d-origin="11 : 7.3333334 : 1"
id="perspective2401" /></defs><sodipodi:namedview
inkscape:window-height="1106"
inkscape:window-width="1700"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#797979"
id="base"
showgrid="false"
inkscape:zoom="4"
inkscape:cx="28.483745"
inkscape:cy="67.714004"
inkscape:window-x="1427"
inkscape:window-y="127"
inkscape:current-layer="Foreground"
showguides="true"
inkscape:guide-bbox="true"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:window-maximized="0"
inkscape:document-rotation="0"><inkscape:grid
type="xygrid"
id="grid11246"
empspacing="32"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" /></sodipodi:namedview><path
inkscape:connector-curvature="0"
sodipodi:nodetypes="csssc"
style="color:#000000;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;fill:#2975c4;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="path822"
d="m 4.4362021,16 c 0,-6.410121 5.1728276,-11.60728 11.5529359,-11.60728 6.380109,0 11.552937,5.197159 11.552937,11.60728 0,6.410122 -5.172828,11.607281 -11.552937,11.607281 C 9.6090297,27.607281 4.4362021,22.410122 4.4362021,16 Z" /><path
sodipodi:nodetypes="ccsccccccccccccccccccccccc"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.87958801;marker:none;enable-background:new"
id="path826"
inkscape:connector-curvature="0"
d="m 11.718386,11.764547 h 1.055207 c 0.01091,-1.26e-4 0.02193,-4.86e-4 0.03298,0 0.269026,0.01183 0.538019,0.135679 0.725455,0.329752 l 2.407192,2.407192 2.440166,-2.407192 c 0.28029,-0.243226 0.471333,-0.322366 0.725455,-0.329752 h 1.055207 v 1.055208 c 0,0.302285 -0.03623,0.581049 -0.263801,0.791405 l -2.407191,2.407191 2.374217,2.374216 c 0.198577,0.198559 0.296768,0.478484 0.296775,0.758432 v 1.055206 h -1.055211 c -0.279947,-10e-6 -0.559877,-0.09824 -0.75843,-0.296777 l -2.407192,-2.407192 -2.407192,2.407192 c -0.198551,0.198579 -0.478493,0.296777 -0.758429,0.296777 H 11.71839 v -1.055206 c -3e-6,-0.279936 0.0982,-0.559873 0.296777,-0.758432 L 14.422359,16.018351 12.015167,13.61116 C 11.79279,13.405784 11.69527,13.116003 11.71839,12.819755 Z" /></svg>

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
id="Foreground"
x="0px"
y="0px"
width="32"
height="32"
viewBox="0 0 32 32"
enable-background="new 0 0 16 16"
xml:space="preserve"
sodipodi:version="0.32"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="close-window.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
id="metadata2399"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs2397"><linearGradient
id="linearGradient3173"><stop
style="stop-color:#c4c4c4;stop-opacity:1;"
offset="0"
id="stop3175" /><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="1"
id="stop3177" /></linearGradient><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 11 : 1"
inkscape:vp_y="0 : 1375 : 0"
inkscape:vp_z="22 : 11 : 1"
inkscape:persp3d-origin="11 : 7.3333334 : 1"
id="perspective2401" /></defs><sodipodi:namedview
inkscape:window-height="1106"
inkscape:window-width="1700"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#797979"
id="base"
showgrid="false"
inkscape:zoom="4"
inkscape:cx="28.483745"
inkscape:cy="67.714004"
inkscape:window-x="1427"
inkscape:window-y="127"
inkscape:current-layer="Foreground"
showguides="true"
inkscape:guide-bbox="true"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:window-maximized="0"
inkscape:document-rotation="0"><inkscape:grid
type="xygrid"
id="grid11246"
empspacing="32"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" /></sodipodi:namedview><path
d="m 4.4362021,15.860384 c 0,-6.410121 5.1728276,-11.60728 11.5529359,-11.60728 6.380109,0 11.552937,5.197159 11.552937,11.60728 0,6.410122 -5.172828,11.607281 -11.552937,11.607281 -6.3801083,0 -11.5529359,-5.197159 -11.5529359,-11.607281 z"
id="path2394-32"
style="color:#000000;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#2975c4;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
sodipodi:nodetypes="csssc"
inkscape:connector-curvature="0" /><path
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.49900004;fill:#4a90d9;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.74932218;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 6.4654832,15.001321 c -0.025906,0.288419 -0.044417,0.579469 -0.044417,0.874662 0,5.313347 4.2883848,9.621271 9.5768588,9.621271 5.288466,0 9.575143,-4.307924 9.575143,-9.621271 0,-0.295193 -0.01852,-0.586243 -0.04441,-0.874662 -0.440376,4.903023 -4.536071,8.746611 -9.53073,8.746611 -4.994659,0 -9.0920617,-3.843588 -9.5324391,-8.746611 z"
id="path2561"
inkscape:connector-curvature="0" /><path
d="m 11.718386,11.639547 h 1.055207 c 0.01091,-1.26e-4 0.02193,-4.86e-4 0.03298,0 0.269026,0.01183 0.538019,0.135679 0.725455,0.329752 l 2.407192,2.407192 2.440166,-2.407192 c 0.28029,-0.243226 0.471333,-0.322366 0.725455,-0.329752 h 1.055207 v 1.055208 c 0,0.302285 -0.03623,0.581049 -0.263801,0.791405 l -2.407191,2.407191 2.374217,2.374216 c 0.198577,0.198559 0.296768,0.478484 0.296775,0.758432 v 1.055206 h -1.055211 c -0.279947,-10e-6 -0.559877,-0.09824 -0.75843,-0.296777 l -2.407192,-2.407192 -2.407192,2.407192 c -0.198551,0.198579 -0.478493,0.296777 -0.758429,0.296777 H 11.71839 v -1.055206 c -3e-6,-0.279936 0.0982,-0.559873 0.296777,-0.758432 L 14.422359,15.893351 12.015167,13.48616 C 11.79279,13.280784 11.69527,12.991003 11.71839,12.694755 Z"
inkscape:connector-curvature="0"
id="path27279-0-5"
style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';-inkscape-font-specification:'Andale Mono';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#4a90d9;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.87958801;marker:none;enable-background:new"
sodipodi:nodetypes="ccsccccccccccccccccccccccc" /></svg>

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -57,8 +57,8 @@ stage {
border-right-width: 1px;
@include button(normal);
&:insensitive { @include button(insensitive); }
&:focus { @include button(focus); }
&:hover { @include button(hover); }
&:focus { @include button(focus); }
&:active { @include button(active); }
padding: 12px;
@@ -938,7 +938,6 @@ StScrollBar {
}
.pager-button {
color: white;
background-color: transparent;
width: 32px;
border-radius: 4px;
@@ -946,13 +945,8 @@ StScrollBar {
&:active { background-color: transparentize($bg_color,0.95); }
}
.calendar-change-month-back { //arrow back
background-image: url("resource:///org/gnome/shell/theme/calendar-arrow-left.svg");
&:rtl { background-image: url("resource:///org/gnome/shell/theme/calendar-arrow-right.svg"); }
}
.calendar-change-month-forward { //arrow foreward
background-image: url("resource:///org/gnome/shell/theme/calendar-arrow-right.svg");
&:rtl { background-image: url("resource:///org/gnome/shell/theme/calendar-arrow-left.svg"); }
.calendar-change-month-back StIcon, .calendar-change-month-forward StIcon { // arrows
icon-size: 1.09em;
}
.calendar-day-base {
@@ -1142,17 +1136,16 @@ StScrollBar {
& > StIcon { icon-size: 16px; }
}
//Activities Ripples
// Activities Ripples
.ripple-box {
width: 52px;
height: 52px;
background-image: url("resource:///org/gnome/shell/theme/corner-ripple-ltr.png");
background-size: contain;
border-radius: 0 0 52px 0; // radius the size of the box give us the curve
background-color: lighten(transparentize($selected_bg_color, 0.7), 40%);
box-shadow: 0 0 2px 2px lighten($selected_bg_color, 20%);
}
.ripple-box:rtl {
background-image: url("resource:///org/gnome/shell/theme/corner-ripple-rtl.png");
}
.ripple-box:rtl { border-radius: 0 0 0 52px; } // just a simple change to the border radius position
// not really top bar only
.popup-menu-arrow { width: 16px; height: 16px; }
@@ -1161,14 +1154,26 @@ StScrollBar {
//close buttons
.window-close {
background-image: url("resource:///org/gnome/shell/theme/close-window.svg");
background-size: 32px;
height: 32px;
width: 32px;
-shell-close-overlap: 16px;
background-color: white;
border-radius: 24px;
border: 4px solid $selected_bg_color;
box-shadow: inset 0 -4px 0 0 transparentize($selected_bg_color, 0.5);
color: $selected_bg_color;
height: 24px;
width: 24px;
-shell-close-overlap: 14px;
&:hover { background-image: url("resource:///org/gnome/shell/theme/close-window-hover.svg"); }
&:active { background-image: url("resource:///org/gnome/shell/theme/close-window-active.svg"); }
&:hover {
background-color: $selected_bg_color;
border-color: white;
color: white;
}
&:active {
background-color: mix(white, $selected_bg_color, 75%);
border-color: $selected_bg_color;
color: $selected_bg_color;
}
}
/* NETWORK DIALOGS */
@@ -1447,15 +1452,17 @@ StScrollBar {
padding: 15px 20px;
.page-indicator-icon {
width: 18px;
height: 18px;
background-image: url(resource:///org/gnome/shell/theme/page-indicator-inactive.svg);
width: 12px;
height: 12px;
background-color: transparent;
border: 2px solid rgba(255, 255, 255, 0.4);
border-radius:12px;
}
&:hover .page-indicator-icon { background-image: url(resource:///org/gnome/shell/theme/page-indicator-hover.svg); }
&:active .page-indicator-icon { background-image: url(resource:///org/gnome/shell/theme/page-indicator-active.svg); }
&:hover .page-indicator-icon { border-color: white; }
&:active .page-indicator-icon { border: none; margin: 2px; background-color:#fff; }
&:checked .page-indicator-icon,
&:checked:active { background-image: url(resource:///org/gnome/shell/theme/page-indicator-checked.svg); }
&:checked:active { background-color: #fff;}
}
.no-frequent-applications-label { @extend %status_text; }

View File

@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18"
height="18"
id="svg4703"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="page-indicator-pushed.svg">
<defs
id="defs4705" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="31.392433"
inkscape:cx="1.0245308"
inkscape:cy="13.3715"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="2560"
inkscape:window-height="1374"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid6140" />
</sodipodi:namedview>
<metadata
id="metadata4708">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,2)">
<path
transform="matrix(0.54617904,0,0,0.62523128,-1131.9904,-392.39214)"
d="m 2099.9808,638.83099 a 10.985409,9.5964489 0 1 1 -21.9708,0 10.985409,9.5964489 0 1 1 21.9708,0 z"
sodipodi:ry="9.5964489"
sodipodi:rx="10.985409"
sodipodi:cy="638.83099"
sodipodi:cx="2088.9954"
id="path4711"
style="fill:#fdffff;fill-opacity:1;stroke:none"
sodipodi:type="arc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18"
height="18"
id="svg4703"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="page-indicator-active.svg">
<defs
id="defs4705" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.197802"
inkscape:cx="2.1522887"
inkscape:cy="16.782904"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1920"
inkscape:window-height="1021"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata4708">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,2)">
<path
transform="matrix(0.72823872,0,0,0.8336417,-1512.2872,-525.55618)"
d="m 2099.9808,638.83099 c 0,5.29998 -4.9184,9.59645 -10.9854,9.59645 -6.0671,0 -10.9854,-4.29647 -10.9854,-9.59645 0,-5.29997 4.9183,-9.59645 10.9854,-9.59645 6.067,0 10.9854,4.29648 10.9854,9.59645 z"
sodipodi:ry="9.5964489"
sodipodi:rx="10.985409"
sodipodi:cy="638.83099"
sodipodi:cx="2088.9954"
id="path4711"
style="fill:#fdffff;fill-opacity:0.94117647;stroke:none"
sodipodi:type="arc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18"
height="18"
id="svg5266"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="page-indicator-inactive.svg">
<defs
id="defs5268" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="11.313709"
inkscape:cx="-2.307566"
inkscape:cy="17.859535"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="2560"
inkscape:window-height="1374"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata5271">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,2)">
<path
sodipodi:type="arc"
style="fill:none;fill-opacity:0;stroke:#ffffff;stroke-width:2.93356276000000005;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path5274"
sodipodi:cx="2088.9954"
sodipodi:cy="638.83099"
sodipodi:rx="10.985409"
sodipodi:ry="9.5964489"
d="m 2099.9808,638.83099 c 0,5.29998 -4.9184,9.59645 -10.9854,9.59645 -6.0671,0 -10.9854,-4.29647 -10.9854,-9.59645 0,-5.29997 4.9183,-9.59645 10.9854,-9.59645 6.067,0 10.9854,4.29648 10.9854,9.59645 z"
transform="matrix(0.63720887,0,0,0.72943648,-1322.1264,-458.98661)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18"
height="18"
id="svg5266"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="page-indicator-inactive.svg">
<defs
id="defs5268" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="11.313709"
inkscape:cx="-2.307566"
inkscape:cy="17.859535"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="2560"
inkscape:window-height="1374"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata5271">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,2)">
<path
sodipodi:type="arc"
style="fill:none;fill-opacity:0;stroke:#ffffff;stroke-width:2.93356276000000005;stroke-miterlimit:4;stroke-opacity:0.39215686000000000;stroke-dasharray:none"
id="path5274"
sodipodi:cx="2088.9954"
sodipodi:cy="638.83099"
sodipodi:rx="10.985409"
sodipodi:ry="9.5964489"
d="m 2099.9808,638.83099 c 0,5.29998 -4.9184,9.59645 -10.9854,9.59645 -6.0671,0 -10.9854,-4.29647 -10.9854,-9.59645 0,-5.29997 4.9183,-9.59645 10.9854,-9.59645 6.067,0 10.9854,4.29648 10.9854,9.59645 z"
transform="matrix(0.63720887,0,0,0.72943648,-1322.1264,-458.98661)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -17,7 +17,6 @@
<chapter>
<title>Actors</title>
<xi:include href="xml/shell-generic-container.xml"/>
<xi:include href="xml/shell-stack.xml"/>
</chapter>
<chapter>

View File

@@ -25,7 +25,7 @@ its dependencies to build from tarballs.</description>
<homepage rdf:resource="https://wiki.gnome.org/Projects/GnomeShell" />
<mailing-list rdf:resource="http://mail.gnome.org/mailman/listinfo/gnome-shell-list" />
<download-page rdf:resource="http://download.gnome.org/sources/gnome-shell/" />
<bug-database rdf:resource="https://bugzilla.gnome.org/browse.cgi?product=gnome-shell" />
<bug-database rdf:resource="https://gitlab.gnome.org/GNOME/gnome-shell/issues/" />
<category rdf:resource="http://api.gnome.org/doap-extensions#core" />
<programming-language>JavaScript</programming-language>

View File

@@ -408,16 +408,18 @@ Signals.addSignalMethods(SessionMenuButton.prototype);
var LoginDialog = new Lang.Class({
Name: 'LoginDialog',
Extends: St.Widget,
Signals: { 'failed': {} },
_init(parentActor) {
this.actor = new Shell.GenericContainer({ style_class: 'login-dialog',
visible: false });
this.actor.get_accessible().set_role(Atk.Role.WINDOW);
this.parent({ style_class: 'login-dialog',
visible: false });
this.actor.add_constraint(new Layout.MonitorConstraint({ primary: true }));
this.actor.connect('allocate', this._onAllocate.bind(this));
this.actor.connect('destroy', this._onDestroy.bind(this));
parentActor.add_child(this.actor);
this.get_accessible().set_role(Atk.Role.WINDOW);
this.add_constraint(new Layout.MonitorConstraint({ primary: true }));
this.connect('destroy', this._onDestroy.bind(this));
parentActor.add_child(this);
this._userManager = AccountsService.UserManager.get_default()
this._gdmClient = new Gdm.Client();
@@ -442,7 +444,7 @@ var LoginDialog = new Lang.Class({
y_align: Clutter.ActorAlign.CENTER,
vertical: true,
visible: false });
this.actor.add_child(this._userSelectionBox);
this.add_child(this._userSelectionBox);
this._userList = new UserList();
this._userSelectionBox.add(this._userList.actor,
@@ -454,7 +456,7 @@ var LoginDialog = new Lang.Class({
this._authPrompt.connect('prompted', this._onPrompted.bind(this));
this._authPrompt.connect('reset', this._onReset.bind(this));
this._authPrompt.hide();
this.actor.add_child(this._authPrompt.actor);
this.add_child(this._authPrompt.actor);
// translators: this message is shown below the user list on the
// login screen. It can be activated to reveal an entry for
@@ -482,7 +484,7 @@ var LoginDialog = new Lang.Class({
opacity: 0,
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
hscrollbar_policy: Gtk.PolicyType.NEVER });
this.actor.add_child(this._bannerView);
this.add_child(this._bannerView);
let bannerBox = new St.BoxLayout({ vertical: true });
@@ -497,7 +499,7 @@ var LoginDialog = new Lang.Class({
this._logoBin = new St.Widget({ style_class: 'login-dialog-logo-bin',
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.END });
this.actor.add_child(this._logoBin);
this.add_child(this._logoBin);
this._updateLogo();
this._userList.connect('activate', (userList, item) => {
@@ -576,7 +578,12 @@ var LoginDialog = new Lang.Class({
return actorBox;
},
_onAllocate(actor, dialogBox, flags) {
vfunc_allocate(dialogBox, flags) {
this.set_allocation(dialogBox, flags);
let themeNode = this.get_theme_node();
dialogBox = themeNode.get_content_box(dialogBox);
let dialogWidth = dialogBox.x2 - dialogBox.x1;
let dialogHeight = dialogBox.y2 - dialogBox.y1;
@@ -919,10 +926,10 @@ var LoginDialog = new Lang.Class({
},
_loginScreenSessionActivated() {
if (this.actor.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
return;
Tweener.addTween(this.actor,
Tweener.addTween(this,
{ opacity: 255,
time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
@@ -931,7 +938,7 @@ var LoginDialog = new Lang.Class({
for (let i = 0; i < children.length; i++) {
if (children[i] != Main.layoutManager.screenShieldGroup)
children[i].opacity = this.actor.opacity;
children[i].opacity = this.opacity;
}
},
onUpdateScope: this,
@@ -952,7 +959,7 @@ var LoginDialog = new Lang.Class({
},
_startSession(serviceName) {
Tweener.addTween(this.actor,
Tweener.addTween(this,
{ opacity: 0,
time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad',
@@ -961,7 +968,7 @@ var LoginDialog = new Lang.Class({
for (let i = 0; i < children.length; i++) {
if (children[i] != Main.layoutManager.screenShieldGroup)
children[i].opacity = this.actor.opacity;
children[i].opacity = this.opacity;
}
},
onUpdateScope: this,
@@ -1230,17 +1237,17 @@ var LoginDialog = new Lang.Class({
},
open() {
Main.ctrlAltTabManager.addGroup(this.actor,
Main.ctrlAltTabManager.addGroup(this,
_("Login Window"),
'dialog-password-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.MIDDLE });
this._userList.actor.grab_key_focus();
this.actor.show();
this.actor.opacity = 0;
this.show();
this.opacity = 0;
Main.pushModal(this.actor, { actionMode: Shell.ActionMode.LOGIN_SCREEN });
Main.pushModal(this, { actionMode: Shell.ActionMode.LOGIN_SCREEN });
Tweener.addTween(this.actor,
Tweener.addTween(this,
{ opacity: 255,
time: 1,
transition: 'easeInQuad' });
@@ -1249,8 +1256,8 @@ var LoginDialog = new Lang.Class({
},
close() {
Main.popModal(this.actor);
Main.ctrlAltTabManager.removeGroup(this.actor);
Main.popModal(this);
Main.ctrlAltTabManager.removeGroup(this);
},
cancel() {
@@ -1265,4 +1272,3 @@ var LoginDialog = new Lang.Class({
this._authPrompt.finish(onComplete);
},
});
Signals.addSignalMethods(LoginDialog.prototype);

View File

@@ -210,7 +210,7 @@ var IBusManager = new Lang.Class({
}
this._ibus.set_global_engine_async(id, this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
null, callback);
null, callback || null);
},
preloadEngines(ids) {

View File

@@ -17,6 +17,7 @@ var InputMethod = new Lang.Class({
this._currentFocus = null;
this._preeditStr = '';
this._preeditPos = 0;
this._preeditVisible = false;
this._ibus = IBus.Bus.new_async();
this._ibus.connect('connected', this._onConnected.bind(this));
this._ibus.connect('disconnected', this._clear.bind(this));
@@ -80,6 +81,7 @@ var InputMethod = new Lang.Class({
this._enabled = false;
this._preeditStr = ''
this._preeditPos = 0;
this._preeditVisible = false;
},
_emitRequestSurrounding() {
@@ -98,20 +100,27 @@ var InputMethod = new Lang.Class({
_onUpdatePreeditText(context, text, pos, visible) {
if (text == null)
return;
this._preeditStr = text.get_text();
this._preeditPos = pos;
let preedit = text.get_text();
if (visible)
this.set_preedit_text(this._preeditStr, pos);
else
this.set_preedit_text(preedit, pos);
else if (this._preeditVisible)
this.set_preedit_text(null, pos);
this._preeditStr = preedit;
this._preeditPos = pos;
this._preeditVisible = visible;
},
_onShowPreeditText(context) {
this._preeditVisible = true;
this.set_preedit_text(this._preeditStr, this._preeditPos);
},
_onHidePreeditText(context) {
this.set_preedit_text(null, this._preeditPos);
this._preeditVisible = false;
},
_onForwardKeyEvent(context, keyval, keycode, state) {
@@ -144,8 +153,11 @@ var InputMethod = new Lang.Class({
this._updateCapabilities();
}
// Unset any preedit text
this.set_preedit_text(null, 0);
if (this._preeditStr) {
// Unset any preedit text
this.set_preedit_text(null, 0);
this._preeditStr = null;
}
},
vfunc_reset() {
@@ -154,8 +166,11 @@ var InputMethod = new Lang.Class({
this._emitRequestSurrounding();
}
// Unset any preedit text
this.set_preedit_text(null, 0);
if (this._preeditStr) {
// Unset any preedit text
this.set_preedit_text(null, 0);
this._preeditStr = null;
}
},
vfunc_set_cursor_location(rect) {

View File

@@ -52,11 +52,20 @@ var KeyboardManager = new Lang.Class({
this._current = null;
this._localeLayoutInfo = this._getLocaleLayout();
this._layoutInfos = {};
this._currentKeymap = null;
},
_applyLayoutGroup(group) {
let options = this._buildOptionsString();
let [layouts, variants] = this._buildGroupStrings(group);
if (this._currentKeymap &&
this._currentKeymap.layouts == layouts &&
this._currentKeymap.variants == variants &&
this._currentKeymap.options == options)
return;
this._currentKeymap = {layouts, variants, options};
Meta.get_backend().set_keymap(layouts, variants, options);
},
@@ -89,8 +98,6 @@ var KeyboardManager = new Lang.Class({
},
setUserLayouts(ids) {
let currentId = this._current ? this._current.id : null;
let currentGroupIndex = this._current ? this._current.groupIndex : null;
this._current = null;
this._layoutInfos = {};
@@ -117,9 +124,6 @@ var KeyboardManager = new Lang.Class({
info.group = group;
info.groupIndex = groupIndex;
if (currentId == id && currentGroupIndex == groupIndex)
this._current = info;
i += 1;
}
},

View File

@@ -243,13 +243,13 @@ function formatTime(time, params) {
followed by a time string in 24h format.
i.e. "May 25, 14:30" */
// xgettext:no-c-format
format = N_("%B %d, %H\u2236%M");
format = N_("%B %-d, %H\u2236%M");
else
/* Translators: this is the month name, day number, year
number followed by a time string in 24h format.
i.e. "May 25 2012, 14:30" */
// xgettext:no-c-format
format = N_("%B %d %Y, %H\u2236%M");
format = N_("%B %-d %Y, %H\u2236%M");
} else {
// Show only the time if date is on today
if (daysAgo < 1 || params.timeOnly)
@@ -272,13 +272,13 @@ function formatTime(time, params) {
followed by a time string in 12h format.
i.e. "May 25, 2:30 pm" */
// xgettext:no-c-format
format = N_("%B %d, %l\u2236%M %p");
format = N_("%B %-d, %l\u2236%M %p");
else
/* Translators: this is the month name, day number, year
number followed by a time string in 12h format.
i.e. "May 25 2012, 2:30 pm"*/
// xgettext:no-c-format
format = N_("%B %d %Y, %l\u2236%M %p");
format = N_("%B %-d %Y, %l\u2236%M %p");
}
let formattedTime = date.format(Shell.util_translate_time_string(format));

View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell">
<file>portalHelper/main.js</file>
<file>misc/config.js</file>
<file>misc/fileUtils.js</file>
<file>portalHelper/main.js</file>
<file>misc/params.js</file>
</gresource>
</gresources>

View File

@@ -3,6 +3,7 @@
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@@ -80,41 +81,41 @@ var AppSwitcherPopup = new Lang.Class({
this._items = this._switcherList.icons;
},
_allocate(actor, box, flags) {
this.parent(actor, box, flags);
vfunc_allocate(box, flags) {
this.parent(box, flags);
// Allocate the thumbnails
// We try to avoid overflowing the screen so we base the resulting size on
// those calculations
if (this._thumbnails) {
let childBox = this._switcherList.actor.get_allocation_box();
let childBox = this._switcherList.get_allocation_box();
let primary = Main.layoutManager.primaryMonitor;
let leftPadding = this.actor.get_theme_node().get_padding(St.Side.LEFT);
let rightPadding = this.actor.get_theme_node().get_padding(St.Side.RIGHT);
let bottomPadding = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
let leftPadding = this.get_theme_node().get_padding(St.Side.LEFT);
let rightPadding = this.get_theme_node().get_padding(St.Side.RIGHT);
let bottomPadding = this.get_theme_node().get_padding(St.Side.BOTTOM);
let hPadding = leftPadding + rightPadding;
let icon = this._items[this._selectedIndex].actor;
let icon = this._items[this._selectedIndex];
let [posX, posY] = icon.get_transformed_position();
let thumbnailCenter = posX + icon.width / 2;
let [childMinWidth, childNaturalWidth] = this._thumbnails.actor.get_preferred_width(-1);
let [childMinWidth, childNaturalWidth] = this._thumbnails.get_preferred_width(-1);
childBox.x1 = Math.max(primary.x + leftPadding, Math.floor(thumbnailCenter - childNaturalWidth / 2));
if (childBox.x1 + childNaturalWidth > primary.x + primary.width - hPadding) {
let offset = childBox.x1 + childNaturalWidth - primary.width + hPadding;
childBox.x1 = Math.max(primary.x + leftPadding, childBox.x1 - offset - hPadding);
}
let spacing = this.actor.get_theme_node().get_length('spacing');
let spacing = this.get_theme_node().get_length('spacing');
childBox.x2 = childBox.x1 + childNaturalWidth;
if (childBox.x2 > primary.x + primary.width - rightPadding)
childBox.x2 = primary.x + primary.width - rightPadding;
childBox.y1 = this._switcherList.actor.allocation.y2 + spacing;
childBox.y1 = this._switcherList.allocation.y2 + spacing;
this._thumbnails.addClones(primary.y + primary.height - bottomPadding - childBox.y1);
let [childMinHeight, childNaturalHeight] = this._thumbnails.actor.get_preferred_height(-1);
let [childMinHeight, childNaturalHeight] = this._thumbnails.get_preferred_height(-1);
childBox.y2 = childBox.y1 + childNaturalHeight;
this._thumbnails.actor.allocate(childBox, flags);
this._thumbnails.allocate(childBox, flags);
}
},
@@ -262,7 +263,7 @@ var AppSwitcherPopup = new Lang.Class({
_windowActivated(thumbnailList, n) {
let appIcon = this._items[this._selectedIndex];
Main.activateWindow(appIcon.cachedWindows[n]);
this.destroy();
this.fadeAndDestroy();
},
_windowEntered(thumbnailList, n) {
@@ -367,7 +368,7 @@ var AppSwitcherPopup = new Lang.Class({
},
_destroyThumbnails() {
let thumbnailsActor = this._thumbnails.actor;
let thumbnailsActor = this._thumbnails;
Tweener.addTween(thumbnailsActor,
{ opacity: 0,
time: THUMBNAIL_FADE_TIME,
@@ -387,19 +388,19 @@ var AppSwitcherPopup = new Lang.Class({
this._thumbnails.connect('item-activated', this._windowActivated.bind(this));
this._thumbnails.connect('item-entered', this._windowEntered.bind(this));
this._thumbnails.connect('item-removed', this._windowRemoved.bind(this));
this._thumbnails.actor.connect('destroy', () => {
this._thumbnails.connect('destroy', () => {
this._thumbnails = null;
this._thumbnailsFocused = false;
});
this.actor.add_actor(this._thumbnails.actor);
this.add_actor(this._thumbnails);
// Need to force an allocation so we can figure out whether we
// need to scroll when selecting
this._thumbnails.actor.get_allocation_box();
this._thumbnails.get_allocation_box();
this._thumbnails.actor.opacity = 0;
Tweener.addTween(this._thumbnails.actor,
this._thumbnails.opacity = 0;
Tweener.addTween(this._thumbnails,
{ opacity: 255,
time: THUMBNAIL_FADE_TIME,
transition: 'easeOutQuad',
@@ -471,6 +472,21 @@ var CyclerHighlight = new Lang.Class({
}
});
// We don't show an actual popup, so just provide what SwitcherPopup
// expects instead of inheriting from SwitcherList
var CyclerList = new Lang.Class({
Name: 'CyclerList',
Extends: St.Widget,
Signals: { 'item-activated': { param_types: [GObject.TYPE_INT] },
'item-entered': { param_types: [GObject.TYPE_INT] },
'item-removed': { param_types: [GObject.TYPE_INT] },
'item-highlighted': { param_types: [GObject.TYPE_INT] } },
highlight(index, justOutline) {
this.emit('item-highlighted', index);
}
});
var CyclerPopup = new Lang.Class({
Name: 'CyclerPopup',
Extends: SwitcherPopup.SwitcherPopup,
@@ -487,11 +503,10 @@ var CyclerPopup = new Lang.Class({
this._highlight = new CyclerHighlight();
global.window_group.add_actor(this._highlight.actor);
// We don't show an actual popup, so just provide what SwitcherPopup
// expects instead of inheriting from SwitcherList
this._switcherList = { actor: new St.Widget(),
highlight: this._highlightItem.bind(this),
connect() {} };
this._switcherList = new CyclerList();
this._switcherList.connect('item-highlighted', (list, index) => {
this._highlightItem(index);
});
},
_highlightItem(index, justOutline) {
@@ -653,22 +668,32 @@ var WindowCyclerPopup = new Lang.Class({
var AppIcon = new Lang.Class({
Name: 'AppIcon',
Extends: St.BoxLayout,
_init(app) {
this.parent({ style_class: 'alt-tab-app',
vertical: true });
this.app = app;
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
vertical: true });
this.icon = null;
this._iconBin = new St.Bin({ x_fill: true, y_fill: true });
this.actor.add(this._iconBin, { x_fill: false, y_fill: false } );
this.add(this._iconBin, { x_fill: false, y_fill: false } );
this.label = new St.Label({ text: this.app.get_name() });
this.actor.add(this.label, { x_fill: false });
this.add(this.label, { x_fill: false });
},
set_size(size) {
this.icon = this.app.create_icon_texture(size);
this._iconBin.child = this.icon;
this._iconBin.set_size(size, size);
},
vfunc_get_preferred_width(forHeight) {
let [minWidth, ] = this.parent(forHeight);
minWidth = Math.max(minWidth, forHeight);
return [minWidth, minWidth];
}
});
@@ -707,11 +732,10 @@ var AppSwitcher = new Lang.Class({
}
this._curApp = -1;
this._iconSize = 0;
this._altTabPopup = altTabPopup;
this._mouseTimeOutId = 0;
this.actor.connect('destroy', this._onDestroy.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
},
_onDestroy() {
@@ -738,17 +762,16 @@ var AppSwitcher = new Lang.Class({
// We just assume the whole screen here due to weirdness happing with the passed width
let primary = Main.layoutManager.primaryMonitor;
let parentPadding = this.actor.get_parent().get_theme_node().get_horizontal_padding();
let availWidth = primary.width - parentPadding - this.actor.get_theme_node().get_horizontal_padding();
let parentPadding = this.get_parent().get_theme_node().get_horizontal_padding();
let availWidth = primary.width - parentPadding - this.get_theme_node().get_horizontal_padding();
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let iconSizes = baseIconSizes.map(s => s * scaleFactor);
let iconSize = baseIconSizes[0];
if (this._items.length == 1) {
this._iconSize = baseIconSizes[0];
} else {
if (this._items.length > 1) {
for(let i = 0; i < baseIconSizes.length; i++) {
this._iconSize = baseIconSizes[i];
iconSize = baseIconSizes[i];
let height = iconSizes[i] + iconSpacing;
let w = height * this._items.length + totalSpacing;
if (w <= availWidth)
@@ -756,32 +779,36 @@ var AppSwitcher = new Lang.Class({
}
}
this._iconSize = iconSize;
for(let i = 0; i < this.icons.length; i++) {
if (this.icons[i].icon != null)
break;
this.icons[i].set_size(this._iconSize);
this.icons[i].set_size(iconSize);
}
},
_getPreferredHeight(actor, forWidth, alloc) {
vfunc_get_preferred_height(forWidth) {
this._setIconSize();
this.parent(actor, forWidth, alloc);
return this.parent(forWidth);
},
_allocate(actor, box, flags) {
vfunc_allocate(box, flags) {
// Allocate the main list items
this.parent(actor, box, flags);
this.parent(box, flags);
let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
let contentBox = this.get_theme_node().get_content_box(box);
let arrowHeight = Math.floor(this.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
let arrowWidth = arrowHeight * 2;
// Now allocate each arrow underneath its item
let childBox = new Clutter.ActorBox();
for (let i = 0; i < this._items.length; i++) {
let itemBox = this._items[i].allocation;
childBox.x1 = Math.floor(itemBox.x1 + (itemBox.x2 - itemBox.x1 - arrowWidth) / 2);
childBox.x1 = contentBox.x1 + Math.floor(itemBox.x1 + (itemBox.x2 - itemBox.x1 - arrowWidth) / 2);
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y1 = itemBox.y2 + arrowHeight;
childBox.y1 = contentBox.y1 + itemBox.y2 + arrowHeight;
childBox.y2 = childBox.y1 + arrowHeight;
this._arrows[i].allocate(childBox, flags);
}
@@ -839,7 +866,7 @@ var AppSwitcher = new Lang.Class({
_addIcon(appIcon) {
this.icons.push(appIcon);
let item = this.addItem(appIcon.actor, appIcon.label);
let item = this.addItem(appIcon, appIcon.label);
appIcon._stateChangedId = appIcon.app.connect('notify::state', app => {
if (app.state != Shell.AppState.RUNNING)
@@ -849,7 +876,7 @@ var AppSwitcher = new Lang.Class({
let n = this._arrows.length;
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
this._list.add_actor(arrow);
this.add_actor(arrow);
this._arrows.push(arrow);
if (appIcon.cachedWindows.length == 1)
@@ -907,21 +934,21 @@ var ThumbnailList = new Lang.Class({
}
this.actor.connect('destroy', this._onDestroy.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
},
addClones(availHeight) {
if (!this._thumbnailBins.length)
return;
let totalPadding = this._items[0].get_theme_node().get_horizontal_padding() + this._items[0].get_theme_node().get_vertical_padding();
totalPadding += this.actor.get_theme_node().get_horizontal_padding() + this.actor.get_theme_node().get_vertical_padding();
totalPadding += this.get_theme_node().get_horizontal_padding() + this.get_theme_node().get_vertical_padding();
let [labelMinHeight, labelNaturalHeight] = this._labels[0].get_preferred_height(-1);
let spacing = this._items[0].child.get_theme_node().get_length('spacing');
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let thumbnailSize = THUMBNAIL_DEFAULT_SIZE * scaleFactor;
availHeight = Math.min(availHeight - labelNaturalHeight - totalPadding - spacing, thumbnailSize);
let binHeight = availHeight + this._items[0].get_theme_node().get_vertical_padding() + this.actor.get_theme_node().get_vertical_padding() - spacing;
let binHeight = availHeight + this._items[0].get_theme_node().get_vertical_padding() + this.get_theme_node().get_vertical_padding() - spacing;
binHeight = Math.min(thumbnailSize, binHeight);
for (let i = 0; i < this._thumbnailBins.length; i++) {
@@ -956,7 +983,7 @@ var ThumbnailList = new Lang.Class({
if (this._clones.length > 0)
this.highlight(SwitcherPopup.mod(index, this._clones.length));
else
this.actor.destroy();
this.destroy();
},
_onDestroy() {
@@ -970,15 +997,17 @@ var ThumbnailList = new Lang.Class({
var WindowIcon = new Lang.Class({
Name: 'WindowIcon',
Extends: St.BoxLayout,
_init(window, mode) {
this.parent({ style_class: 'alt-tab-app',
vertical: true });
this.window = window;
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
vertical: true });
this._icon = new St.Widget({ layout_manager: new Clutter.BinLayout() });
this.actor.add(this._icon, { x_fill: false, y_fill: false } );
this.add(this._icon, { x_fill: false, y_fill: false } );
this.label = new St.Label({ text: window.get_title() });
let tracker = Shell.WindowTracker.get_default();
@@ -1034,7 +1063,7 @@ var WindowList = new Lang.Class({
this._label = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER });
this.actor.add_actor(this._label);
this.add_actor(this._label);
this.windows = windows;
this.icons = [];
@@ -1043,7 +1072,7 @@ var WindowList = new Lang.Class({
let win = windows[i];
let icon = new WindowIcon(win, mode);
this.addItem(icon.actor, icon.label);
this.addItem(icon, icon.label);
this.icons.push(icon);
icon._unmanagedSignalId = icon.window.connect('unmanaged', (window) => {
@@ -1051,7 +1080,7 @@ var WindowList = new Lang.Class({
});
}
this.actor.connect('destroy', () => { this._onDestroy(); });
this.connect('destroy', this._onDestroy.bind(this));
},
_onDestroy() {
@@ -1060,26 +1089,40 @@ var WindowList = new Lang.Class({
});
},
_getPreferredHeight(actor, forWidth, alloc) {
this.parent(actor, forWidth, alloc);
vfunc_get_preferred_height(forWidth) {
let [minHeight, natHeight] = this.parent(forWidth);
let spacing = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
let spacing = this.get_theme_node().get_padding(St.Side.BOTTOM);
let [labelMin, labelNat] = this._label.get_preferred_height(-1);
alloc.min_size += labelMin + spacing;
alloc.natural_size += labelNat + spacing;
minHeight += labelMin + spacing;
natHeight += labelNat + spacing;
return [minHeight, natHeight];
},
_allocateTop(actor, box, flags) {
vfunc_allocate(box, flags) {
let themeNode = this.get_theme_node();
let contentBox = themeNode.get_content_box(box);
let childBox = new Clutter.ActorBox();
childBox.x1 = box.x1;
childBox.x2 = box.x2;
childBox.y2 = box.y2;
childBox.x1 = contentBox.x1;
childBox.x2 = contentBox.x2;
childBox.y2 = contentBox.y2;
childBox.y1 = childBox.y2 - this._label.height;
this._label.allocate(childBox, flags);
let spacing = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
box.y2 -= this._label.height + spacing;
this.parent(actor, box, flags);
let totalLabelHeight = this._label.height + themeNode.get_padding(St.Side.BOTTOM)
childBox.x1 = box.x1;
childBox.x2 = box.x2;
childBox.y1 = box.y1;
childBox.y2 = box.y2 - totalLabelHeight;
this.parent(childBox, flags);
// Hooking up the parent vfunc will call this.set_allocation() with
// the height without the label height, so call it again with the
// correct size here.
this.set_allocation(box, flags);
},
highlight(index, justOutline) {

View File

@@ -126,17 +126,17 @@ var BaseAppView = new Lang.Class({
else
this._grid = new IconGrid.IconGrid(gridParams);
this._grid.connect('key-focus-in', (grid, actor) => {
this._keyFocusIn(actor);
this._grid.connect('child-focused', (grid, actor) => {
this._childFocused(actor);
});
// Standard hack for ClutterBinLayout
this._grid.actor.x_expand = true;
this._grid.x_expand = true;
this._items = {};
this._allItems = [];
},
_keyFocusIn(actor) {
_childFocused(actor) {
// Nothing by default
},
@@ -203,7 +203,7 @@ var BaseAppView = new Lang.Class({
},
_doSpringAnimation(animationDirection) {
this._grid.actor.opacity = 255;
this._grid.opacity = 255;
this._grid.animateSpring(animationDirection,
Main.overview.getShowAppsButton());
},
@@ -217,8 +217,8 @@ var BaseAppView = new Lang.Class({
}
if (animationDirection == IconGrid.AnimationDirection.IN) {
let id = this._grid.actor.connect('paint', () => {
this._grid.actor.disconnect(id);
let id = this._grid.connect('paint', () => {
this._grid.disconnect(id);
this._doSpringAnimation(animationDirection);
});
} else {
@@ -228,7 +228,7 @@ var BaseAppView = new Lang.Class({
animateSwitch(animationDirection) {
Tweener.removeTweens(this.actor);
Tweener.removeTweens(this._grid.actor);
Tweener.removeTweens(this._grid);
let params = { time: VIEWS_SWITCH_TIME,
transition: 'easeOutQuad' };
@@ -242,7 +242,7 @@ var BaseAppView = new Lang.Class({
params.onComplete = () => { this.actor.hide(); };
}
Tweener.addTween(this._grid.actor, params);
Tweener.addTween(this._grid, params);
}
});
Signals.addSignalMethods(BaseAppView.prototype);
@@ -396,7 +396,7 @@ var AllView = new Lang.Class({
let box = new St.BoxLayout({ vertical: true });
this._grid.currentPage = 0;
this._stack.add_actor(this._grid.actor);
this._stack.add_actor(this._grid);
this._eventBlocker = new St.Widget({ x_expand: true, y_expand: true });
this._stack.add_actor(this._eventBlocker);
@@ -717,7 +717,7 @@ var AllView = new Lang.Class({
});
},
_keyFocusIn(icon) {
_childFocused(icon) {
let itemPage = this._grid.getItemPage(icon);
this.goToPage(itemPage);
},
@@ -745,7 +745,7 @@ var AllView = new Lang.Class({
box.y2 = height;
box = this.actor.get_theme_node().get_content_box(box);
box = this._scrollView.get_theme_node().get_content_box(box);
box = this._grid.actor.get_theme_node().get_content_box(box);
box = this._grid.get_theme_node().get_content_box(box);
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
let oldNPages = this._grid.nPages();
@@ -794,9 +794,9 @@ var FrequentView = new Lang.Class({
y_align: Clutter.ActorAlign.CENTER,
y_expand: true });
this._grid.actor.y_expand = true;
this._grid.y_expand = true;
this.actor.add_actor(this._grid.actor);
this.actor.add_actor(this._grid);
this.actor.add_actor(this._noFrequentAppsLabel);
this._noFrequentAppsLabel.hide();
@@ -809,11 +809,11 @@ var FrequentView = new Lang.Class({
},
hasUsefulData() {
return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT;
return this._usage.get_most_used().length >= MIN_FREQUENT_APPS_COUNT;
},
_loadApps() {
let mostUsed = this._usage.get_most_used ("");
let mostUsed = this._usage.get_most_used();
let hasUsefulData = this.hasUsefulData();
this._noFrequentAppsLabel.visible = !hasUsefulData;
if(!hasUsefulData)
@@ -843,7 +843,7 @@ var FrequentView = new Lang.Class({
box.x2 = width;
box.y2 = height;
box = this.actor.get_theme_node().get_content_box(box);
box = this._grid.actor.get_theme_node().get_content_box(box);
box = this._grid.get_theme_node().get_content_box(box);
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
this._grid.adaptToSize(availWidth, availHeight);
@@ -1112,7 +1112,7 @@ var AppSearchProvider = new Lang.Class({
return app && app.should_show();
});
results = results.concat(group.sort(
(a, b) => usage.compare('', a, b)
(a, b) => usage.compare(a, b)
));
});
@@ -1141,12 +1141,12 @@ var FolderView = new Lang.Class({
this.parent(null, null);
// If it not expand, the parent doesn't take into account its preferred_width when allocating
// the second time it allocates, so we apply the "Standard hack for ClutterBinLayout"
this._grid.actor.x_expand = true;
this._grid.x_expand = true;
this.actor = new St.ScrollView({ overlay_scrollbars: true });
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
let scrollableContainer = new St.BoxLayout({ vertical: true, reactive: true });
scrollableContainer.add_actor(this._grid.actor);
scrollableContainer.add_actor(this._grid);
this.actor.add_actor(scrollableContainer);
let action = new Clutter.PanAction({ interpolate: true });
@@ -1154,7 +1154,7 @@ var FolderView = new Lang.Class({
this.actor.add_action(action);
},
_keyFocusIn(actor) {
_childFocused(actor) {
Util.ensureActorVisibleInScrollView(this.actor, actor);
},
@@ -1267,7 +1267,7 @@ var FolderIcon = new Lang.Class({
this._popupInvalidated = false;
this.icon = new IconGrid.BaseIcon('', { createIcon: this._createIcon.bind(this), setSizeManually: true });
this.actor.set_child(this.icon.actor);
this.actor.set_child(this.icon);
this.actor.label_actor = this.icon.label;
this.view = new FolderView();
@@ -1369,7 +1369,7 @@ var FolderIcon = new Lang.Class({
_updatePopupSize() {
// StWidget delays style calculation until needed, make sure we use the correct values
this.view._grid.actor.ensure_style();
this.view._grid.ensure_style();
let offsetForEachSide = Math.ceil((this._popup.getOffset(St.Side.TOP) +
this._popup.getOffset(St.Side.BOTTOM) -
@@ -1462,7 +1462,9 @@ var AppFolderPopup = new Lang.Class({
global.focus_manager.add_group(this.actor);
source.actor.connect('destroy', () => { this.actor.destroy(); });
this._grabHelper = new GrabHelper.GrabHelper(this.actor);
this._grabHelper = new GrabHelper.GrabHelper(this.actor, {
actionMode: Shell.ActionMode.POPUP
});
this._grabHelper.addActor(Main.layoutManager.overviewGroup);
this.actor.connect('key-press-event', this._onKeyPress.bind(this));
},
@@ -1535,7 +1537,7 @@ var AppFolderPopup = new Lang.Class({
// is completed so we can animate the icons after as we like without
// showing them while boxpointer is animating.
this._view.actor.opacity = 0;
this._boxPointer.show(BoxPointer.PopupAnimation.FADE |
this._boxPointer.open(BoxPointer.PopupAnimation.FADE |
BoxPointer.PopupAnimation.SLIDE,
() => {
this._view.actor.opacity = 255;
@@ -1551,8 +1553,8 @@ var AppFolderPopup = new Lang.Class({
this._grabHelper.ungrab({ actor: this.actor });
this._boxPointer.hide(BoxPointer.PopupAnimation.FADE |
BoxPointer.PopupAnimation.SLIDE);
this._boxPointer.close(BoxPointer.PopupAnimation.FADE |
BoxPointer.PopupAnimation.SLIDE);
this._isOpen = false;
this.emit('open-state-changed', false);
},
@@ -1615,7 +1617,7 @@ var AppIcon = new Lang.Class({
iconParams['createIcon'] = this._createIcon.bind(this);
iconParams['setSizeManually'] = true;
this.icon = new IconGrid.BaseIcon(app.get_name(), iconParams);
this._iconContainer.add_child(this.icon.actor);
this._iconContainer.add_child(this.icon);
this.actor.label_actor = this.icon.label;

View File

@@ -34,25 +34,25 @@ var POPUP_ANIMATION_TIME = 0.15;
*/
var BoxPointer = new Lang.Class({
Name: 'BoxPointer',
Extends: St.Widget,
Signals: { 'arrow-side-changed': {} },
_init(arrowSide, binProperties) {
this.parent();
this.actor = this;
this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
this._arrowSide = arrowSide;
this._userArrowSide = arrowSide;
this._arrowOrigin = 0;
this._arrowActor = null;
this.actor = new St.Bin({ x_fill: true,
y_fill: true });
this._container = new Shell.GenericContainer();
this.actor.set_child(this._container);
this.actor.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
this._container.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this._container.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this._container.connect('allocate', this._allocate.bind(this));
this.bin = new St.Bin(binProperties);
this._container.add_actor(this.bin);
this.add_actor(this.bin);
this._border = new St.DrawingArea();
this._border.connect('repaint', this._drawBorder.bind(this));
this._container.add_actor(this._border);
this.add_actor(this._border);
this.bin.raise(this._border);
this._xOffset = 0;
this._yOffset = 0;
@@ -69,19 +69,49 @@ var BoxPointer = new Lang.Class({
_muteInput() {
if (this._capturedEventId == 0)
this._capturedEventId = this.actor.connect('captured-event',
() => Clutter.EVENT_STOP);
this._capturedEventId = this.connect('captured-event',
() => Clutter.EVENT_STOP);
},
_unmuteInput() {
if (this._capturedEventId != 0) {
this.actor.disconnect(this._capturedEventId);
this.disconnect(this._capturedEventId);
this._capturedEventId = 0;
}
},
// BoxPointer.show() and BoxPointer.hide() are here for only compatibility
// purposes, and will be removed in 3.32.
show(animate, onComplete) {
let themeNode = this.actor.get_theme_node();
if (animate !== undefined) {
try {
throw new Error('BoxPointer.show() has been moved to BoxPointer.open(), this code will break in the future.');
} catch(e) {
logError(e);
this.open(animate, onComplete);
return;
}
}
this.visible = true;
},
hide(animate, onComplete) {
if (animate !== undefined) {
try {
throw new Error('BoxPointer.hide() has been moved to BoxPointer.close(), this code will break in the future.');
} catch(e) {
logError(e);
this.close(animate, onComplete);
return;
}
}
this.visible = false;
},
open(animate, onComplete) {
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
@@ -90,7 +120,7 @@ var BoxPointer = new Lang.Class({
else
this.opacity = 255;
this.actor.show();
this.show();
if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) {
@@ -121,13 +151,13 @@ var BoxPointer = new Lang.Class({
time: animationTime });
},
hide(animate, onComplete) {
if (!this.actor.visible)
close(animate, onComplete) {
if (!this.visible)
return;
let xOffset = 0;
let yOffset = 0;
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
let fade = (animate & PopupAnimation.FADE);
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
@@ -158,7 +188,7 @@ var BoxPointer = new Lang.Class({
transition: 'linear',
time: animationTime,
onComplete: () => {
this.actor.hide();
this.hide();
this.opacity = 0;
this.xOffset = 0;
this.yOffset = 0;
@@ -168,37 +198,48 @@ var BoxPointer = new Lang.Class({
});
},
_adjustAllocationForArrow(isWidth, alloc) {
let themeNode = this.actor.get_theme_node();
_adjustAllocationForArrow(isWidth, minSize, natSize) {
let themeNode = this.get_theme_node();
let borderWidth = themeNode.get_length('-arrow-border-width');
alloc.min_size += borderWidth * 2;
alloc.natural_size += borderWidth * 2;
minSize += borderWidth * 2;
natSize += borderWidth * 2;
if ((!isWidth && (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM))
|| (isWidth && (this._arrowSide == St.Side.LEFT || this._arrowSide == St.Side.RIGHT))) {
let rise = themeNode.get_length('-arrow-rise');
alloc.min_size += rise;
alloc.natural_size += rise;
minSize += rise;
natSize += rise;
}
return [minSize, natSize];
},
_getPreferredWidth(actor, forHeight, alloc) {
let [minInternalSize, natInternalSize] = this.bin.get_preferred_width(forHeight);
alloc.min_size = minInternalSize;
alloc.natural_size = natInternalSize;
this._adjustAllocationForArrow(true, alloc);
vfunc_get_preferred_width(forHeight) {
let themeNode = this.get_theme_node();
forHeight = themeNode.adjust_for_height(forHeight);
let width = this.bin.get_preferred_width(forHeight);
width = this._adjustAllocationForArrow(true, ...width);
return themeNode.adjust_preferred_width(...width);
},
_getPreferredHeight(actor, forWidth, alloc) {
let themeNode = this.actor.get_theme_node();
vfunc_get_preferred_height(forWidth) {
let themeNode = this.get_theme_node();
let borderWidth = themeNode.get_length('-arrow-border-width');
let [minSize, naturalSize] = this.bin.get_preferred_height(forWidth - 2 * borderWidth);
alloc.min_size = minSize;
alloc.natural_size = naturalSize;
this._adjustAllocationForArrow(false, alloc);
forWidth = themeNode.adjust_for_width(forWidth);
let height = this.bin.get_preferred_height(forWidth - 2 * borderWidth);
height = this._adjustAllocationForArrow(false, ...height);
return themeNode.adjust_preferred_height(...height);
},
_allocate(actor, box, flags) {
let themeNode = this.actor.get_theme_node();
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let themeNode = this.get_theme_node();
box = themeNode.get_content_box(box);
let borderWidth = themeNode.get_length('-arrow-border-width');
let rise = themeNode.get_length('-arrow-rise');
let childBox = new Clutter.ActorBox();
@@ -238,12 +279,12 @@ var BoxPointer = new Lang.Class({
},
_drawBorder(area) {
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
if (this._arrowActor) {
let [sourceX, sourceY] = this._arrowActor.get_transformed_position();
let [sourceWidth, sourceHeight] = this._arrowActor.get_transformed_size();
let [absX, absY] = this.actor.get_transformed_position();
let [absX, absY] = this.get_transformed_position();
if (this._arrowSide == St.Side.TOP ||
this._arrowSide == St.Side.BOTTOM) {
@@ -422,7 +463,7 @@ var BoxPointer = new Lang.Class({
setPosition(sourceActor, alignment) {
// We need to show it now to force an allocation,
// so that we can query the correct size.
this.actor.show();
this.show();
this._sourceActor = sourceActor;
this._arrowAlignment = alignment;
@@ -450,13 +491,13 @@ var BoxPointer = new Lang.Class({
let sourceAllocation = Shell.util_get_transformed_allocation(sourceActor);
let sourceCenterX = sourceAllocation.x1 + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) * this._sourceAlignment;
let sourceCenterY = sourceAllocation.y1 + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) * this._sourceAlignment;
let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size();
let [minWidth, minHeight, natWidth, natHeight] = this.get_preferred_size();
// We also want to keep it onscreen, and separated from the
// edge by the same distance as the main part of the box is
// separated from its sourceActor
let monitor = Main.layoutManager.findMonitorForActor(sourceActor);
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
let borderWidth = themeNode.get_length('-arrow-border-width');
let arrowBase = themeNode.get_length('-arrow-base');
let borderRadius = themeNode.get_length('-arrow-border-radius');
@@ -542,7 +583,7 @@ var BoxPointer = new Lang.Class({
this.setArrowOrigin(arrowOrigin);
let parent = this.actor.get_parent();
let parent = this.get_parent();
let success, x, y;
while (!success) {
[success, x, y] = parent.transform_stage_point(resX, resY);
@@ -581,16 +622,16 @@ var BoxPointer = new Lang.Class({
// allocation loops and warnings. Instead we do the positioning via
// the anchor point, which is independent of allocation, and leave
// x == y == 0.
this.actor.set_anchor_point(-(this._xPosition + this._xOffset),
-(this._yPosition + this._yOffset));
this.set_anchor_point(-(this._xPosition + this._xOffset),
-(this._yPosition + this._yOffset));
},
_calculateArrowSide(arrowSide) {
let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor);
let [minWidth, minHeight, boxWidth, boxHeight] = this._container.get_preferred_size();
let [minWidth, minHeight, boxWidth, boxHeight] = this.get_preferred_size();
let monitorActor = this.sourceActor;
if (!monitorActor)
monitorActor = this.actor;
monitorActor = this;
let monitor = Main.layoutManager.findMonitorForActor(monitorActor);
switch (arrowSide) {
@@ -625,7 +666,7 @@ var BoxPointer = new Lang.Class({
this._arrowSide = arrowSide;
this._reposition();
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._container.queue_relayout();
this.queue_relayout();
return false;
});
@@ -651,14 +692,6 @@ var BoxPointer = new Lang.Class({
return this._yOffset;
},
set opacity(opacity) {
this.actor.opacity = opacity;
},
get opacity() {
return this.actor.opacity;
},
updateArrowSide(side) {
this._arrowSide = side;
this._border.queue_repaint();
@@ -671,7 +704,6 @@ var BoxPointer = new Lang.Class({
},
getArrowHeight() {
return this.actor.get_theme_node().get_length('-arrow-rise');
return this.get_theme_node().get_length('-arrow-rise');
}
});
Signals.addSignalMethods(BoxPointer.prototype);

View File

@@ -446,6 +446,7 @@ var Calendar = new Lang.Class({
this._backButton = new St.Button({ style_class: 'calendar-change-month-back pager-button',
accessible_name: _("Previous month"),
can_focus: true });
this._backButton.add_actor(new St.Icon({ icon_name: 'pan-start-symbolic' }));
this._topBox.add(this._backButton);
this._backButton.connect('clicked', this._onPrevMonthButtonClicked.bind(this));
@@ -456,6 +457,7 @@ var Calendar = new Lang.Class({
this._forwardButton = new St.Button({ style_class: 'calendar-change-month-forward pager-button',
accessible_name: _("Next month"),
can_focus: true });
this._forwardButton.add_actor(new St.Icon({ icon_name: 'pan-end-symbolic' }));
this._topBox.add(this._forwardButton);
this._forwardButton.connect('clicked', this._onNextMonthButtonClicked.bind(this));
@@ -773,9 +775,11 @@ var NotificationMessage = new Lang.Class({
this.connect('close', () => {
this._closed = true;
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
if (this.notification)
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
});
this._destroyId = notification.connect('destroy', () => {
this.notification = null;
if (!this._closed)
this.close();
});
@@ -866,11 +870,11 @@ var EventsSection = new Lang.Class({
if (sameYear(this._date, now))
/* Translators: Shown on calendar heading when selected day occurs on current year */
dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
"%A, %B %d"));
"%A, %B %-d"));
else
/* Translators: Shown on calendar heading when selected day occurs on different year */
dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
"%A, %B %d, %Y"));
"%A, %B %-d, %Y"));
this._title.label = this._date.toLocaleFormat(dayFormat);
},

View File

@@ -197,9 +197,13 @@ var AutomountManager = new Lang.Class({
this._closeOperation(volume);
} catch (e) {
// FIXME: we will always get G_IO_ERROR_FAILED from the gvfs udisks
// backend in this case, see
// https://bugs.freedesktop.org/show_bug.cgi?id=51271
if (e.message.indexOf('No key available with this passphrase') != -1) {
// backend, see https://bugs.freedesktop.org/show_bug.cgi?id=51271
// To reask the password if the user input was empty or wrong, we
// will check for corresponding error messages. However, these
// error strings are not unique for the cases in the comments below.
if (e.message.includes('No key available with this passphrase') || // cryptsetup
e.message.includes('No key available to unlock device') || // udisks (no password)
e.message.includes('Error unlocking')) { // udisks (wrong password)
this._reaskPassword(volume);
} else {
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))

View File

@@ -125,10 +125,10 @@ var CtrlAltTabManager = new Lang.Class({
this._popup = new CtrlAltTabPopup(items);
this._popup.show(backward, binding, mask);
this._popup.actor.connect('destroy',
() => {
this._popup = null;
});
this._popup.connect('destroy',
() => {
this._popup = null;
});
}
},

View File

@@ -38,7 +38,10 @@ var DashItemContainer = new Lang.Class({
Extends: St.Widget,
_init() {
this.parent({ style_class: 'dash-item-container' });
this.parent({ style_class: 'dash-item-container',
pivot_point: new Clutter.Point({ x: .5, y: .5 }),
x_expand: true,
x_align: Clutter.ActorAlign.CENTER });
this._labelText = "";
this.label = new St.Label({ style_class: 'dash-label'});
@@ -52,56 +55,26 @@ var DashItemContainer = new Lang.Class({
this.animatingOut = false;
this.connect('destroy', () => {
if (this.child != null)
this.child.destroy();
this.label.destroy();
});
},
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
if (this.child == null)
return;
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
let [minChildWidth, minChildHeight, natChildWidth, natChildHeight] =
this.child.get_preferred_size();
let [childScaleX, childScaleY] = this.child.get_scale();
let childWidth = Math.min(natChildWidth * childScaleX, availWidth);
let childHeight = Math.min(natChildHeight * childScaleY, availHeight);
let childBox = new Clutter.ActorBox();
childBox.x1 = (availWidth - childWidth) / 2;
childBox.y1 = (availHeight - childHeight) / 2;
childBox.x2 = childBox.x1 + childWidth;
childBox.y2 = childBox.y1 + childHeight;
this.child.allocate(childBox, flags);
},
vfunc_get_preferred_height(forWidth) {
let themeNode = this.get_theme_node();
if (this.child == null)
return [0, 0];
forWidth = themeNode.adjust_for_width(forWidth);
let [minHeight, natHeight] = this.child.get_preferred_height(forWidth);
return themeNode.adjust_preferred_height(minHeight * this.child.scale_y,
natHeight * this.child.scale_y);
let [minHeight, natHeight] = this.parent(forWidth);
return themeNode.adjust_preferred_height(minHeight * this.scale_y,
natHeight * this.scale_y);
},
vfunc_get_preferred_width(forHeight) {
let themeNode = this.get_theme_node();
if (this.child == null)
return [0, 0];
forHeight = themeNode.adjust_for_height(forHeight);
let [minWidth, natWidth] = this.child.get_preferred_width(forHeight);
return themeNode.adjust_preferred_width(minWidth * this.child.scale_y,
natWidth * this.child.scale_y);
let [minWidth, natWidth] = this.parent(forHeight);
return themeNode.adjust_preferred_width(minWidth * this.scale_x,
natWidth * this.scale_x);
},
showLabel() {
@@ -163,9 +136,8 @@ var DashItemContainer = new Lang.Class({
this.child = actor;
this.add_actor(this.child);
this.child.set_scale_with_gravity(this._childScale, this._childScale,
Clutter.Gravity.CENTER);
this.child.set_opacity(this._childOpacity);
this.set_scale(this._childScale, this._childScale);
this.set_opacity(this._childOpacity);
},
show(animate) {
@@ -204,11 +176,7 @@ var DashItemContainer = new Lang.Class({
set childScale(scale) {
this._childScale = scale;
if (this.child == null)
return;
this.child.set_scale_with_gravity(scale, scale,
Clutter.Gravity.CENTER);
this.set_scale(scale, scale);
this.queue_relayout();
},
@@ -219,10 +187,7 @@ var DashItemContainer = new Lang.Class({
set childOpacity(opacity) {
this._childOpacity = opacity;
if (this.child == null)
return;
this.child.set_opacity(opacity);
this.set_opacity(opacity);
this.queue_redraw();
},
@@ -247,7 +212,7 @@ var ShowAppsIcon = new Lang.Class({
{ setSizeManually: true,
showLabel: false,
createIcon: this._createIcon.bind(this) });
this.toggleButton.add_actor(this.icon.actor);
this.toggleButton.add_actor(this.icon);
this.toggleButton._delegate = this;
this.setChild(this.toggleButton);
@@ -643,10 +608,10 @@ var Dash = new Lang.Class({
// Enforce the current icon size during the size request
firstIcon.icon.ensure_style();
let [currentWidth, currentHeight] = firstIcon.icon.get_size();
firstIcon.icon.set_size(this.iconSize * scaleFactor, this.iconSize * scaleFactor);
let [, currentHeight] = firstIcon.icon.get_size();
firstIcon.icon.set_height(this.iconSize * scaleFactor);
[minHeight, natHeight] = firstButton.get_preferred_height(-1);
firstIcon.icon.set_size(currentWidth, currentHeight);
firstIcon.icon.set_height(currentHeight);
// Subtract icon padding and box spacing from the available height
availHeight -= iconChildren.length * (natHeight - this.iconSize * scaleFactor) +

View File

@@ -69,9 +69,11 @@ var TodayButton = new Lang.Class({
this._dayLabel.set_text(date.toLocaleFormat('%A'));
/* Translators: This is the date format to use when the calendar popup is
* shown - it is shown just below the time in the shell (e.g. "Tue 9:29 AM").
* shown - it is shown just below the time in the top bar (e.g.,
* "Tue 9:29 AM"). The string itself should become a full date, e.g.,
* "February 17 2015".
*/
let dateFormat = Shell.util_translate_time_string (N_("%B %e %Y"));
let dateFormat = Shell.util_translate_time_string (N_("%B %-d %Y"));
this._dateLabel.set_text(date.toLocaleFormat(dateFormat));
/* Translators: This is the accessible name of the date button shown

View File

@@ -133,9 +133,9 @@ var CandidatePopup = new Lang.Class({
_init() {
this._boxPointer = new BoxPointer.BoxPointer(St.Side.TOP);
this._boxPointer.actor.visible = false;
this._boxPointer.actor.style_class = 'candidate-popup-boxpointer';
Main.layoutManager.addChrome(this._boxPointer.actor);
this._boxPointer.visible = false;
this._boxPointer.style_class = 'candidate-popup-boxpointer';
Main.layoutManager.addChrome(this._boxPointer);
let box = new St.BoxLayout({ style_class: 'candidate-popup-content',
vertical: true });
@@ -272,7 +272,7 @@ var CandidatePopup = new Lang.Class({
this._updateVisibility();
});
panelService.connect('focus-out', ps => {
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
this._boxPointer.close(BoxPointer.PopupAnimation.NONE);
Main.keyboard.resetSuggestions();
});
},
@@ -291,10 +291,10 @@ var CandidatePopup = new Lang.Class({
if (isVisible) {
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
this._boxPointer.show(BoxPointer.PopupAnimation.NONE);
this._boxPointer.open(BoxPointer.PopupAnimation.NONE);
this._boxPointer.actor.raise_top();
} else {
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
this._boxPointer.close(BoxPointer.PopupAnimation.NONE);
}
},

View File

@@ -36,6 +36,7 @@ var APPICON_ANIMATION_OUT_TIME = 0.25;
var BaseIcon = new Lang.Class({
Name: 'BaseIcon',
Extends: St.Bin,
_init(label, params) {
params = Params.parse(params, { createIcon: null,
@@ -46,32 +47,26 @@ var BaseIcon = new Lang.Class({
if (params.showLabel)
styleClass += ' overview-icon-with-label';
this.actor = new St.Bin({ style_class: styleClass,
x_fill: true,
y_fill: true });
this.actor._delegate = this;
this.actor.connect('style-changed', this._onStyleChanged.bind(this));
this.actor.connect('destroy', this._onDestroy.bind(this));
this.parent({ style_class: styleClass,
x_fill: true,
y_fill: true });
this._spacing = 0;
this.actor = this;
let box = new Shell.GenericContainer();
box.connect('allocate', this._allocate.bind(this));
box.connect('get-preferred-width',
this._getPreferredWidth.bind(this));
box.connect('get-preferred-height',
this._getPreferredHeight.bind(this));
this.actor.set_child(box);
this.connect('destroy', this._onDestroy.bind(this));
this._box = new St.BoxLayout({ vertical: true });
this.set_child(this._box);
this.iconSize = ICON_SIZE;
this._iconBin = new St.Bin({ x_align: St.Align.MIDDLE,
y_align: St.Align.MIDDLE });
box.add_actor(this._iconBin);
this._box.add_actor(this._iconBin);
if (params.showLabel) {
this.label = new St.Label({ text: label });
box.add_actor(this.label);
this._box.add_actor(this.label);
} else {
this.label = null;
}
@@ -86,54 +81,9 @@ var BaseIcon = new Lang.Class({
this._iconThemeChangedId = cache.connect('icon-theme-changed', this._onIconThemeChanged.bind(this));
},
_allocate(actor, box, flags) {
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
let iconSize = availHeight;
let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(-1);
let [iconMinWidth, iconNatWidth] = this._iconBin.get_preferred_width(-1);
let preferredHeight = iconNatHeight;
let childBox = new Clutter.ActorBox();
if (this.label) {
let [labelMinHeight, labelNatHeight] = this.label.get_preferred_height(-1);
preferredHeight += this._spacing + labelNatHeight;
let labelHeight = availHeight >= preferredHeight ? labelNatHeight
: labelMinHeight;
iconSize -= this._spacing + labelHeight;
childBox.x1 = 0;
childBox.x2 = availWidth;
childBox.y1 = iconSize + this._spacing;
childBox.y2 = childBox.y1 + labelHeight;
this.label.allocate(childBox, flags);
}
childBox.x1 = Math.floor((availWidth - iconNatWidth) / 2);
childBox.y1 = Math.floor((iconSize - iconNatHeight) / 2);
childBox.x2 = childBox.x1 + iconNatWidth;
childBox.y2 = childBox.y1 + iconNatHeight;
this._iconBin.allocate(childBox, flags);
},
_getPreferredWidth(actor, forHeight, alloc) {
this._getPreferredHeight(actor, -1, alloc);
},
_getPreferredHeight(actor, forWidth, alloc) {
let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(forWidth);
alloc.min_size = iconMinHeight;
alloc.natural_size = iconNatHeight;
if (this.label) {
let [labelMinHeight, labelNatHeight] = this.label.get_preferred_height(forWidth);
alloc.min_size += this._spacing + labelMinHeight;
alloc.natural_size += this._spacing + labelNatHeight;
}
vfunc_get_preferred_width(forHeight) {
// Return the actual height to keep the squared aspect
return this.get_preferred_height(-1);
},
// This can be overridden by a subclass, or by the createIcon
@@ -161,9 +111,8 @@ var BaseIcon = new Lang.Class({
this._iconBin.child = this.icon;
},
_onStyleChanged() {
let node = this.actor.get_theme_node();
this._spacing = node.get_length('spacing');
vfunc_style_changed() {
let node = this.get_theme_node();
let size;
if (this._setSizeManually) {
@@ -195,7 +144,7 @@ var BaseIcon = new Lang.Class({
// Animate only the child instead of the entire actor, so the
// styles like hover and running are not applied while
// animating.
zoomOutActor(this.actor.child);
zoomOutActor(this.child);
}
});
@@ -240,8 +189,16 @@ function zoomOutActor(actor) {
var IconGrid = new Lang.Class({
Name: 'IconGrid',
Extends: St.Widget,
Signals: {'animation-done': {},
'child-focused': { param_types: [Clutter.Actor.$gtype]} },
_init(params) {
this.parent({ style_class: 'icon-grid',
y_align: Clutter.ActorAlign.START });
this.actor = this;
params = Params.parse(params, { rowLimit: null,
columnLimit: null,
minRows: 1,
@@ -262,34 +219,27 @@ var IconGrid = new Lang.Class({
this.rightPadding = 0;
this.leftPadding = 0;
this.actor = new St.BoxLayout({ style_class: 'icon-grid',
vertical: true });
this._items = [];
this._clonesAnimating = [];
// Pulled from CSS, but hardcode some defaults here
this._spacing = 0;
this._hItemSize = this._vItemSize = ICON_SIZE;
this._fixedHItemSize = this._fixedVItemSize = undefined;
this._grid = new Shell.GenericContainer();
this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
this.actor.connect('style-changed', this._onStyleChanged.bind(this));
this.connect('style-changed', this._onStyleChanged.bind(this));
// Cancel animations when hiding the overview, to avoid icons
// swarming into the void ...
this.actor.connect('notify::mapped', () => {
if (!this.actor.mapped)
this.connect('notify::mapped', () => {
if (!this.mapped)
this._cancelAnimation();
});
this._grid.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this._grid.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this._grid.connect('allocate', this._allocate.bind(this));
this._grid.connect('actor-added', this._childAdded.bind(this));
this._grid.connect('actor-removed', this._childRemoved.bind(this));
this.connect('actor-added', this._childAdded.bind(this));
this.connect('actor-removed', this._childRemoved.bind(this));
},
_keyFocusIn(actor) {
this.emit('key-focus-in', actor);
this.emit('child-focused', actor);
},
_childAdded(grid, child) {
@@ -300,13 +250,13 @@ var IconGrid = new Lang.Class({
child.disconnect(child._iconGridKeyFocusInId);
},
_getPreferredWidth(grid, forHeight, alloc) {
vfunc_get_preferred_width(forHeight) {
if (this._fillParent)
// Ignore all size requests of children and request a size of 0;
// later we'll allocate as many children as fit the parent
return;
return [0, 0];
let nChildren = this._grid.get_n_children();
let nChildren = this.get_n_children();
let nColumns = this._colLimit ? Math.min(this._colLimit,
nChildren)
: nChildren;
@@ -314,22 +264,28 @@ var IconGrid = new Lang.Class({
// Kind of a lie, but not really an issue right now. If
// we wanted to support some sort of hidden/overflow that would
// need higher level design
alloc.min_size = this._getHItemSize() + this.leftPadding + this.rightPadding;
alloc.natural_size = nColumns * this._getHItemSize() + totalSpacing + this.leftPadding + this.rightPadding;
let minSize = this._getHItemSize() + this.leftPadding + this.rightPadding;
let natSize = nColumns * this._getHItemSize() + totalSpacing + this.leftPadding + this.rightPadding;
return this.get_theme_node().adjust_preferred_width(minSize, natSize);
},
_getVisibleChildren() {
return this._grid.get_children().filter(actor => actor.visible);
return this.get_children().filter(actor => actor.visible);
},
_getPreferredHeight(grid, forWidth, alloc) {
vfunc_get_preferred_height(forWidth) {
if (this._fillParent)
// Ignore all size requests of children and request a size of 0;
// later we'll allocate as many children as fit the parent
return;
return [0, 0];
let themeNode = this.get_theme_node();
let children = this._getVisibleChildren();
let nColumns;
forWidth = themeNode.adjust_for_width(forWidth);
if (forWidth < 0)
nColumns = children.length;
else
@@ -344,16 +300,21 @@ var IconGrid = new Lang.Class({
nRows = Math.min(nRows, this._rowLimit);
let totalSpacing = Math.max(0, nRows - 1) * this._getSpacing();
let height = nRows * this._getVItemSize() + totalSpacing + this.topPadding + this.bottomPadding;
alloc.min_size = height;
alloc.natural_size = height;
return themeNode.adjust_preferred_height(height, height);
},
_allocate(grid, box, flags) {
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let themeNode = this.get_theme_node();
box = themeNode.get_content_box(box);
if (this._fillParent) {
// Reset the passed in box to fill the parent
let parentBox = this.actor.get_parent().allocation;
let gridBox = this.actor.get_theme_node().get_content_box(parentBox);
box = this._grid.get_theme_node().get_content_box(gridBox);
let parentBox = this.get_parent().allocation;
let gridBox = themeNode.get_content_box(parentBox);
box = themeNode.get_content_box(gridBox);
}
let children = this._getVisibleChildren();
@@ -383,10 +344,10 @@ var IconGrid = new Lang.Class({
if (this._rowLimit && rowIndex >= this._rowLimit ||
this._fillParent && childBox.y2 > availHeight - this.bottomPadding) {
this._grid.set_skip_paint(children[i], true);
children[i].hide();
} else {
children[i].allocate(childBox, flags);
this._grid.set_skip_paint(children[i], false);
children[i].show();
}
columnIndex++;
@@ -404,6 +365,45 @@ var IconGrid = new Lang.Class({
}
},
vfunc_get_paint_volume(paintVolume) {
// Setting the paint volume does not make sense when we don't have
// any allocation
if (!this.has_allocation())
return false;
let themeNode = this.get_theme_node();
let allocationBox = this.get_allocation_box();
let paintBox = themeNode.get_paint_box(allocationBox);
let origin = new Clutter.Vertex();
origin.x = paintBox.x1 - allocationBox.x1;
origin.y = paintBox.y1 - allocationBox.y1;
origin.z = 0.0;
paintVolume.set_origin(origin);
paintVolume.set_width(paintBox.x2 - paintBox.x1);
paintVolume.set_height(paintBox.y2 - paintBox.y1);
if (this.get_clip_to_allocation())
return true;
for (let child = this.get_first_child();
child != null;
child = child.get_next_sibling()) {
if (!child.visible)
continue;
let childVolume = child.get_transformed_paint_volume(this);
if (!childVolume)
return false
paintVolume.union(childVolume);
}
return true;
},
/**
* Intended to be override by subclasses if they need a different
* set of items to be animated.
@@ -418,6 +418,11 @@ var IconGrid = new Lang.Class({
},
_animationDone() {
this._clonesAnimating.forEach(clone => {
clone.source.reactive = true;
clone.source.opacity = 255;
clone.destroy();
});
this._clonesAnimating = [];
this.emit('animation-done');
},
@@ -443,7 +448,6 @@ var IconGrid = new Lang.Class({
for (let index = 0; index < actors.length; index++) {
let actor = actors[index];
actor.reactive = false;
actor.set_scale(0, 0);
actor.set_pivot_point(0.5, 0.5);
@@ -465,7 +469,6 @@ var IconGrid = new Lang.Class({
onComplete: () => {
if (isLastItem)
this._animationDone();
actor.reactive = true;
}
});
}
@@ -538,10 +541,6 @@ var IconGrid = new Lang.Class({
onComplete: () => {
if (isLastItem)
this._animationDone();
actor.opacity = 255;
actor.reactive = true;
actorClone.destroy();
}};
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad',
@@ -562,12 +561,8 @@ var IconGrid = new Lang.Class({
scale_x: scaleX,
scale_y: scaleY,
onComplete: () => {
if (isLastItem) {
if (isLastItem)
this._animationDone();
this._restoreItemsOpacity();
}
actor.reactive = true;
actorClone.destroy();
}};
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad',
@@ -581,12 +576,6 @@ var IconGrid = new Lang.Class({
}
},
_restoreItemsOpacity() {
for (let index = 0; index < this._items.length; index++) {
this._items[index].actor.opacity = 255;
}
},
_getAllocatedChildSizeAndSpacing(child) {
let [,, natWidth, natHeight] = child.get_preferred_size();
let width = Math.min(this._getHItemSize(), natWidth);
@@ -640,11 +629,11 @@ var IconGrid = new Lang.Class({
},
_onStyleChanged() {
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
this._spacing = themeNode.get_length('spacing');
this._hItemSize = themeNode.get_length('-shell-grid-horizontal-item-size') || ICON_SIZE;
this._vItemSize = themeNode.get_length('-shell-grid-vertical-item-size') || ICON_SIZE;
this._grid.queue_relayout();
this.queue_relayout();
},
nRows(forWidth) {
@@ -676,12 +665,12 @@ var IconGrid = new Lang.Class({
removeAll() {
this._items = [];
this._grid.remove_all_children();
this.remove_all_children();
},
destroyAll() {
this._items = [];
this._grid.destroy_all_children();
this.destroy_all_children();
},
addItem(item, index) {
@@ -690,21 +679,21 @@ var IconGrid = new Lang.Class({
this._items.push(item);
if (index !== undefined)
this._grid.insert_child_at_index(item.actor, index);
this.insert_child_at_index(item.actor, index);
else
this._grid.add_actor(item.actor);
this.add_actor(item.actor);
},
removeItem(item) {
this._grid.remove_child(item.actor);
this.remove_child(item.actor);
},
getItemAtIndex(index) {
return this._grid.get_child_at_index(index);
return this.get_child_at_index(index);
},
visibleItemsCount() {
return this._grid.get_n_children() - this._grid.get_n_skip_paint();
return this.get_children().filter(c => c.is_visible()).length;
},
setSpacing(spacing) {
@@ -790,11 +779,12 @@ var IconGrid = new Lang.Class({
}
}
});
Signals.addSignalMethods(IconGrid.prototype);
var PaginatedIconGrid = new Lang.Class({
Name: 'PaginatedIconGrid',
Extends: IconGrid,
Signals: {'space-opened': {},
'space-closed': {} },
_init(params) {
this.parent(params);
@@ -805,20 +795,22 @@ var PaginatedIconGrid = new Lang.Class({
this._childrenPerPage = 0;
},
_getPreferredHeight(grid, forWidth, alloc) {
alloc.min_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
alloc.natural_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
vfunc_get_preferred_height(forWidth) {
let height = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
return [height, height];
},
_allocate(grid, box, flags) {
vfunc_allocate(box, flags) {
if (this._childrenPerPage == 0)
log('computePages() must be called before allocate(); pagination will not work.');
this.set_allocation(box, flags);
if (this._fillParent) {
// Reset the passed in box to fill the parent
let parentBox = this.actor.get_parent().allocation;
let gridBox = this.actor.get_theme_node().get_content_box(parentBox);
box = this._grid.get_theme_node().get_content_box(gridBox);
let parentBox = this.get_parent().allocation;
let gridBox = this.get_theme_node().get_content_box(parentBox);
box = this.get_theme_node().get_content_box(gridBox);
}
let children = this._getVisibleChildren();
let availWidth = box.x2 - box.x1;
@@ -846,7 +838,7 @@ var PaginatedIconGrid = new Lang.Class({
for (let i = 0; i < children.length; i++) {
let childBox = this._calculateChildBox(children[i], x, y, box);
children[i].allocate(childBox, flags);
this._grid.set_skip_paint(children[i], false);
children[i].show();
columnIndex++;
if (columnIndex == nColumns) {
@@ -1017,4 +1009,3 @@ var PaginatedIconGrid = new Lang.Class({
}
}
});
Signals.addSignalMethods(PaginatedIconGrid.prototype);

View File

@@ -269,7 +269,7 @@ var Key = new Lang.Class({
_onDestroy() {
if (this._boxPointer) {
this._boxPointer.actor.destroy();
this._boxPointer.destroy();
this._boxPointer = null;
}
},
@@ -282,7 +282,7 @@ var Key = new Lang.Class({
{ x_fill: true,
y_fill: true,
x_align: St.Align.START });
this._boxPointer.actor.hide();
this._boxPointer.hide();
Main.layoutManager.addChrome(this._boxPointer.actor);
this._boxPointer.setPosition(this.keyButton, 0.5);
@@ -356,7 +356,7 @@ var Key = new Lang.Class({
},
_showSubkeys() {
this._boxPointer.show(BoxPointer.PopupAnimation.FULL);
this._boxPointer.open(BoxPointer.PopupAnimation.FULL);
this._capturedEventId = global.stage.connect('captured-event',
this._onCapturedEvent.bind(this));
this._unmapId = this.keyButton.connect('notify::mapped', () => {
@@ -367,7 +367,7 @@ var Key = new Lang.Class({
_hideSubkeys() {
if (this._boxPointer)
this._boxPointer.hide(BoxPointer.PopupAnimation.FULL);
this._boxPointer.close(BoxPointer.PopupAnimation.FULL);
if (this._capturedEventId) {
global.stage.disconnect(this._capturedEventId);
this._capturedEventId = 0;

View File

@@ -177,8 +177,16 @@ const defaultParams = {
var LayoutManager = new Lang.Class({
Name: 'LayoutManager',
Extends: GObject.Object,
Signals: { 'hot-corners-changed': {},
'startup-complete': {},
'startup-prepared': {},
'monitors-changed': {},
'keyboard-visible-changed': { param_types: [GObject.TYPE_BOOLEAN] } },
_init() {
this.parent();
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
this.monitors = [];
this.primaryMonitor = null;
@@ -203,21 +211,12 @@ var LayoutManager = new Lang.Class({
global.stage.no_clear_hint = true;
// Set up stage hierarchy to group all UI actors under one container.
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
this.uiGroup = new St.Widget({ name: 'uiGroup' });
this.uiGroup.set_flags(Clutter.ActorFlags.NO_LAYOUT);
this.uiGroup.connect('allocate', (actor, box, flags) => {
let children = actor.get_children();
for (let i = 0; i < children.length; i++)
children[i].allocate_preferred_size(flags);
});
this.uiGroup.connect('get-preferred-width', (actor, forHeight, alloc) => {
let width = global.stage.width;
[alloc.min_size, alloc.natural_size] = [width, width];
});
this.uiGroup.connect('get-preferred-height', (actor, forWidth, alloc) => {
let height = global.stage.height;
[alloc.min_size, alloc.natural_size] = [height, height];
});
this.uiGroup.add_constraint(new Clutter.BindConstraint({
source: global.stage,
coordinate: Clutter.BindCoordinate.ALL,
}));
global.stage.remove_actor(global.window_group);
this.uiGroup.add_actor(global.window_group);
@@ -1078,7 +1077,6 @@ var LayoutManager = new Lang.Class({
this._queueUpdateRegions();
},
});
Signals.addSignalMethods(LayoutManager.prototype);
// HotCorner:

View File

@@ -4,6 +4,7 @@ const Clutter = imports.gi.Clutter;
const Cogl = imports.gi.Cogl;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Meta = imports.gi.Meta;
const Pango = imports.gi.Pango;
@@ -501,18 +502,21 @@ var RedBorderEffect = new Lang.Class({
var Inspector = new Lang.Class({
Name: 'Inspector',
Extends: Clutter.Actor,
Signals: { 'closed': {},
'target': { param_types: [Clutter.Actor.$gtype, GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] } },
_init(lookingGlass) {
let container = new Shell.GenericContainer({ width: 0,
height: 0 });
container.connect('allocate', this._allocate.bind(this));
Main.uiGroup.add_actor(container);
this.parent({ width: 0,
height: 0 });
Main.uiGroup.add_actor(this);
let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
vertical: false,
reactive: true });
this._eventHandler = eventHandler;
container.add_actor(eventHandler);
this.add_actor(eventHandler);
this._displayText = new St.Label();
eventHandler.add(this._displayText, { expand: true });
@@ -534,7 +538,9 @@ var Inspector = new Lang.Class({
this._lookingGlass = lookingGlass;
},
_allocate(actor, box, flags) {
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
if (!this._eventHandler)
return;
@@ -631,8 +637,6 @@ var Inspector = new Lang.Class({
}
});
Signals.addSignalMethods(Inspector.prototype);
var Extensions = new Lang.Class({
Name: 'Extensions',

View File

@@ -50,12 +50,15 @@ var State = {
// These reasons are useful when we destroy the notifications received through
// the notification daemon. We use EXPIRED for notifications that we dismiss
// and the user did not interact with, DISMISSED for all other notifications
// that were destroyed as a result of a user action, and SOURCE_CLOSED for the
// notifications that were requested to be destroyed by the associated source.
// that were destroyed as a result of a user action, SOURCE_CLOSED for the
// notifications that were requested to be destroyed by the associated source,
// and REPLACED for notifications that were destroyed as a consequence of a
// newer version having replaced them.
var NotificationDestroyedReason = {
EXPIRED: 1,
DISMISSED: 2,
SOURCE_CLOSED: 3
SOURCE_CLOSED: 3,
REPLACED: 4
};
// Message tray has its custom Urgency enumeration. LOW, NORMAL and CRITICAL
@@ -587,16 +590,16 @@ var NotificationBanner = new Lang.Class({
var SourceActor = new Lang.Class({
Name: 'SourceActor',
Extends: St.Widget,
_init(source, size) {
this.parent();
this._source = source;
this._size = size;
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.actor.connect('destroy', () => {
this.actor = this;
this.connect('destroy', () => {
this._source.disconnect(this._iconUpdatedId);
this._actorDestroyed = true;
});
@@ -604,10 +607,11 @@ var SourceActor = new Lang.Class({
let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
this._iconBin = new St.Bin({ x_fill: true,
x_expand: true,
height: size * scale_factor,
width: size * scale_factor });
this.actor.add_actor(this._iconBin);
this.add_actor(this._iconBin);
this._iconUpdatedId = this._source.connect('icon-updated', this._updateIcon.bind(this));
this._updateIcon();
@@ -618,21 +622,6 @@ var SourceActor = new Lang.Class({
this._iconSet = true;
},
_getPreferredWidth(actor, forHeight, alloc) {
let [min, nat] = this._iconBin.get_preferred_width(forHeight);
alloc.min_size = min; alloc.nat_size = nat;
},
_getPreferredHeight(actor, forWidth, alloc) {
let [min, nat] = this._iconBin.get_preferred_height(forWidth);
alloc.min_size = min; alloc.nat_size = nat;
},
_allocate(actor, box, flags) {
// the iconBin should fill our entire box
this._iconBin.allocate(box, flags);
},
_updateIcon() {
if (this._actorDestroyed)
return;
@@ -665,23 +654,23 @@ var SourceActorWithLabel = new Lang.Class({
this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y');
});
this.actor.add_actor(this._counterBin);
this.add_actor(this._counterBin);
this._countUpdatedId = this._source.connect('count-updated', this._updateCount.bind(this));
this._updateCount();
this.actor.connect('destroy', () => {
this.connect('destroy', () => {
this._source.disconnect(this._countUpdatedId);
});
},
_allocate(actor, box, flags) {
this.parent(actor, box, flags);
vfunc_allocate(box, flags) {
this.parent(box, flags);
let childBox = new Clutter.ActorBox();
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._counterBin.get_preferred_size();
let direction = this.actor.get_text_direction();
let direction = this.get_text_direction();
if (direction == Clutter.TextDirection.LTR) {
// allocate on the right in LTR
@@ -1322,6 +1311,7 @@ var MessageTray = new Lang.Class({
this._bannerBin.y = -this._banner.actor.height;
this.actor.show();
Meta.disable_unredirect_for_display(global.display);
this._updateShowingNotification();
let [x, y, mods] = global.get_pointer();
@@ -1459,6 +1449,7 @@ var MessageTray = new Lang.Class({
this._pointerInNotification = false;
this._notificationRemoved = false;
Meta.enable_unredirect_for_display(global.display);
this._banner.actor.destroy();
this._banner = null;

View File

@@ -77,10 +77,8 @@ var FdoNotificationDaemon = new Lang.Class({
bitsPerSample, nChannels, data] = hints['image-data'];
return Shell.util_create_pixbuf_from_data(data, GdkPixbuf.Colorspace.RGB, hasAlpha,
bitsPerSample, width, height, rowStride);
} else if (hints['image-path']) {
return new Gio.FileIcon({ file: Gio.File.new_for_path(hints['image-path']) });
}
return null;
return this._iconForNotificationData(hints['image-path']);
},
_fallbackIconForNotificationData(hints) {
@@ -294,7 +292,7 @@ var FdoNotificationDaemon = new Lang.Class({
});
}
let gicon = this._iconForNotificationData(icon, hints);
let gicon = this._iconForNotificationData(icon);
let gimage = this._imageForNotificationData(hints);
// If an icon is not specified, we use 'image-data' or 'image-path' hint for an icon
@@ -660,6 +658,10 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
},
_createNotification(params) {
return new GtkNotificationDaemonNotification(this, params);
},
activateAction(actionId, target) {
this._createApp((app, error) => {
if (error == null)
@@ -686,9 +688,9 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
this._notificationPending = true;
if (this._notifications[notificationId])
this._notifications[notificationId].destroy();
this._notifications[notificationId].destroy(MessageTray.NotificationDestroyedReason.REPLACED);
let notification = new GtkNotificationDaemonNotification(this, notificationParams);
let notification = this._createNotification(notificationParams);
notification.connect('destroy', () => {
delete this._notifications[notificationId];
});

View File

@@ -118,15 +118,30 @@ var OsdWindow = new Lang.Class({
this._hideTimeoutId = 0;
this._reset();
Main.layoutManager.connect('monitors-changed',
this._relayout.bind(this));
this.actor.connect('destroy', this._onDestroy.bind(this));
this._monitorsChangedId =
Main.layoutManager.connect('monitors-changed',
this._relayout.bind(this));
let themeContext = St.ThemeContext.get_for_stage(global.stage);
themeContext.connect('notify::scale-factor',
this._relayout.bind(this));
this._scaleChangedId =
themeContext.connect('notify::scale-factor',
this._relayout.bind(this));
this._relayout();
Main.uiGroup.add_child(this.actor);
},
_onDestroy() {
if (this._monitorsChangedId)
Main.layoutManager.disconnect(this._monitorsChangedId);
this._monitorsChangedId = 0;
let themeContext = St.ThemeContext.get_for_stage(global.stage);
if (this._scaleChangedId)
themeContext.disconnect(this._scaleChangedId);
this._scaleChangedId = 0;
},
setIcon(icon) {
this._icon.gicon = icon;
},
@@ -204,8 +219,8 @@ var OsdWindow = new Lang.Class({
_reset() {
this.actor.hide();
this.setLabel(null);
this.setLevel(null);
this.setMaxLevel(null);
this.setLevel(null);
},
_relayout() {
@@ -253,8 +268,8 @@ var OsdWindowManager = new Lang.Class({
_showOsdWindow(monitorIndex, icon, label, level, maxLevel) {
this._osdWindows[monitorIndex].setIcon(icon);
this._osdWindows[monitorIndex].setLabel(label);
this._osdWindows[monitorIndex].setLevel(level);
this._osdWindows[monitorIndex].setMaxLevel(maxLevel);
this._osdWindows[monitorIndex].setLevel(level);
this._osdWindows[monitorIndex].show();
},

View File

@@ -226,7 +226,7 @@ var Overview = new Lang.Class({
// Add a clone of the panel to the overview so spacing and such is
// automatic
this._panelGhost = new St.Bin({ child: new Clutter.Clone({ source: Main.panel.actor }),
this._panelGhost = new St.Bin({ child: new Clutter.Clone({ source: Main.panel }),
reactive: false,
opacity: 0 });
this._overview.add_actor(this._panelGhost);

View File

@@ -250,7 +250,7 @@ var ThumbnailsSlider = new Lang.Class({
this.actor.request_mode = Clutter.RequestMode.WIDTH_FOR_HEIGHT;
this.actor.reactive = true;
this.actor.track_hover = true;
this.actor.add_actor(this._thumbnailsBox.actor);
this.actor.add_actor(this._thumbnailsBox);
Main.layoutManager.connect('monitors-changed', this._updateSlide.bind(this));
global.workspace_manager.connect('active-workspace-changed',
@@ -258,7 +258,7 @@ var ThumbnailsSlider = new Lang.Class({
global.workspace_manager.connect('notify::n-workspaces',
this._updateSlide.bind(this));
this.actor.connect('notify::hover', this._updateSlide.bind(this));
this._thumbnailsBox.actor.bind_property('visible', this.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
this._thumbnailsBox.bind_property('visible', this.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
},
_getAlwaysZoomOut() {

View File

@@ -86,6 +86,7 @@ function _unpremultiply(color) {
var AppMenuButton = new Lang.Class({
Name: 'AppMenuButton',
Extends: PanelMenu.Button,
Signals: {'changed': {}},
_init(panel) {
this.parent(0.0, null, true);
@@ -127,7 +128,7 @@ var AppMenuButton = new Lang.Class({
this._visible = this._gtkSettings.gtk_shell_shows_app_menu &&
!Main.overview.visible;
if (!this._visible)
this.actor.hide();
this.hide();
this._overviewHidingId = Main.overview.connect('hiding', this._sync.bind(this));
this._overviewShowingId = Main.overview.connect('showing', this._sync.bind(this));
this._showsAppMenuId = this._gtkSettings.connect('notify::gtk-shell-shows-app-menu',
@@ -149,13 +150,13 @@ var AppMenuButton = new Lang.Class({
this._sync();
},
show() {
fadeIn() {
if (this._visible)
return;
this._visible = true;
this.actor.reactive = true;
this.actor.show();
this.show();
Tweener.removeTweens(this.actor);
Tweener.addTween(this.actor,
{ opacity: 255,
@@ -163,7 +164,7 @@ var AppMenuButton = new Lang.Class({
transition: 'easeOutQuad' });
},
hide() {
fadeOut() {
if (!this._visible)
return;
@@ -175,7 +176,7 @@ var AppMenuButton = new Lang.Class({
time: Overview.ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete() {
this.actor.hide();
this.hide();
},
onCompleteScope: this });
},
@@ -314,9 +315,9 @@ var AppMenuButton = new Lang.Class({
shellShowsAppMenu &&
!Main.overview.visibleTarget);
if (visible)
this.show();
this.fadeIn();
else
this.hide();
this.fadeOut();
let isBusy = (this._targetApp != null &&
(this._targetApp.get_state() == Shell.AppState.STARTING ||
@@ -366,7 +367,7 @@ var AppMenuButton = new Lang.Class({
this._menuManager.addMenu(menu);
},
destroy() {
_onDestroy() {
if (this._appStateChangedSignalId > 0) {
let appSys = Shell.AppSystem.get_default();
appSys.disconnect(this._appStateChangedSignalId);
@@ -398,8 +399,6 @@ var AppMenuButton = new Lang.Class({
}
});
Signals.addSignalMethods(AppMenuButton.prototype);
var ActivitiesButton = new Lang.Class({
Name: 'ActivitiesButton',
Extends: PanelMenu.Button,
@@ -774,12 +773,16 @@ const PANEL_ITEM_IMPLEMENTATIONS = {
var Panel = new Lang.Class({
Name: 'Panel',
Extends: St.Widget,
_init() {
this.actor = new Shell.GenericContainer({ name: 'panel',
reactive: true });
this.actor._delegate = this;
this.actor.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
this.parent({ name: 'panel',
reactive: true });
// For compatibility with extensions that still use the
// this.actor field
this.actor = this;
this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
this._sessionStyle = null;
@@ -788,36 +791,33 @@ var Panel = new Lang.Class({
this.menuManager = new PopupMenu.PopupMenuManager(this);
this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
this.actor.add_actor(this._leftBox);
this.add_child(this._leftBox);
this._centerBox = new St.BoxLayout({ name: 'panelCenter' });
this.actor.add_actor(this._centerBox);
this.add_child(this._centerBox);
this._rightBox = new St.BoxLayout({ name: 'panelRight' });
this.actor.add_actor(this._rightBox);
this.add_child(this._rightBox);
this._leftCorner = new PanelCorner(St.Side.LEFT);
this.actor.add_actor(this._leftCorner.actor);
this.add_child(this._leftCorner.actor);
this._rightCorner = new PanelCorner(St.Side.RIGHT);
this.actor.add_actor(this._rightCorner.actor);
this.add_child(this._rightCorner.actor);
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.actor.connect('button-press-event', this._onButtonPress.bind(this));
this.actor.connect('touch-event', this._onButtonPress.bind(this));
this.actor.connect('key-press-event', this._onKeyPress.bind(this));
this.connect('button-press-event', this._onButtonPress.bind(this));
this.connect('touch-event', this._onButtonPress.bind(this));
this.connect('key-press-event', this._onKeyPress.bind(this));
Main.overview.connect('showing', () => {
this.actor.add_style_pseudo_class('overview');
this.add_style_pseudo_class('overview');
this._updateSolidStyle();
});
Main.overview.connect('hiding', () => {
this.actor.remove_style_pseudo_class('overview');
this.remove_style_pseudo_class('overview');
this._updateSolidStyle();
});
Main.layoutManager.panelBox.add(this.actor);
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'focus-top-bar-symbolic',
Main.layoutManager.panelBox.add(this);
Main.ctrlAltTabManager.addGroup(this, _("Top Bar"), 'focus-top-bar-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.TOP });
Main.sessionMode.connect('updated', this._updatePanel.bind(this));
@@ -827,7 +827,7 @@ var Panel = new Lang.Class({
global.window_group.connect('actor-removed', this._onWindowActorRemoved.bind(this));
global.window_manager.connect('switch-workspace', this._updateSolidStyle.bind(this));
global.display.connect('workareas-changed', () => { this.actor.queue_relayout(); });
global.display.connect('workareas-changed', () => { this.queue_relayout(); });
this._updatePanel();
},
@@ -847,24 +847,18 @@ var Panel = new Lang.Class({
this._updateSolidStyle();
},
_getPreferredWidth(actor, forHeight, alloc) {
vfunc_get_preferred_width(actor, forHeight) {
let primaryMonitor = Main.layoutManager.primaryMonitor;
alloc.min_size = -1;
if (primaryMonitor)
alloc.natural_size = primaryMonitor.width;
else
alloc.natural_size = -1;
return [0, primaryMonitor.width];
return [0, 0];
},
_getPreferredHeight(actor, forWidth, alloc) {
// We don't need to implement this; it's forced by the CSS
alloc.min_size = -1;
alloc.natural_size = -1;
},
vfunc_allocate(box, flags) {
this.parent(box, flags);
_allocate(actor, box, flags) {
let allocWidth = box.x2 - box.x1;
let allocHeight = box.y2 - box.y1;
@@ -876,7 +870,7 @@ var Panel = new Lang.Class({
centerWidth = centerNaturalWidth;
// get workspace area and center date entry relative to it
let monitor = Main.layoutManager.findMonitorForActor(actor);
let monitor = Main.layoutManager.findMonitorForActor(this);
let centerOffset = 0;
if (monitor) {
let workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index);
@@ -889,7 +883,7 @@ var Panel = new Lang.Class({
childBox.y1 = 0;
childBox.y2 = allocHeight;
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
if (this.get_text_direction() == Clutter.TextDirection.RTL) {
childBox.x1 = Math.max(allocWidth - Math.min(Math.floor(sideWidth),
leftNaturalWidth),
0);
@@ -909,7 +903,7 @@ var Panel = new Lang.Class({
childBox.y1 = 0;
childBox.y2 = allocHeight;
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
if (this.get_text_direction() == Clutter.TextDirection.RTL) {
childBox.x1 = 0;
childBox.x2 = Math.min(Math.floor(sideWidth),
rightNaturalWidth);
@@ -1069,7 +1063,7 @@ var Panel = new Lang.Class({
if (this._sessionStyle)
this._addStyleClassName(this._sessionStyle);
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
if (this.get_text_direction() == Clutter.TextDirection.RTL) {
this._leftCorner.setStyleParent(this._rightBox);
this._rightCorner.setStyleParent(this._leftBox);
} else {
@@ -1079,7 +1073,7 @@ var Panel = new Lang.Class({
},
_updateSolidStyle() {
if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
if (this.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
this._removeStyleClassName('solid');
return;
}
@@ -1093,12 +1087,13 @@ var Panel = new Lang.Class({
let windows = activeWorkspace.list_windows().filter(metaWindow => {
return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() &&
!metaWindow.is_hidden() &&
metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
});
/* Check if at least one window is near enough to the panel */
let [, panelTop] = this.actor.get_transformed_position();
let panelBottom = panelTop + this.actor.get_height();
let [, panelTop] = this.get_transformed_position();
let panelBottom = panelTop + this.get_height();
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let isNearEnough = windows.some(metaWindow => {
let verticalPosition = metaWindow.get_frame_rect().y;
@@ -1164,7 +1159,6 @@ var Panel = new Lang.Class({
let destroyId = indicator.connect('destroy', emitter => {
delete this.statusArea[role];
emitter.disconnect(destroyId);
container.destroy();
});
indicator.connect('menu-set', this._onMenuSet.bind(this));
this._onMenuSet(indicator);
@@ -1190,13 +1184,13 @@ var Panel = new Lang.Class({
},
_addStyleClassName(className) {
this.actor.add_style_class_name(className);
this.add_style_class_name(className);
this._rightCorner.actor.add_style_class_name(className);
this._leftCorner.actor.add_style_class_name(className);
},
_removeStyleClassName(className) {
this.actor.remove_style_class_name(className);
this.remove_style_class_name(className);
this._rightCorner.actor.remove_style_class_name(className);
this._leftCorner.actor.remove_style_class_name(className);
},

View File

@@ -15,21 +15,23 @@ const PopupMenu = imports.ui.popupMenu;
var ButtonBox = new Lang.Class({
Name: 'ButtonBox',
Extends: St.Widget,
_init(params) {
params = Params.parse(params, { style_class: 'panel-button' }, true);
this.actor = new Shell.GenericContainer(params);
this.actor._delegate = this;
this.parent(params);
this.actor = this;
this._delegate = this;
this.container = new St.Bin({ y_fill: true,
x_fill: true,
child: this.actor });
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.connect('style-changed', this._onStyleChanged.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
this.actor.connect('style-changed', this._onStyleChanged.bind(this));
this._minHPadding = this._natHPadding = 0.0;
},
@@ -40,31 +42,34 @@ var ButtonBox = new Lang.Class({
this._natHPadding = themeNode.get_length('-natural-hpadding');
},
_getPreferredWidth(actor, forHeight, alloc) {
let child = actor.get_first_child();
vfunc_get_preferred_width(forHeight) {
let child = this.get_first_child();
let minimumSize, naturalSize;
if (child) {
[alloc.min_size, alloc.natural_size] = child.get_preferred_width(-1);
} else {
alloc.min_size = alloc.natural_size = 0;
}
if (child)
[minimumSize, naturalSize] = child.get_preferred_width(-1);
else
minimumSize = naturalSize = 0;
alloc.min_size += 2 * this._minHPadding;
alloc.natural_size += 2 * this._natHPadding;
minimumSize += 2 * this._minHPadding;
naturalSize += 2 * this._natHPadding;
return [minimumSize, naturalSize];
},
_getPreferredHeight(actor, forWidth, alloc) {
let child = actor.get_first_child();
vfunc_get_preferred_height(forWidth) {
let child = this.get_first_child();
if (child) {
[alloc.min_size, alloc.natural_size] = child.get_preferred_height(-1);
} else {
alloc.min_size = alloc.natural_size = 0;
}
if (child)
return child.get_preferred_height(-1);
return [0, 0];
},
_allocate(actor, box, flags) {
let child = actor.get_first_child();
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let child = this.get_first_child();
if (!child)
return;
@@ -87,11 +92,17 @@ var ButtonBox = new Lang.Class({
child.allocate(childBox, flags);
},
_onDestroy() {
this.container.child = null;
this.container.destroy();
},
});
var Button = new Lang.Class({
Name: 'PanelMenuButton',
Extends: ButtonBox,
Signals: {'menu-set': {} },
_init(menuAlignment, nameText, dontCreateMenu) {
this.parent({ reactive: true,
@@ -100,8 +111,8 @@ var Button = new Lang.Class({
accessible_name: nameText ? nameText : "",
accessible_role: Atk.Role.MENU });
this.actor.connect('event', this._onEvent.bind(this));
this.actor.connect('notify::visible', this._onVisibilityChanged.bind(this));
this.connect('event', this._onEvent.bind(this));
this.connect('notify::visible', this._onVisibilityChanged.bind(this));
if (dontCreateMenu)
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
@@ -110,9 +121,9 @@ var Button = new Lang.Class({
},
setSensitive(sensitive) {
this.actor.reactive = sensitive;
this.actor.can_focus = sensitive;
this.actor.track_hover = sensitive;
this.reactive = sensitive;
this.can_focus = sensitive;
this.track_hover = sensitive;
},
setMenu(menu) {
@@ -184,17 +195,13 @@ var Button = new Lang.Class({
this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
},
destroy() {
this.actor._delegate = null;
_onDestroy() {
this.parent();
if (this.menu)
this.menu.destroy();
this.actor.destroy();
this.emit('destroy');
}
});
Signals.addSignalMethods(Button.prototype);
/* SystemIndicator:
*

View File

@@ -143,9 +143,10 @@ var PopupBaseMenuItem = new Lang.Class({
_onKeyPressEvent(actor, event) {
let state = event.get_state();
// if user has a modifier down (except capslock)
// if user has a modifier down (except capslock and numlock)
// then don't handle the key press here
state &= ~Clutter.ModifierType.LOCK_MASK;
state &= ~Clutter.ModifierType.MOD2_MASK;
state &= Clutter.ModifierType.MODIFIER_MASK;
if (state)
@@ -782,7 +783,7 @@ var PopupMenu = new Lang.Class({
{ x_fill: true,
y_fill: true,
x_align: St.Align.START });
this.actor = this._boxPointer.actor;
this.actor = this._boxPointer;
this.actor._delegate = this;
this.actor.style_class = 'popup-menu-boxpointer';
@@ -873,7 +874,7 @@ var PopupMenu = new Lang.Class({
this.isOpen = true;
this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment);
this._boxPointer.show(animate);
this._boxPointer.open(animate);
this.actor.raise_top();
@@ -885,7 +886,7 @@ var PopupMenu = new Lang.Class({
this._activeMenuItem.setActive(false);
if (this._boxPointer.actor.visible) {
this._boxPointer.hide(animate, () => {
this._boxPointer.close(animate, () => {
this.emit('menu-closed');
});
}

View File

@@ -150,7 +150,7 @@ var NotificationsBox = new Lang.Class({
_makeNotificationSource(source, box) {
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
box.add(sourceActor.actor, { y_fill: true });
box.add(sourceActor, { y_fill: true });
let textBox = new St.BoxLayout({ vertical: true });
box.add(textBox, { y_fill: false, y_align: St.Align.START });
@@ -172,7 +172,7 @@ var NotificationsBox = new Lang.Class({
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
let sourceBin = new St.Bin({ y_align: St.Align.START,
x_align: St.Align.START,
child: sourceActor.actor });
child: sourceActor });
box.add(sourceBin);
let textBox = new St.BoxLayout({ vertical: true });

View File

@@ -147,7 +147,7 @@ var GridSearchResult = new Lang.Class({
this.icon = new IconGrid.BaseIcon(this.metaInfo['name'],
{ createIcon: this.metaInfo['createIcon'] });
let content = new St.Bin({ child: this.icon.actor });
let content = new St.Bin({ child: this.icon });
this.actor.set_child(content);
this.actor.label_actor = this.icon.label;
}
@@ -363,8 +363,9 @@ var GridSearchResults = new Lang.Class({
this._grid = new IconGrid.IconGrid({ rowLimit: MAX_GRID_SEARCH_RESULTS_ROWS,
xAlign: St.Align.START });
this._bin = new St.Bin({ x_align: St.Align.MIDDLE });
this._bin.set_child(this._grid.actor);
this._bin.set_child(this._grid);
this._resultDisplayBin.set_child(this._bin);
},

View File

@@ -101,9 +101,20 @@ var GnomeShell = new Lang.Class({
Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel);
},
FocusApp(id) {
FocusAppAsync(params, invocation) {
let [id] = params;
let appSys = Shell.AppSystem.get_default();
if (appSys.lookup_app(id) == null) {
invocation.return_error_literal(
Gio.DBusError,
Gio.DBusError.FILE_NOT_FOUND,
`No application with ID ${id}`);
return;
}
this.ShowApplications();
Main.overview.viewSelector.appDisplay.selectApp(id);
invocation.return_value(null);
},
ShowApplications() {

View File

@@ -360,11 +360,14 @@ var InputSourceManager = new Lang.Class({
this._settings.connect('per-window-changed', this._sourcesPerWindowChanged.bind(this));
this._sourcesPerWindowChanged();
this._disableIBus = false;
this._reloading = false;
},
reload() {
this._reloading = true;
this._keyboardManager.setKeyboardOptions(this._settings.keyboardOptions);
this._inputSourcesChanged();
this._reloading = false;
},
_ibusReadyCallback(im, ready) {
@@ -414,7 +417,7 @@ var InputSourceManager = new Lang.Class({
let popup = new InputSourcePopup(this._mruSources, this._keybindingAction, this._keybindingActionBackward);
if (!popup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
popup.destroy();
popup.fadeAndDestroy();
},
_keyboardOptionsChanged() {
@@ -458,7 +461,15 @@ var InputSourceManager = new Lang.Class({
},
activateInputSource(is, interactive) {
KeyboardManager.holdKeyboard();
// The focus changes during holdKeyboard/releaseKeyboard may trick
// the client into hiding UI containing the currently focused entry.
// So holdKeyboard/releaseKeyboard are not called when
// 'set-content-type' signal is received.
// E.g. Focusing on a password entry in a popup in Xorg Firefox
// will emit 'set-content-type' signal.
// https://gitlab.gnome.org/GNOME/gnome-shell/issues/391
if (!this._reloading)
KeyboardManager.holdKeyboard();
this._keyboardManager.apply(is.xkbId);
// All the "xkb:..." IBus engines simply "echo" back symbols,
@@ -473,7 +484,10 @@ var InputSourceManager = new Lang.Class({
else
engine = 'xkb:us::eng';
this._ibusManager.setEngine(engine, KeyboardManager.releaseKeyboard);
if (!this._reloading)
this._ibusManager.setEngine(engine, KeyboardManager.releaseKeyboard);
else
this._ibusManager.setEngine(engine);
this._currentInputSourceChanged(is);
if (interactive)
@@ -773,6 +787,44 @@ function getInputSourceManager() {
return _inputSourceManager;
}
var InputSourceIndicatorContainer = new Lang.Class({
Name: 'InputSourceIndicatorContainer',
Extends: St.Widget,
vfunc_get_preferred_width(forHeight) {
// Here, and in vfunc_get_preferred_height, we need to query
// for the height of all children, but we ignore the results
// for those we don't actually display.
return this.get_children().reduce((maxWidth, child) => {
let width = child.get_preferred_width(forHeight);
return [Math.max(maxWidth[0], width[0]),
Math.max(maxWidth[1], width[1])];
}, [0, 0]);
},
vfunc_get_preferred_height(forWidth) {
return this.get_children().reduce((maxHeight, child) => {
let height = child.get_preferred_height(forWidth);
return [Math.max(maxHeight[0], height[0]),
Math.max(maxHeight[1], height[1])];
}, [0, 0]);
},
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
// translate box to (0, 0)
box.x2 -= box.x1;
box.x1 = 0;
box.y2 -= box.y1;
box.y1 = 0;
this.get_children().forEach(c => {
c.allocate_align_fill(box, 0.5, 0.5, false, false, flags);
});
}
});
var InputSourceIndicator = new Lang.Class({
Name: 'InputSourceIndicator',
Extends: PanelMenu.Button,
@@ -783,10 +835,7 @@ var InputSourceIndicator = new Lang.Class({
this._menuItems = {};
this._indicatorLabels = {};
this._container = new Shell.GenericContainer();
this._container.connect('get-preferred-width', this._containerGetPreferredWidth.bind(this));
this._container.connect('get-preferred-height', this._containerGetPreferredHeight.bind(this));
this._container.connect('allocate', this._containerAllocate.bind(this));
this._container = new InputSourceIndicatorContainer();
this._hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
this._hbox.add_child(this._container);
@@ -1021,48 +1070,4 @@ var InputSourceIndicator = new Lang.Class({
Util.spawn(['gkbd-keyboard-display', '-l', description]);
},
_containerGetPreferredWidth(container, for_height, alloc) {
// Here, and in _containerGetPreferredHeight, we need to query
// for the height of all children, but we ignore the results
// for those we don't actually display.
let max_min_width = 0, max_natural_width = 0;
for (let i in this._inputSourceManager.inputSources) {
let label = this._indicatorLabels[i];
let [min_width, natural_width] = label.get_preferred_width(for_height);
max_min_width = Math.max(max_min_width, min_width);
max_natural_width = Math.max(max_natural_width, natural_width);
}
alloc.min_size = max_min_width;
alloc.natural_size = max_natural_width;
},
_containerGetPreferredHeight(container, for_width, alloc) {
let max_min_height = 0, max_natural_height = 0;
for (let i in this._inputSourceManager.inputSources) {
let label = this._indicatorLabels[i];
let [min_height, natural_height] = label.get_preferred_height(for_width);
max_min_height = Math.max(max_min_height, min_height);
max_natural_height = Math.max(max_natural_height, natural_height);
}
alloc.min_size = max_min_height;
alloc.natural_size = max_natural_height;
},
_containerAllocate(container, box, flags) {
// translate box to (0, 0)
box.x2 -= box.x1;
box.x1 = 0;
box.y2 -= box.y1;
box.y1 = 0;
for (let i in this._inputSourceManager.inputSources) {
let label = this._indicatorLabels[i];
label.allocate_align_fill(box, 0.5, 0.5, false, false, flags);
}
}
});

View File

@@ -70,7 +70,9 @@ var Indicator = new Lang.Class({
seconds = this._proxy.TimeToFull;
else if (this._proxy.State == UPower.DeviceState.DISCHARGING)
seconds = this._proxy.TimeToEmpty;
// state is one of PENDING_CHARGING, PENDING_DISCHARGING
else if (this._proxy.State == UPower.DeviceState.PENDING_CHARGE)
return _("Not Charging");
// state is PENDING_DISCHARGE
else
return _("Estimating…");

View File

@@ -58,6 +58,9 @@ var AltSwitcher = new Lang.Class({
childToShow = this._standard;
} else if (this._alternate.visible) {
childToShow = this._alternate;
} else {
this.actor.hide();
return;
}
let childShown = this.actor.get_child();
@@ -79,7 +82,7 @@ var AltSwitcher = new Lang.Class({
global.sync_pointer();
}
this.actor.visible = (childToShow != null);
this.actor.show();
},
_onDestroy() {

View File

@@ -195,7 +195,7 @@ var AuthRobot = new Lang.Class({
if (this._enrolling)
return;
this.enrolling = true;
this._enrolling = true;
GLib.idle_add(GLib.PRIORITY_DEFAULT,
this._enrollDevicesIdle.bind(this));
},

View File

@@ -2,6 +2,7 @@
const Clutter = imports.gi.Clutter;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
@@ -39,23 +40,22 @@ function primaryModifier(mask) {
var SwitcherPopup = new Lang.Class({
Name: 'SwitcherPopup',
Extends: St.Widget,
Abstract: true,
_init(items) {
this.parent({ style_class: 'switcher-popup',
reactive: true,
visible: false });
this._switcherList = null;
this._items = items || [];
this._selectedIndex = 0;
this.actor = new Shell.GenericContainer({ style_class: 'switcher-popup',
reactive: true,
visible: false });
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.actor.connect('destroy', this._onDestroy.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
Main.uiGroup.add_actor(this.actor);
Main.uiGroup.add_actor(this);
this._haveModal = false;
this._modifierMask = 0;
@@ -64,42 +64,35 @@ var SwitcherPopup = new Lang.Class({
this._initialDelayTimeoutId = 0;
this._noModsTimeoutId = 0;
this.add_constraint(new Clutter.BindConstraint({
source: global.stage,
coordinate: Clutter.BindCoordinate.ALL,
}));
// Initially disable hover so we ignore the enter-event if
// the switcher appears underneath the current pointer location
this._disableHover();
},
_getPreferredWidth(actor, forHeight, alloc) {
let primary = Main.layoutManager.primaryMonitor;
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
alloc.min_size = primary.width;
alloc.natural_size = primary.width;
},
_getPreferredHeight(actor, forWidth, alloc) {
let primary = Main.layoutManager.primaryMonitor;
alloc.min_size = primary.height;
alloc.natural_size = primary.height;
},
_allocate(actor, box, flags) {
let childBox = new Clutter.ActorBox();
let primary = Main.layoutManager.primaryMonitor;
let leftPadding = this.actor.get_theme_node().get_padding(St.Side.LEFT);
let rightPadding = this.actor.get_theme_node().get_padding(St.Side.RIGHT);
let leftPadding = this.get_theme_node().get_padding(St.Side.LEFT);
let rightPadding = this.get_theme_node().get_padding(St.Side.RIGHT);
let hPadding = leftPadding + rightPadding;
// Allocate the switcherList
// We select a size based on an icon size that does not overflow the screen
let [childMinHeight, childNaturalHeight] = this._switcherList.actor.get_preferred_height(primary.width - hPadding);
let [childMinWidth, childNaturalWidth] = this._switcherList.actor.get_preferred_width(childNaturalHeight);
let [childMinHeight, childNaturalHeight] = this._switcherList.get_preferred_height(primary.width - hPadding);
let [childMinWidth, childNaturalWidth] = this._switcherList.get_preferred_width(childNaturalHeight);
childBox.x1 = Math.max(primary.x + leftPadding, primary.x + Math.floor((primary.width - childNaturalWidth) / 2));
childBox.x2 = Math.min(primary.x + primary.width - rightPadding, childBox.x1 + childNaturalWidth);
childBox.y1 = primary.y + Math.floor((primary.height - childNaturalHeight) / 2);
childBox.y2 = childBox.y1 + childNaturalHeight;
this._switcherList.actor.allocate(childBox, flags);
this._switcherList.allocate(childBox, flags);
},
_initialSelection(backward, binding) {
@@ -115,31 +108,30 @@ var SwitcherPopup = new Lang.Class({
if (this._items.length == 0)
return false;
if (!Main.pushModal(this.actor)) {
if (!Main.pushModal(this)) {
// Probably someone else has a pointer grab, try again with keyboard only
if (!Main.pushModal(this.actor, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED })) {
if (!Main.pushModal(this, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED }))
return false;
}
}
this._haveModal = true;
this._modifierMask = primaryModifier(mask);
this.actor.connect('key-press-event', this._keyPressEvent.bind(this));
this.actor.connect('key-release-event', this._keyReleaseEvent.bind(this));
this.connect('key-press-event', this._keyPressEvent.bind(this));
this.connect('key-release-event', this._keyReleaseEvent.bind(this));
this.actor.connect('button-press-event', this._clickedOutside.bind(this));
this.actor.connect('scroll-event', this._scrollEvent.bind(this));
this.connect('button-press-event', this._clickedOutside.bind(this));
this.connect('scroll-event', this._scrollEvent.bind(this));
this.actor.add_actor(this._switcherList.actor);
this.add_actor(this._switcherList);
this._switcherList.connect('item-activated', this._itemActivated.bind(this));
this._switcherList.connect('item-entered', this._itemEntered.bind(this));
this._switcherList.connect('item-removed', this._itemRemoved.bind(this));
// Need to force an allocation so we can figure out whether we
// need to scroll when selecting
this.actor.opacity = 0;
this.actor.show();
this.actor.get_allocation_box();
this.opacity = 0;
this.visible = true;
this.get_allocation_box();
this._initialSelection(backward, binding);
@@ -163,7 +155,7 @@ var SwitcherPopup = new Lang.Class({
this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
() => {
Main.osdWindowManager.hideAll();
this.actor.opacity = 255;
this.opacity = 255;
this._initialDelayTimeoutId = 0;
return GLib.SOURCE_REMOVE;
});
@@ -195,7 +187,7 @@ var SwitcherPopup = new Lang.Class({
// Note: pressing one of the below keys will destroy the popup only if
// that key is not used by the active popup's keyboard shortcut
if (keysym == Clutter.Escape || keysym == Clutter.Tab)
this.destroy();
this.fadeAndDestroy();
return Clutter.EVENT_STOP;
},
@@ -215,7 +207,7 @@ var SwitcherPopup = new Lang.Class({
},
_clickedOutside(actor, event) {
this.destroy();
this.fadeAndDestroy();
return Clutter.EVENT_PROPAGATE;
},
@@ -255,7 +247,7 @@ var SwitcherPopup = new Lang.Class({
let newIndex = Math.min(n, this._items.length - 1);
this._select(newIndex);
} else {
this.actor.destroy();
this.fadeAndDestroy();
}
},
@@ -293,28 +285,29 @@ var SwitcherPopup = new Lang.Class({
_popModal() {
if (this._haveModal) {
Main.popModal(this.actor);
Main.popModal(this);
this._haveModal = false;
}
},
destroy() {
fadeAndDestroy() {
this._popModal();
if (this.actor.visible) {
Tweener.addTween(this.actor,
if (this.visible) {
Tweener.addTween(this,
{ opacity: 0,
time: POPUP_FADE_OUT_TIME,
transition: 'easeOutQuad',
onComplete: () => {
this.actor.destroy();
this.destroy();
}
});
} else
this.actor.destroy();
} else {
this.destroy();
}
},
_finish(timestamp) {
this.destroy();
this.fadeAndDestroy();
},
_onDestroy() {
@@ -334,35 +327,53 @@ var SwitcherPopup = new Lang.Class({
}
});
var SwitcherButton = new Lang.Class({
Name: 'SwitcherButton',
Extends: St.Button,
_init(square) {
this.parent({ style_class: 'item-box',
reactive: true });
this._square = square;
},
vfunc_get_preferred_width(forHeight) {
if (this._square)
return this.get_preferred_height(-1);
else
return this.parent(forHeight);
}
});
var SwitcherList = new Lang.Class({
Name: 'SwitcherList',
Extends: St.Widget,
Signals: { 'item-activated': { param_types: [GObject.TYPE_INT] },
'item-entered': { param_types: [GObject.TYPE_INT] },
'item-removed': { param_types: [GObject.TYPE_INT] } },
_init(squareItems) {
this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' });
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocateTop.bind(this));
this.parent({ style_class: 'switcher-list' });
this._list = new St.BoxLayout({ style_class: 'switcher-list-item-container',
vertical: false,
x_expand: true,
y_expand: true });
let layoutManager = this._list.get_layout_manager();
// Here we use a GenericContainer so that we can force all the
// children to have the same width.
this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' });
this._list.spacing = 0;
this._list.connect('style-changed', () => {
this._list.spacing = this._list.get_theme_node().get_length('spacing');
});
this._list.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this._list.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this._list.connect('allocate', this._allocate.bind(this));
this._scrollView = new St.ScrollView({ style_class: 'hfade',
enable_mouse_scrolling: false });
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
let scrollBox = new St.BoxLayout();
scrollBox.add_actor(this._list);
this._scrollView.add_actor(scrollBox);
this.actor.add_actor(this._scrollView);
this._scrollView.add_actor(this._list);
this.add_actor(this._scrollView);
// Those arrows indicate whether scrolling in one direction is possible
this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
@@ -376,50 +387,20 @@ var SwitcherList = new Lang.Class({
drawArrow(this._rightArrow, St.Side.RIGHT);
});
this.actor.add_actor(this._leftArrow);
this.actor.add_actor(this._rightArrow);
this.add_actor(this._leftArrow);
this.add_actor(this._rightArrow);
this._items = [];
this._highlighted = -1;
this._squareItems = squareItems;
this._minSize = 0;
this._scrollableRight = true;
this._scrollableLeft = false;
},
_allocateTop(actor, box, flags) {
let leftPadding = this.actor.get_theme_node().get_padding(St.Side.LEFT);
let rightPadding = this.actor.get_theme_node().get_padding(St.Side.RIGHT);
let childBox = new Clutter.ActorBox();
let scrollable = this._minSize > box.x2 - box.x1;
box.y1 -= this.actor.get_theme_node().get_padding(St.Side.TOP);
box.y2 += this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
this._scrollView.allocate(box, flags);
let arrowWidth = Math.floor(leftPadding / 3);
let arrowHeight = arrowWidth * 2;
childBox.x1 = leftPadding / 2;
childBox.y1 = this.actor.height / 2 - arrowWidth;
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._leftArrow.allocate(childBox, flags);
this._leftArrow.opacity = (this._scrollableLeft && scrollable) ? 255 : 0;
arrowWidth = Math.floor(rightPadding / 3);
arrowHeight = arrowWidth * 2;
childBox.x1 = this.actor.width - arrowWidth - rightPadding / 2;
childBox.y1 = this.actor.height / 2 - arrowWidth;
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._rightArrow.allocate(childBox, flags);
this._rightArrow.opacity = (this._scrollableRight && scrollable) ? 255 : 0;
layoutManager.homogeneous = squareItems;
},
addItem(item, label) {
let bbox = new St.Button({ style_class: 'item-box',
reactive: true });
let bbox = new SwitcherButton(this._squareItems);
bbox.set_child(item);
this._list.add_actor(bbox);
@@ -472,8 +453,8 @@ var SwitcherList = new Lang.Class({
let adjustment = this._scrollView.hscroll.adjustment;
let [value, lower, upper, stepIncrement, pageIncrement, pageSize] = adjustment.get_values();
let [absItemX, absItemY] = this._items[index].get_transformed_position();
let [result, posX, posY] = this.actor.transform_stage_point(absItemX, 0);
let [containerWidth, containerHeight] = this.actor.get_transformed_size();
let [result, posX, posY] = this.transform_stage_point(absItemX, 0);
let [containerWidth, containerHeight] = this.get_transformed_size();
if (posX + this._items[index].get_width() > containerWidth)
this._scrollToRight();
else if (this._items[index].allocation.x1 - value < 0)
@@ -500,7 +481,7 @@ var SwitcherList = new Lang.Class({
onComplete: () => {
if (this._highlighted == 0)
this._scrollableLeft = false;
this.actor.queue_relayout();
this.queue_relayout();
}
});
},
@@ -524,7 +505,7 @@ var SwitcherList = new Lang.Class({
onComplete: () => {
if (this._highlighted == this._items.length - 1)
this._scrollableRight = false;
this.actor.queue_relayout();
this.queue_relayout();
}
});
},
@@ -556,16 +537,15 @@ var SwitcherList = new Lang.Class({
return [maxChildMin, maxChildNat];
},
_getPreferredWidth(actor, forHeight, alloc) {
let [maxChildMin, maxChildNat] = this._maxChildWidth(forHeight);
vfunc_get_preferred_width(forHeight) {
let themeNode = this.get_theme_node();
let [maxChildMin, ] = this._maxChildWidth(forHeight);
let [minListWidth, ] = this._list.get_preferred_width(forHeight);
let totalSpacing = Math.max(this._list.spacing * (this._items.length - 1), 0);
alloc.min_size = this._items.length * maxChildMin + totalSpacing;
alloc.natural_size = alloc.min_size;
this._minSize = alloc.min_size;
return themeNode.adjust_preferred_width(maxChildMin, minListWidth);
},
_getPreferredHeight(actor, forWidth, alloc) {
vfunc_get_preferred_height(forWidth) {
let maxChildMin = 0;
let maxChildNat = 0;
@@ -581,44 +561,46 @@ var SwitcherList = new Lang.Class({
maxChildNat = maxChildMin;
}
alloc.min_size = maxChildMin;
alloc.natural_size = maxChildNat;
let themeNode = this.get_theme_node();
return themeNode.adjust_preferred_height(maxChildMin, maxChildNat);
},
_allocate(actor, box, flags) {
let childHeight = box.y2 - box.y1;
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let [maxChildMin, maxChildNat] = this._maxChildWidth(childHeight);
let totalSpacing = Math.max(this._list.spacing * (this._items.length - 1), 0);
let contentBox = this.get_theme_node().get_content_box(box);
let width = contentBox.x2 - contentBox.x1;
let height = contentBox.y2 - contentBox.y1;
let childWidth = Math.floor(Math.max(0, box.x2 - box.x1 - totalSpacing) / this._items.length);
let leftPadding = this.get_theme_node().get_padding(St.Side.LEFT);
let rightPadding = this.get_theme_node().get_padding(St.Side.RIGHT);
let [, natScrollViewWidth] = this._scrollView.get_preferred_width(height);
let x = 0;
let children = this._list.get_children();
let childBox = new Clutter.ActorBox();
let scrollable = natScrollViewWidth > width;
let primary = Main.layoutManager.primaryMonitor;
let parentRightPadding = this.actor.get_parent().get_theme_node().get_padding(St.Side.RIGHT);
this._scrollView.allocate(contentBox, flags);
for (let i = 0; i < children.length; i++) {
if (this._items.indexOf(children[i]) != -1) {
let [childMin, childNat] = children[i].get_preferred_height(childWidth);
let vSpacing = (childHeight - childNat) / 2;
childBox.x1 = x;
childBox.y1 = vSpacing;
childBox.x2 = x + childWidth;
childBox.y2 = childBox.y1 + childNat;
children[i].allocate(childBox, flags);
let arrowWidth = Math.floor(leftPadding / 3);
let arrowHeight = arrowWidth * 2;
childBox.x1 = leftPadding / 2;
childBox.y1 = this.height / 2 - arrowWidth;
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._leftArrow.allocate(childBox, flags);
this._leftArrow.opacity = (this._scrollableLeft && scrollable) ? 255 : 0;
x += this._list.spacing + childWidth;
} else {
// Something else, eg, AppSwitcher's arrows;
// we don't allocate it.
}
}
arrowWidth = Math.floor(rightPadding / 3);
arrowHeight = arrowWidth * 2;
childBox.x1 = this.width - arrowWidth - rightPadding / 2;
childBox.y1 = this.height / 2 - arrowWidth;
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._rightArrow.allocate(childBox, flags);
this._rightArrow.opacity = (this._scrollableRight && scrollable) ? 255 : 0;
}
});
Signals.addSignalMethods(SwitcherList.prototype);
function drawArrow(area, side) {
let themeNode = area.get_theme_node();

View File

@@ -13,6 +13,8 @@ var WindowAttentionHandler = new Lang.Class({
this._tracker = Shell.WindowTracker.get_default();
this._windowDemandsAttentionId = global.display.connect('window-demands-attention',
this._onWindowDemandsAttention.bind(this));
this._windowMarkedUrgentId = global.display.connect('window-marked-urgent',
this._onWindowDemandsAttention.bind(this));
},
_getTitleAndBanner(app, window) {
@@ -66,7 +68,9 @@ var Source = new Lang.Class({
this.signalIDs = [];
this.signalIDs.push(this._window.connect('notify::demands-attention',
() => { this.destroy(); }));
this._sync.bind(this)));
this.signalIDs.push(this._window.connect('notify::urgent',
this._sync.bind(this)));
this.signalIDs.push(this._window.connect('focus',
() => { this.destroy(); }));
this.signalIDs.push(this._window.connect('unmanaged',
@@ -75,6 +79,12 @@ var Source = new Lang.Class({
this.connect('destroy', this._onDestroy.bind(this));
},
_sync() {
if (this._window.demands_attention || this._window.urgent)
return;
this.destroy();
},
_onDestroy() {
for(let i = 0; i < this.signalIDs.length; i++) {
this._window.disconnect(this.signalIDs[i]);

View File

@@ -478,6 +478,7 @@ var TouchpadWorkspaceSwitchAction = new Lang.Class({
this._dx = 0;
this._dy = 0;
actor.connect('captured-event', this._handleEvent.bind(this));
this._touchpadSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.peripherals.touchpad'});
},
_checkActivated() {
@@ -515,7 +516,11 @@ var TouchpadWorkspaceSwitchAction = new Lang.Class({
// Scale deltas up a bit to make it feel snappier
this._dx += dx * 2;
this._dy += dy * 2;
if(!(this._touchpadSettings.get_boolean('natural-scroll')))
this._dy -= dy * 2;
else
this._dy += dy * 2;
this.emit('motion', this._dx, this._dy);
} else {
if ((event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END && ! this._checkActivated()) ||
@@ -1796,11 +1801,11 @@ var WindowManager = new Lang.Class({
if (direction == Meta.MotionDirection.UP ||
direction == Meta.MotionDirection.UP_LEFT ||
direction == Meta.MotionDirection.UP_RIGHT)
yDest = -global.screen_height + Main.panel.actor.height;
yDest = -global.screen_height + Main.panel.height;
else if (direction == Meta.MotionDirection.DOWN ||
direction == Meta.MotionDirection.DOWN_LEFT ||
direction == Meta.MotionDirection.DOWN_RIGHT)
yDest = global.screen_height - Main.panel.actor.height;
yDest = global.screen_height - Main.panel.height;
if (direction == Meta.MotionDirection.LEFT ||
direction == Meta.MotionDirection.UP_LEFT ||

View File

@@ -465,13 +465,15 @@ var WindowOverlay = new Lang.Class({
title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
windowClone.actor.label_actor = title;
this._maxTitleWidth = -1;
this._updateCaptionId = metaWindow.connect('notify::title', w => {
this.title.text = w.title;
this.title.text = this._getCaption();
this.relayout(false);
});
let button = new St.Button({ style_class: 'window-close' });
button.add_actor(new St.Icon({ icon_name: 'window-close-symbolic' }));
button._overlap = 0;
this._idleToggleCloseId = 0;
@@ -528,6 +530,13 @@ var WindowOverlay = new Lang.Class({
Math.max(this.borderSize, this.closeButton.width - this.closeButton._overlap)];
},
setMaxChromeWidth(max) {
if (this._maxTitleWidth == max)
return;
this._maxTitleWidth = max;
},
relayout(animate) {
let button = this.closeButton;
let title = this.title;
@@ -554,13 +563,26 @@ var WindowOverlay = new Lang.Class({
else
button.set_position(Math.floor(buttonX), Math.floor(buttonY));
let titleX = cloneX + (cloneWidth - title.width) / 2;
// Clutter.Actor.get_preferred_width() will return the fixed width if
// one is set, so we need to reset the width by calling set_width(-1),
// to forward the call down to StLabel.
// We also need to save and restore the current width, otherwise the
// animation starts from the wrong point.
let prevTitleWidth = title.width;
title.set_width(-1);
let [titleMinWidth, titleNatWidth] = title.get_preferred_width(-1);
let titleWidth = Math.max(titleMinWidth,
Math.min(titleNatWidth, this._maxTitleWidth));
title.width = prevTitleWidth;
let titleX = cloneX + (cloneWidth - titleWidth) / 2;
let titleY = cloneY + cloneHeight - (title.height - this.borderSize) / 2;
if (animate) {
this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY), title.width);
this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY), titleWidth);
} else {
title.width = title.width;
title.width = titleWidth;
title.set_position(Math.floor(titleX), Math.floor(titleY));
}
@@ -1306,6 +1328,12 @@ var Workspace = new Lang.Class({
let cloneHeight = clone.actor.height * scale;
clone.slot = [x, y, cloneWidth, cloneHeight];
let cloneCenter = x + cloneWidth / 2;
let maxChromeWidth = 2 * Math.min(
cloneCenter - area.x,
area.x + area.width - cloneCenter);
overlay.setMaxChromeWidth(Math.round(maxChromeWidth));
if (overlay && (initialPositioning || !clone.positioned))
overlay.hide();

View File

@@ -15,59 +15,33 @@ const Tweener = imports.ui.tweener;
var ANIMATION_TIME = 0.1;
var DISPLAY_TIMEOUT = 600;
var WorkspaceSwitcherPopup = new Lang.Class({
Name: 'WorkspaceSwitcherPopup',
var WorkspaceSwitcherPopupList = new Lang.Class({
Name: 'WorkspaceSwitcherPopupList',
Extends: St.Widget,
_init() {
this.actor = new St.Widget({ x: 0,
y: 0,
width: global.screen_width,
height: global.screen_height,
style_class: 'workspace-switcher-group' });
Main.uiGroup.add_actor(this.actor);
this.parent({ style_class: 'workspace-switcher' });
this._container = new St.BoxLayout({ style_class: 'workspace-switcher-container' });
this._list = new Shell.GenericContainer({ style_class: 'workspace-switcher' });
this._itemSpacing = 0;
this._childHeight = 0;
this._childWidth = 0;
this._timeoutId = 0;
this._list.connect('style-changed', () => {
this._itemSpacing = this._list.get_theme_node().get_length('spacing');
this.connect('style-changed', () => {
this._itemSpacing = this.get_theme_node().get_length('spacing');
});
this._list.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this._list.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this._list.connect('allocate', this._allocate.bind(this));
this._container.add(this._list);
this.actor.add_actor(this._container);
this._redisplay();
this.actor.hide();
let workspaceManager = global.workspace_manager;
this._workspaceManagerSignals = [];
this._workspaceManagerSignals.push(workspaceManager.connect('workspace-added',
this._redisplay.bind(this)));
this._workspaceManagerSignals.push(workspaceManager.connect('workspace-removed',
this._redisplay.bind(this)));
},
_getPreferredHeight(actor, forWidth, alloc) {
let children = this._list.get_children();
vfunc_get_preferred_height(forWidth) {
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
let themeNode = this.get_theme_node();
let availHeight = workArea.height;
availHeight -= this.actor.get_theme_node().get_vertical_padding();
availHeight -= this._container.get_theme_node().get_vertical_padding();
availHeight -= this._list.get_theme_node().get_vertical_padding();
availHeight -= themeNode.get_vertical_padding();
let height = 0;
for (let i = 0; i < children.length; i++) {
let [childMinHeight, childNaturalHeight] = children[i].get_preferred_height(-1);
let [childMinWidth, childNaturalWidth] = children[i].get_preferred_width(childNaturalHeight);
for (let child of this.get_children()) {
let [childMinHeight, childNaturalHeight] = child.get_preferred_height(-1);
let [childMinWidth, childNaturalWidth] = child.get_preferred_width(childNaturalHeight);
height += childNaturalHeight * workArea.width / workArea.height;
}
@@ -78,34 +52,74 @@ var WorkspaceSwitcherPopup = new Lang.Class({
this._childHeight = (height - spacing) / workspaceManager.n_workspaces;
alloc.min_size = height;
alloc.natural_size = height;
return themeNode.adjust_preferred_height(height, height);
},
_getPreferredWidth(actor, forHeight, alloc) {
vfunc_get_preferred_width(forHeight) {
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
this._childWidth = Math.round(this._childHeight * workArea.width / workArea.height);
alloc.min_size = this._childWidth;
alloc.natural_size = this._childWidth;
return [this._childWidth, this._childWidth];
},
_allocate(actor, box, flags) {
let children = this._list.get_children();
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let themeNode = this.get_theme_node();
box = themeNode.get_content_box(box);
let childBox = new Clutter.ActorBox();
let y = box.y1;
let prevChildBoxY2 = box.y1 - this._itemSpacing;
for (let i = 0; i < children.length; i++) {
for (let child of this.get_children()) {
childBox.x1 = box.x1;
childBox.x2 = box.x1 + this._childWidth;
childBox.y1 = prevChildBoxY2 + this._itemSpacing;
childBox.y2 = Math.round(y + this._childHeight);
y += this._childHeight + this._itemSpacing;
prevChildBoxY2 = childBox.y2;
children[i].allocate(childBox, flags);
child.allocate(childBox, flags);
}
},
});
var WorkspaceSwitcherPopup = new Lang.Class({
Name: 'WorkspaceSwitcherPopup',
Extends: St.Widget,
_init() {
this.parent({ x: 0,
y: 0,
width: global.screen_width,
height: global.screen_height,
style_class: 'workspace-switcher-group' });
this.actor = this;
Main.uiGroup.add_actor(this);
this._timeoutId = 0;
this._container = new St.BoxLayout({ style_class: 'workspace-switcher-container' });
this.add_child(this._container);
this._list = new WorkspaceSwitcherPopupList();
this._container.add_child(this._list);
this._redisplay();
this.hide();
let workspaceManager = global.workspace_manager;
this._workspaceManagerSignals = [];
this._workspaceManagerSignals.push(workspaceManager.connect('workspace-added',
this._redisplay.bind(this)));
this._workspaceManagerSignals.push(workspaceManager.connect('workspace-removed',
this._redisplay.bind(this)));
this.connect('destroy', this._onDestroy.bind(this));
},
_redisplay() {
let workspaceManager = global.workspace_manager;
@@ -165,7 +179,7 @@ var WorkspaceSwitcherPopup = new Lang.Class({
return GLib.SOURCE_REMOVE;
},
destroy() {
_onDestroy() {
if (this._timeoutId)
Mainloop.source_remove(this._timeoutId);
this._timeoutId = 0;
@@ -174,9 +188,6 @@ var WorkspaceSwitcherPopup = new Lang.Class({
for (let i = 0; i < this._workspaceManagerSignals.length; i++)
workspaceManager.disconnect(this._workspaceManagerSignals[i]);
this.actor.destroy();
this.emit('destroy');
this._workspaceManagerSignals = [];
}
});
Signals.addSignalMethods(WorkspaceSwitcherPopup.prototype);

View File

@@ -31,7 +31,7 @@ var WORKSPACE_CUT_SIZE = 10;
var WORKSPACE_KEEP_ALIVE_TIME = 100;
var OVERRIDE_SCHEMA = 'org.gnome.shell.overrides';
var MUTTER_SCHEMA = 'org.gnome.mutter';
/* A layout manager that requests size only for primary_actor, but then allocates
all using a fixed layout */
@@ -615,14 +615,14 @@ Signals.addSignalMethods(WorkspaceThumbnail.prototype);
var ThumbnailsBox = new Lang.Class({
Name: 'ThumbnailsBox',
Extends: St.Widget,
_init() {
this.actor = new Shell.GenericContainer({ reactive: true,
style_class: 'workspace-thumbnails',
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.parent({ reactive: true,
style_class: 'workspace-thumbnails',
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
this.actor = this;
this.actor._delegate = this;
let indicator = new St.Bin({ style_class: 'workspace-thumbnail-indicator' });
@@ -631,12 +631,12 @@ var ThumbnailsBox = new Lang.Class({
Shell.util_set_hidden_from_pick(indicator, true);
this._indicator = indicator;
this.actor.add_actor(indicator);
this.add_actor(indicator);
this._dropWorkspace = -1;
this._dropPlaceholderPos = -1;
this._dropPlaceholder = new St.Bin({ style_class: 'placeholder' });
this.actor.add_actor(this._dropPlaceholder);
this.add_actor(this._dropPlaceholder);
this._spliceIndex = -1;
this._targetScale = 0;
@@ -652,9 +652,9 @@ var ThumbnailsBox = new Lang.Class({
this._thumbnails = [];
this.actor.connect('button-press-event', () => Clutter.EVENT_STOP);
this.actor.connect('button-release-event', this._onButtonRelease.bind(this));
this.actor.connect('touch-event', this._onTouchEvent.bind(this));
this.connect('button-press-event', () => Clutter.EVENT_STOP);
this.connect('button-release-event', this._onButtonRelease.bind(this));
this.connect('touch-event', this._onTouchEvent.bind(this));
Main.overview.connect('showing',
this._createThumbnails.bind(this));
@@ -674,7 +674,7 @@ var ThumbnailsBox = new Lang.Class({
Main.overview.connect('window-drag-cancelled',
this._onDragCancelled.bind(this));
this._settings = new Gio.Settings({ schema_id: OVERRIDE_SCHEMA });
this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
this._settings.connect('changed::dynamic-workspaces',
this._updateSwitcherVisibility.bind(this));
@@ -693,13 +693,13 @@ var ThumbnailsBox = new Lang.Class({
_updateSwitcherVisibility() {
let workspaceManager = global.workspace_manager;
this.actor.visible =
this.visible =
this._settings.get_boolean('dynamic-workspaces') ||
workspaceManager.n_workspaces > 1;
},
_activateThumbnailAtPoint(stageX, stageY, time) {
let [r, x, y] = this.actor.transform_stage_point(stageX, stageY);
let [r, x, y] = this.transform_stage_point(stageX, stageY);
for (let i = 0; i < this._thumbnails.length; i++) {
let thumbnail = this._thumbnails[i]
@@ -753,7 +753,7 @@ var ThumbnailsBox = new Lang.Class({
},
_onDragMotion(dragEvent) {
if (!this.actor.contains(dragEvent.targetActor))
if (!this.contains(dragEvent.targetActor))
this._onLeave();
return DND.DragMotionResult.CONTINUE;
},
@@ -767,7 +767,7 @@ var ThumbnailsBox = new Lang.Class({
return;
this._dropPlaceholderPos = -1;
this.actor.queue_relayout();
this.queue_relayout();
},
// Draggable target interface
@@ -776,7 +776,7 @@ var ThumbnailsBox = new Lang.Class({
return DND.DragMotionResult.CONTINUE;
let canCreateWorkspaces = Meta.prefs_get_dynamic_workspaces();
let spacing = this.actor.get_theme_node().get_length('spacing');
let spacing = this.get_theme_node().get_length('spacing');
this._dropWorkspace = -1;
let placeholderPos = -1;
@@ -814,7 +814,7 @@ var ThumbnailsBox = new Lang.Class({
if (this._dropPlaceholderPos != placeholderPos) {
this._dropPlaceholderPos = placeholderPos;
this.actor.queue_relayout();
this.queue_relayout();
}
if (this._dropWorkspace != -1)
@@ -962,7 +962,7 @@ var ThumbnailsBox = new Lang.Class({
thumbnail.setPorthole(this._porthole.x, this._porthole.y,
this._porthole.width, this._porthole.height);
this._thumbnails.push(thumbnail);
this.actor.add_actor(thumbnail.actor);
this.add_actor(thumbnail.actor);
if (start > 0 && this._spliceIndex == -1) {
// not the initial fill, and not splicing via DND
@@ -1011,7 +1011,7 @@ var ThumbnailsBox = new Lang.Class({
set scale(scale) {
this._scale = scale;
this.actor.queue_relayout();
this.queue_relayout();
},
get scale() {
@@ -1020,7 +1020,7 @@ var ThumbnailsBox = new Lang.Class({
set indicatorY(indicatorY) {
this._indicatorY = indicatorY;
this.actor.queue_relayout();
this.queue_relayout();
},
get indicatorY() {
@@ -1080,7 +1080,6 @@ var ThumbnailsBox = new Lang.Class({
// Once that's complete, we can start scaling to the new size and collapse any removed thumbnails
this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT, thumbnail => {
this.actor.set_skip_paint(thumbnail.actor, true);
this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
Tweener.addTween(thumbnail,
{ collapseFraction: 1,
@@ -1132,39 +1131,36 @@ var ThumbnailsBox = new Lang.Class({
this._stateUpdateQueued = true;
},
_getPreferredHeight(actor, forWidth, alloc) {
vfunc_get_preferred_height(forWidth) {
// Note that for getPreferredWidth/Height we cheat a bit and skip propagating
// the size request to our children because we know how big they are and know
// that the actors aren't depending on the virtual functions being called.
if (!this._ensurePorthole()) {
alloc.min_size = -1;
alloc.natural_size = -1;
return;
}
if (!this._ensurePorthole())
return [0, 0];
let workspaceManager = global.workspace_manager;
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
let spacing = themeNode.get_length('spacing');
let nWorkspaces = workspaceManager.n_workspaces;
let totalSpacing = (nWorkspaces - 1) * spacing;
alloc.min_size = totalSpacing;
alloc.natural_size = totalSpacing + nWorkspaces * this._porthole.height * MAX_THUMBNAIL_SCALE;
let naturalHeight = totalSpacing + nWorkspaces * this._porthole.height * MAX_THUMBNAIL_SCALE;
return themeNode.adjust_preferred_height(totalSpacing, naturalHeight);
},
_getPreferredWidth(actor, forHeight, alloc) {
if (!this._ensurePorthole()) {
alloc.min_size = -1;
alloc.natural_size = -1;
return;
}
vfunc_get_preferred_width(forHeight) {
if (!this._ensurePorthole())
return [0, 0];
let workspaceManager = global.workspace_manager;
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
let spacing = this.actor.get_theme_node().get_length('spacing');
forHeight = themeNode.adjust_for_height(forHeight);
let spacing = themeNode.get_length('spacing');
let nWorkspaces = workspaceManager.n_workspaces;
let totalSpacing = (nWorkspaces - 1) * spacing;
@@ -1174,8 +1170,8 @@ var ThumbnailsBox = new Lang.Class({
scale = Math.min(scale, MAX_THUMBNAIL_SCALE);
let width = Math.round(this._porthole.width * scale);
alloc.min_size = width;
alloc.natural_size = width;
return themeNode.adjust_preferred_width(width, width);
},
// The "porthole" is the portion of the screen that we show in the
@@ -1190,14 +1186,18 @@ var ThumbnailsBox = new Lang.Class({
return true;
},
_allocate(actor, box, flags) {
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL);
if (this._thumbnails.length == 0) // not visible
return;
let workspaceManager = global.workspace_manager;
let themeNode = this.actor.get_theme_node();
let themeNode = this.get_theme_node();
box = themeNode.get_content_box(box);
let portholeWidth = this._porthole.width;
let portholeHeight = this._porthole.height;

View File

@@ -24,7 +24,7 @@ var AnimationType = {
FADE: 1
};
const OVERRIDE_SCHEMA = 'org.gnome.shell.overrides';
const MUTTER_SCHEMA = 'org.gnome.mutter';
var WorkspacesViewBase = new Lang.Class({
Name: 'WorkspacesViewBase',
@@ -473,7 +473,7 @@ var WorkspacesDisplay = new Lang.Class({
this._workspacesViews = [];
this._primaryScrollAdjustment = null;
this._settings = new Gio.Settings({ schema_id: OVERRIDE_SCHEMA });
this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
this._settings.connect('changed::workspaces-only-on-primary',
this._workspacesOnlyOnPrimaryChanged.bind(this));
this._workspacesOnlyOnPrimaryChanged();

View File

@@ -1,12 +1,12 @@
project('gnome-shell', 'c',
version: '3.30.1',
version: '3.31.2',
meson_version: '>= 0.47.0',
license: 'GPLv2+'
)
# We depend on a specific version of the libmutter API. The mutter variants of
# the Cogl and Clutter libraries also use this API version.
mutter_api_version = '3'
mutter_api_version = '4'
clutter_pc = 'mutter-clutter-' + mutter_api_version
cogl_pc = 'mutter-cogl-' + mutter_api_version
@@ -23,7 +23,7 @@ gi_req = '>= 1.49.1'
gjs_req = '>= 1.47.0'
gtk_req = '>= 3.15.0'
json_glib_req = '>= 0.13.2'
mutter_req = '>= 3.30.1'
mutter_req = '>= 3.31.2'
polkit_req = '>= 0.100'
schemas_req = '>= 3.27.90'
startup_req = '>= 0.11'
@@ -54,13 +54,10 @@ convertdir = join_paths(datadir, 'GConf', 'gsettings')
desktopdir = join_paths(datadir, 'applications')
ifacedir = join_paths(datadir, 'dbus-1', 'interfaces')
localedir = join_paths(datadir, 'locale')
mozplugindir = join_paths(libdir, 'mozilla', 'plugins')
portaldir = join_paths(datadir, 'xdg-desktop-portal', 'portals')
schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
servicedir = join_paths(datadir, 'dbus-1', 'services')
plugindir = get_variable('BROWSER_PLUGIN_DIR', mozplugindir)
# XXX: Once https://github.com/systemd/systemd/issues/9595 is fixed and we can
# depend on this version, replace with something like:
# systemduserunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir',
@@ -134,12 +131,6 @@ else
have_systemd = false
endif
if get_option('browser_plugin')
json_glib_dep = dependency('json-glib-1.0', version: json_glib_req)
subdir('browser-plugin')
endif
if get_option('man')
xsltproc = find_program('xsltproc')

View File

@@ -1,9 +1,3 @@
option('browser_plugin',
type: 'boolean',
value: true,
description: 'Enable extensions.gnome.org browser plugin'
)
option('gtk_doc',
type: 'boolean',
value: false,

1767
po/eo.po

File diff suppressed because it is too large Load Diff

598
po/es.po

File diff suppressed because it is too large Load Diff

554
po/fur.po

File diff suppressed because it is too large Load Diff

833
po/ja.po

File diff suppressed because it is too large Load Diff

1002
po/ml.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

899
po/sk.po

File diff suppressed because it is too large Load Diff

620
po/sl.po

File diff suppressed because it is too large Load Diff

554
po/sv.po

File diff suppressed because it is too large Load Diff

567
po/tr.po

File diff suppressed because it is too large Load Diff

View File

@@ -108,7 +108,6 @@ libshell_public_headers = [
'shell-app-system.h',
'shell-app-usage.h',
'shell-embedded-window.h',
'shell-generic-container.h',
'shell-glsl-quad.h',
'shell-gtk-embed.h',
'shell-global.h',
@@ -144,7 +143,6 @@ libshell_sources = [
'shell-app-usage.c',
'shell-embedded-window.c',
'shell-embedded-window-private.h',
'shell-generic-container.c',
'shell-global.c',
'shell-glsl-quad.c',
'shell-gtk-embed.c',

View File

@@ -5,9 +5,6 @@
#include "shell-app.h"
#include "shell-app-system.h"
#define SN_API_NOT_YET_FROZEN 1
#include <libsn/sn.h>
G_BEGIN_DECLS
ShellApp* _shell_app_new_for_window (MetaWindow *window);
@@ -16,7 +13,7 @@ ShellApp* _shell_app_new (GDesktopAppInfo *info);
void _shell_app_set_app_info (ShellApp *app, GDesktopAppInfo *info);
void _shell_app_handle_startup_sequence (ShellApp *app, SnStartupSequence *sequence);
void _shell_app_handle_startup_sequence (ShellApp *app, MetaStartupSequence *sequence);
void _shell_app_add_window (ShellApp *app, MetaWindow *window);

View File

@@ -386,8 +386,7 @@ _shell_app_system_notify_app_state_changed (ShellAppSystem *self,
* @self: A #ShellAppSystem
*
* Returns the set of applications which currently have at least one
* open window in the given context. The returned list will be sorted
* by shell_app_compare().
* open window. The returned list will be sorted by shell_app_compare().
*
* Returns: (element-type ShellApp) (transfer container): Active applications
*/

View File

@@ -82,21 +82,17 @@ struct _ShellAppUsage
GFile *configfile;
GDBusProxy *session_proxy;
GdkDisplay *display;
GSettings *privacy_settings;
gulong last_idle;
guint idle_focus_change_id;
guint save_id;
gboolean currently_idle;
gboolean enable_monitoring;
GSList *previously_running;
long watch_start_time;
ShellApp *watched_app;
/* <char *context, GHashTable<char *appid, UsageData *usage>> */
GHashTable *app_usages_for_context;
/* <char *appid, UsageData *usage> */
GHashTable *app_usages;
};
G_DEFINE_TYPE (ShellAppUsage, shell_app_usage, G_TYPE_OBJECT);
@@ -104,11 +100,6 @@ G_DEFINE_TYPE (ShellAppUsage, shell_app_usage, G_TYPE_OBJECT);
/* Represents an application record for a given context */
struct UsageData
{
/* Whether the application we're tracking is "transient", see
* shell_app_is_window_backed.
*/
gboolean transient;
gdouble score; /* Based on the number of times we'e seen the app and normalized */
long last_seen; /* Used to clear old apps we've only seen a few times */
};
@@ -118,9 +109,6 @@ static void shell_app_usage_finalize (GObject *object);
static void on_session_status_changed (GDBusProxy *proxy, guint status, ShellAppUsage *self);
static void on_focus_app_changed (ShellWindowTracker *tracker, GParamSpec *spec, ShellAppUsage *self);
static void ensure_queued_save (ShellAppUsage *self);
static UsageData * get_app_usage_for_context_and_id (ShellAppUsage *self,
const char *context,
const char *appid);
static gboolean idle_save_application_usage (gpointer data);
@@ -148,130 +136,34 @@ shell_app_usage_class_init (ShellAppUsageClass *klass)
gobject_class->finalize = shell_app_usage_finalize;
}
static GHashTable *
get_usages_for_context (ShellAppUsage *self,
const char *context)
{
GHashTable *context_usages;
context_usages = g_hash_table_lookup (self->app_usages_for_context, context);
if (context_usages == NULL)
{
context_usages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
g_hash_table_insert (self->app_usages_for_context, g_strdup (context),
context_usages);
}
return context_usages;
}
static UsageData *
get_app_usage_for_context_and_id (ShellAppUsage *self,
const char *context,
const char *appid)
{
UsageData *usage;
GHashTable *context_usages;
context_usages = get_usages_for_context (self, context);
usage = g_hash_table_lookup (context_usages, appid);
if (usage)
return usage;
usage = g_new0 (UsageData, 1);
g_hash_table_insert (context_usages, g_strdup (appid), usage);
return usage;
}
static UsageData *
get_usage_for_app (ShellAppUsage *self,
ShellApp *app)
{
const char *context;
UsageData *usage;
const char *appid = shell_app_get_id (app);
context = _shell_window_tracker_get_app_context (shell_window_tracker_get_default (), app);
usage = g_hash_table_lookup (self->app_usages, appid);
if (usage)
return usage;
return get_app_usage_for_context_and_id (self, context, shell_app_get_id (app));
}
usage = g_new0 (UsageData, 1);
g_hash_table_insert (self->app_usages, g_strdup (appid), usage);
typedef struct {
gboolean in_context;
GHashTableIter context_iter;
const char *context_id;
GHashTableIter usage_iter;
} UsageIterator;
static void
usage_iterator_init (ShellAppUsage *self,
UsageIterator *iter)
{
iter->in_context = FALSE;
g_hash_table_iter_init (&(iter->context_iter), self->app_usages_for_context);
}
static gboolean
usage_iterator_next (ShellAppUsage *self,
UsageIterator *iter,
const char **context,
const char **id,
UsageData **usage)
{
gpointer key, value;
gboolean next_context;
if (!iter->in_context)
next_context = TRUE;
else if (!g_hash_table_iter_next (&(iter->usage_iter), &key, &value))
next_context = TRUE;
else
next_context = FALSE;
while (next_context)
{
GHashTable *app_usages;
if (!g_hash_table_iter_next (&(iter->context_iter), &key, &value))
return FALSE;
iter->in_context = TRUE;
iter->context_id = key;
app_usages = value;
g_hash_table_iter_init (&(iter->usage_iter), app_usages);
next_context = !g_hash_table_iter_next (&(iter->usage_iter), &key, &value);
}
*context = iter->context_id;
*id = key;
*usage = value;
return TRUE;
}
static void
usage_iterator_remove (ShellAppUsage *self,
UsageIterator *iter)
{
g_assert (iter->in_context);
g_hash_table_iter_remove (&(iter->usage_iter));
return usage;
}
/* Limit the score to a certain level so that most used apps can change */
static void
normalize_usage (ShellAppUsage *self)
{
UsageIterator iter;
const char *context;
const char *id;
GHashTableIter iter;
UsageData *usage;
usage_iterator_init (self, &iter);
g_hash_table_iter_init (&iter, self->app_usages);
while (usage_iterator_next (self, &iter, &context, &id, &usage))
{
usage->score /= 2;
}
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &usage))
usage->score /= 2;
}
static void
@@ -395,7 +287,7 @@ shell_app_usage_init (ShellAppUsage *self)
global = shell_global_get ();
self->app_usages_for_context = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
self->app_usages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
tracker = shell_window_tracker_get_default ();
g_signal_connect (tracker, "notify::focus-app", G_CALLBACK (on_focus_app_changed), self);
@@ -415,7 +307,6 @@ shell_app_usage_init (ShellAppUsage *self)
g_signal_connect (self->session_proxy, "g-signal", G_CALLBACK (session_proxy_signal), self);
g_object_unref (session_bus);
self->last_idle = 0;
self->currently_idle = FALSE;
self->enable_monitoring = FALSE;
@@ -451,25 +342,20 @@ shell_app_usage_finalize (GObject *object)
G_OBJECT_CLASS (shell_app_usage_parent_class)->finalize(object);
}
typedef struct {
ShellAppUsage *usage;
GHashTable *context_usages;
} SortAppsByUsageData;
static int
sort_apps_by_usage (gconstpointer a,
gconstpointer b,
gpointer datap)
{
SortAppsByUsageData *data = datap;
ShellAppUsage *self = datap;
ShellApp *app_a, *app_b;
UsageData *usage_a, *usage_b;
app_a = (ShellApp*)a;
app_b = (ShellApp*)b;
usage_a = g_hash_table_lookup (data->context_usages, shell_app_get_id (app_a));
usage_b = g_hash_table_lookup (data->context_usages, shell_app_get_id (app_b));
usage_a = g_hash_table_lookup (self->app_usages, shell_app_get_id (app_a));
usage_b = g_hash_table_lookup (self->app_usages, shell_app_get_id (app_b));
return usage_b->score - usage_a->score;
}
@@ -477,33 +363,23 @@ sort_apps_by_usage (gconstpointer a,
/**
* shell_app_usage_get_most_used:
* @usage: the usage instance to request
* @context: Activity identifier
*
* Get a list of most popular applications for a given context.
*
* Returns: (element-type ShellApp) (transfer full): List of applications
*/
GSList *
shell_app_usage_get_most_used (ShellAppUsage *self,
const char *context)
shell_app_usage_get_most_used (ShellAppUsage *self)
{
GSList *apps;
GList *appids, *iter;
GHashTable *usages;
char *appid;
ShellAppSystem *appsys;
SortAppsByUsageData data;
usages = g_hash_table_lookup (self->app_usages_for_context, context);
if (usages == NULL)
return NULL;
GHashTableIter iter;
appsys = shell_app_system_get_default ();
appids = g_hash_table_get_keys (usages);
g_hash_table_iter_init (&iter, self->app_usages);
apps = NULL;
for (iter = appids; iter; iter = iter->next)
while (g_hash_table_iter_next (&iter, (gpointer *) &appid, NULL))
{
const char *appid = iter->data;
ShellApp *app;
app = shell_app_system_lookup_app (appsys, appid);
@@ -513,11 +389,7 @@ shell_app_usage_get_most_used (ShellAppUsage *self,
apps = g_slist_prepend (apps, g_object_ref (app));
}
g_list_free (appids);
data.usage = self;
data.context_usages = usages;
apps = g_slist_sort_with_data (apps, sort_apps_by_usage, &data);
apps = g_slist_sort_with_data (apps, sort_apps_by_usage, self);
return apps;
}
@@ -526,7 +398,6 @@ shell_app_usage_get_most_used (ShellAppUsage *self,
/**
* shell_app_usage_compare:
* @self: the usage instance to request
* @context: Activity identifier
* @id_a: ID of first app
* @id_b: ID of second app
*
@@ -537,19 +408,13 @@ shell_app_usage_get_most_used (ShellAppUsage *self,
*/
int
shell_app_usage_compare (ShellAppUsage *self,
const char *context,
const char *id_a,
const char *id_b)
{
GHashTable *usages;
UsageData *usage_a, *usage_b;
usages = g_hash_table_lookup (self->app_usages_for_context, context);
if (usages == NULL)
return 0;
usage_a = g_hash_table_lookup (usages, id_a);
usage_b = g_hash_table_lookup (usages, id_b);
usage_a = g_hash_table_lookup (self->app_usages, id_a);
usage_b = g_hash_table_lookup (self->app_usages, id_b);
if (usage_a == NULL && usage_b == NULL)
return 0;
@@ -577,9 +442,7 @@ ensure_queued_save (ShellAppUsage *self)
static gboolean
idle_clean_usage (ShellAppUsage *self)
{
UsageIterator iter;
const char *context;
const char *id;
GHashTableIter iter;
UsageData *usage;
long current_time;
long week_ago;
@@ -587,13 +450,13 @@ idle_clean_usage (ShellAppUsage *self)
current_time = get_time ();
week_ago = current_time - (7 * 24 * 60 * 60);
usage_iterator_init (self, &iter);
g_hash_table_iter_init (&iter, self->app_usages);
while (usage_iterator_next (self, &iter, &context, &id, &usage))
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &usage))
{
if ((usage->score < SCORE_MIN) &&
(usage->last_seen < week_ago))
usage_iterator_remove (self, &iter);
g_hash_table_iter_remove (&iter);
}
return FALSE;
@@ -672,10 +535,8 @@ static gboolean
idle_save_application_usage (gpointer data)
{
ShellAppUsage *self = SHELL_APP_USAGE (data);
UsageIterator iter;
const char *current_context;
const char *context;
const char *id;
char *id;
GHashTableIter iter;
UsageData *usage;
GFileOutputStream *output;
GOutputStream *buffered_output;
@@ -699,11 +560,12 @@ idle_save_application_usage (gpointer data)
if (!g_data_output_stream_put_string (data_output, "<?xml version=\"1.0\"?>\n<application-state>\n", NULL, &error))
goto out;
if (!g_data_output_stream_put_string (data_output, " <context id=\"\">\n", NULL, &error))
goto out;
usage_iterator_init (self, &iter);
g_hash_table_iter_init (&iter, self->app_usages);
current_context = NULL;
while (usage_iterator_next (self, &iter, &context, &id, &usage))
while (g_hash_table_iter_next (&iter, (gpointer *) &id, (gpointer *) &usage))
{
ShellApp *app;
@@ -712,28 +574,10 @@ idle_save_application_usage (gpointer data)
if (!app)
continue;
if (context != current_context)
{
if (current_context != NULL)
{
if (!g_data_output_stream_put_string (data_output, " </context>", NULL, &error))
goto out;
}
current_context = context;
if (!g_data_output_stream_put_string (data_output, " <context", NULL, &error))
goto out;
if (!write_attribute_string (data_output, "id", context, &error))
goto out;
if (!g_data_output_stream_put_string (data_output, ">\n", NULL, &error))
goto out;
}
if (!g_data_output_stream_put_string (data_output, " <application", NULL, &error))
goto out;
if (!write_attribute_string (data_output, "id", id, &error))
goto out;
if (!write_attribute_uint (data_output, "open-window-count", shell_app_get_n_windows (app), &error))
goto out;
if (!write_attribute_double (data_output, "score", usage->score, &error))
goto out;
if (!write_attribute_uint (data_output, "last-seen", usage->last_seen, &error))
@@ -741,11 +585,8 @@ idle_save_application_usage (gpointer data)
if (!g_data_output_stream_put_string (data_output, "/>\n", NULL, &error))
goto out;
}
if (current_context != NULL)
{
if (!g_data_output_stream_put_string (data_output, " </context>\n", NULL, &error))
goto out;
}
if (!g_data_output_stream_put_string (data_output, " </context>\n", NULL, &error))
goto out;
if (!g_data_output_stream_put_string (data_output, "</application-state>\n", NULL, &error))
goto out;
@@ -761,48 +602,21 @@ out:
return FALSE;
}
typedef struct {
ShellAppUsage *self;
char *context;
} ParseData;
static void
shell_app_usage_start_element_handler (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
{
ParseData *data = user_data;
ShellAppUsage *self = user_data;
if (strcmp (element_name, "application-state") == 0)
{
}
else if (strcmp (element_name, "context") == 0)
{
char *id = NULL;
const char **attribute;
const char **value;
for (attribute = attribute_names, value = attribute_values; *attribute; attribute++, value++)
{
if (strcmp (*attribute, "id") == 0)
{
id = g_strdup (*value);
break;
}
}
if (!id)
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE,
"Missing attribute id on <%s> element",
element_name);
return;
}
data->context = id;
}
else if (strcmp (element_name, "application") == 0)
{
@@ -810,7 +624,6 @@ shell_app_usage_start_element_handler (GMarkupParseContext *context,
const char **value;
UsageData *usage;
char *appid = NULL;
GHashTable *usage_table;
for (attribute = attribute_names, value = attribute_values; *attribute; attribute++, value++)
{
@@ -831,21 +644,12 @@ shell_app_usage_start_element_handler (GMarkupParseContext *context,
return;
}
usage_table = get_usages_for_context (data->self, data->context);
usage = g_new0 (UsageData, 1);
g_hash_table_insert (usage_table, appid, usage);
g_hash_table_insert (self->app_usages, appid, usage);
for (attribute = attribute_names, value = attribute_values; *attribute; attribute++, value++)
{
if (strcmp (*attribute, "open-window-count") == 0)
{
guint count = strtoul (*value, NULL, 10);
if (count > 0)
data->self->previously_running = g_slist_prepend (data->self->previously_running,
g_strdup (appid));
}
else if (strcmp (*attribute, "score") == 0)
if (strcmp (*attribute, "score") == 0)
{
usage->score = g_ascii_strtod (*value, NULL);
}
@@ -865,36 +669,11 @@ shell_app_usage_start_element_handler (GMarkupParseContext *context,
}
}
static void
shell_app_usage_end_element_handler (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
GError **error)
{
ParseData *data = user_data;
if (strcmp (element_name, "context") == 0)
{
g_free (data->context);
data->context = NULL;
}
}
static void
shell_app_usage_text_handler (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
GError **error)
{
/* do nothing, very very fast */
}
static GMarkupParser app_state_parse_funcs =
{
shell_app_usage_start_element_handler,
shell_app_usage_end_element_handler,
shell_app_usage_text_handler,
NULL,
NULL,
NULL,
NULL
};
@@ -904,7 +683,6 @@ static void
restore_from_file (ShellAppUsage *self)
{
GFileInputStream *input;
ParseData parse_data;
GMarkupParseContext *parse_context;
GError *error = NULL;
char buf[1024];
@@ -919,10 +697,7 @@ restore_from_file (ShellAppUsage *self)
return;
}
memset (&parse_data, 0, sizeof (ParseData));
parse_data.self = self;
parse_data.context = NULL;
parse_context = g_markup_parse_context_new (&app_state_parse_funcs, 0, &parse_data, NULL);
parse_context = g_markup_parse_context_new (&app_state_parse_funcs, 0, self, NULL);
while (TRUE)
{
@@ -934,7 +709,6 @@ restore_from_file (ShellAppUsage *self)
}
out:
g_free (parse_data.context);
g_markup_parse_context_free (parse_context);
g_input_stream_close ((GInputStream*)input, NULL, NULL);
g_object_unref (input);

View File

@@ -13,10 +13,8 @@ G_DECLARE_FINAL_TYPE (ShellAppUsage, shell_app_usage,
ShellAppUsage* shell_app_usage_get_default(void);
GSList *shell_app_usage_get_most_used (ShellAppUsage *usage,
const char *context);
GSList *shell_app_usage_get_most_used (ShellAppUsage *usage);
int shell_app_usage_compare (ShellAppUsage *self,
const char *context,
const char *id_a,
const char *id_b);

View File

@@ -1142,10 +1142,10 @@ shell_app_get_pids (ShellApp *app)
}
void
_shell_app_handle_startup_sequence (ShellApp *app,
SnStartupSequence *sequence)
_shell_app_handle_startup_sequence (ShellApp *app,
MetaStartupSequence *sequence)
{
gboolean starting = !sn_startup_sequence_get_completed (sequence);
gboolean starting = !meta_startup_sequence_get_completed (sequence);
/* The Shell design calls for on application launch, the app title
* appears at top, and no X window is focused. So when we get
@@ -1160,8 +1160,8 @@ _shell_app_handle_startup_sequence (ShellApp *app,
shell_app_state_transition (app, SHELL_APP_STATE_STARTING);
meta_x11_display_focus_the_no_focus_window (x11_display,
sn_startup_sequence_get_timestamp (sequence));
app->started_on_workspace = sn_startup_sequence_get_workspace (sequence);
meta_startup_sequence_get_timestamp (sequence));
app->started_on_workspace = meta_startup_sequence_get_workspace (sequence);
}
if (!starting)

View File

@@ -1,433 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/**
* SECTION:shell-generic-container
* @short_description: A container class with signals for allocation
*
* #ShellGenericContainer is mainly a workaround for the current
* lack of GObject subclassing + vfunc overrides in gjs. We
* implement the container interface, but proxy the virtual functions
* into signals, which gjs can catch.
*
* #ShellGenericContainer is an #StWidget, and automatically takes its
* borders and padding into account during size request and allocation.
*/
#include "config.h"
#include "shell-generic-container.h"
#include <clutter/clutter.h>
#include <gtk/gtk.h>
#include <girepository.h>
static void shell_generic_container_iface_init (ClutterContainerIface *iface);
typedef struct _ShellGenericContainerPrivate ShellGenericContainerPrivate;
struct _ShellGenericContainer
{
StWidget parent;
ShellGenericContainerPrivate *priv;
};
struct _ShellGenericContainerPrivate {
GHashTable *skip_paint;
};
G_DEFINE_TYPE_WITH_CODE(ShellGenericContainer,
shell_generic_container,
ST_TYPE_WIDGET,
G_ADD_PRIVATE (ShellGenericContainer)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
shell_generic_container_iface_init));
/* Signals */
enum
{
GET_PREFERRED_WIDTH,
GET_PREFERRED_HEIGHT,
ALLOCATE,
LAST_SIGNAL
};
static guint shell_generic_container_signals [LAST_SIGNAL] = { 0 };
static gpointer
shell_generic_container_allocation_ref (ShellGenericContainerAllocation *alloc)
{
alloc->_refcount++;
return alloc;
}
static void
shell_generic_container_allocation_unref (ShellGenericContainerAllocation *alloc)
{
if (--alloc->_refcount == 0)
g_slice_free (ShellGenericContainerAllocation, alloc);
}
static void
shell_generic_container_allocate (ClutterActor *self,
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
StThemeNode *theme_node;
ClutterActorBox content_box;
clutter_actor_set_allocation (self, box, flags);
theme_node = st_widget_get_theme_node (ST_WIDGET (self));
st_theme_node_get_content_box (theme_node, box, &content_box);
g_signal_emit (G_OBJECT (self), shell_generic_container_signals[ALLOCATE], 0,
&content_box, flags);
}
static void
shell_generic_container_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
ShellGenericContainerAllocation *alloc = g_slice_new0 (ShellGenericContainerAllocation);
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
st_theme_node_adjust_for_height (theme_node, &for_height);
alloc->_refcount = 1;
g_signal_emit (G_OBJECT (actor), shell_generic_container_signals[GET_PREFERRED_WIDTH], 0,
for_height, alloc);
if (min_width_p)
*min_width_p = alloc->min_size;
if (natural_width_p)
*natural_width_p = alloc->natural_size;
shell_generic_container_allocation_unref (alloc);
st_theme_node_adjust_preferred_width (theme_node, min_width_p, natural_width_p);
}
static void
shell_generic_container_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
ShellGenericContainerAllocation *alloc = g_slice_new0 (ShellGenericContainerAllocation);
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
st_theme_node_adjust_for_width (theme_node, &for_width);
alloc->_refcount = 1;
g_signal_emit (G_OBJECT (actor), shell_generic_container_signals[GET_PREFERRED_HEIGHT], 0,
for_width, alloc);
if (min_height_p)
*min_height_p = alloc->min_size;
if (natural_height_p)
*natural_height_p = alloc->natural_size;
shell_generic_container_allocation_unref (alloc);
st_theme_node_adjust_preferred_height (theme_node, min_height_p, natural_height_p);
}
static void
shell_generic_container_paint (ClutterActor *actor)
{
ShellGenericContainer *self = (ShellGenericContainer*) actor;
ClutterActor *child;
st_widget_paint_background (ST_WIDGET (actor));
for (child = clutter_actor_get_first_child (actor);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{
if (g_hash_table_lookup (self->priv->skip_paint, child))
continue;
clutter_actor_paint (child);
}
}
static void
shell_generic_container_pick (ClutterActor *actor,
const ClutterColor *color)
{
ShellGenericContainer *self = (ShellGenericContainer*) actor;
ClutterActor *child;
CLUTTER_ACTOR_CLASS (shell_generic_container_parent_class)->pick (actor, color);
for (child = clutter_actor_get_first_child (actor);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{
if (g_hash_table_lookup (self->priv->skip_paint, child))
continue;
clutter_actor_paint (child);
}
}
static GList *
shell_generic_container_get_focus_chain (StWidget *widget)
{
ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (widget);
ClutterActor *child;
GList *focus_chain;
focus_chain = NULL;
for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (self));
child != NULL;
child = clutter_actor_get_next_sibling (child))
{
if (clutter_actor_is_visible (child) &&
!shell_generic_container_get_skip_paint (self, child))
focus_chain = g_list_prepend (focus_chain, child);
}
return g_list_reverse (focus_chain);
}
/**
* shell_generic_container_get_n_skip_paint:
* @self: A #ShellGenericContainer
*
* Returns: Number of children which will not be painted.
*/
guint
shell_generic_container_get_n_skip_paint (ShellGenericContainer *self)
{
return g_hash_table_size (self->priv->skip_paint);
}
/**
* shell_generic_container_get_skip_paint:
* @self: A #ShellGenericContainer
* @child: Child #ClutterActor
*
* Gets whether or not @actor is skipped when painting.
*
* Return value: %TRUE or %FALSE
*/
gboolean
shell_generic_container_get_skip_paint (ShellGenericContainer *self,
ClutterActor *child)
{
return g_hash_table_lookup (self->priv->skip_paint, child) != NULL;
}
/**
* shell_generic_container_set_skip_paint:
* @self: A #ShellGenericContainer
* @child: Child #ClutterActor
* @skip: %TRUE if we should skip painting
*
* Set whether or not we should skip painting @actor. Workaround for
* lack of gjs ability to override _paint vfunc.
*/
void
shell_generic_container_set_skip_paint (ShellGenericContainer *self,
ClutterActor *child,
gboolean skip)
{
gboolean currently_skipping;
currently_skipping = g_hash_table_lookup (self->priv->skip_paint, child) != NULL;
if ((!!skip) == currently_skipping)
return;
if (!skip)
g_hash_table_remove (self->priv->skip_paint, child);
else
g_hash_table_insert (self->priv->skip_paint, child, child);
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
static gboolean
shell_generic_container_get_paint_volume (ClutterActor *self,
ClutterPaintVolume *volume)
{
ClutterActorBox paint_box, alloc_box;
StThemeNode *theme_node;
ClutterVertex origin;
/* Setting the paint volume does not make sense when we don't have any allocation */
if (!clutter_actor_has_allocation (self))
return FALSE;
theme_node = st_widget_get_theme_node (ST_WIDGET (self));
clutter_actor_get_allocation_box (self, &alloc_box);
st_theme_node_get_paint_box (theme_node, &alloc_box, &paint_box);
origin.x = paint_box.x1 - alloc_box.x1;
origin.y = paint_box.y1 - alloc_box.y1;
origin.z = 0.0f;
clutter_paint_volume_set_origin (volume, &origin);
clutter_paint_volume_set_width (volume, paint_box.x2 - paint_box.x1);
clutter_paint_volume_set_height (volume, paint_box.y2 - paint_box.y1);
if (!clutter_actor_get_clip_to_allocation (self))
{
ClutterActor *child;
/* Based on ClutterGroup/ClutterBox; include the children's
* paint volumes, since they may paint outside our allocation.
*/
for (child = clutter_actor_get_first_child (self);
child != NULL;
child = clutter_actor_get_next_sibling (child))
{
const ClutterPaintVolume *child_volume;
if (!clutter_actor_is_visible (child))
continue;
if (shell_generic_container_get_skip_paint (SHELL_GENERIC_CONTAINER (self), child))
continue;
child_volume = clutter_actor_get_transformed_paint_volume (child, self);
if (!child_volume)
return FALSE;
clutter_paint_volume_union (volume, child_volume);
}
}
return TRUE;
}
static void
shell_generic_container_finalize (GObject *object)
{
ShellGenericContainer *self = (ShellGenericContainer*) object;
g_hash_table_destroy (self->priv->skip_paint);
G_OBJECT_CLASS (shell_generic_container_parent_class)->finalize (object);
}
static void
shell_generic_container_class_init (ShellGenericContainerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
gobject_class->finalize = shell_generic_container_finalize;
actor_class->get_preferred_width = shell_generic_container_get_preferred_width;
actor_class->get_preferred_height = shell_generic_container_get_preferred_height;
actor_class->allocate = shell_generic_container_allocate;
actor_class->paint = shell_generic_container_paint;
actor_class->pick = shell_generic_container_pick;
actor_class->get_paint_volume = shell_generic_container_get_paint_volume;
widget_class->get_focus_chain = shell_generic_container_get_focus_chain;
/**
* ShellGenericContainer::get-preferred-width:
* @self: the #ShellGenericContainer
* @for_height: as in clutter_actor_get_preferred_width()
* @alloc: a #ShellGenericContainerAllocation to be filled in
*
* Emitted when clutter_actor_get_preferred_width() is called
* on @self. You should fill in the fields of @alloc with the
* your minimum and natural widths. #ShellGenericContainer
* will deal with taking its borders and padding into account
* for you.
*
* @alloc's fields are initialized to 0, so unless you have a fixed
* width specified (via #ClutterActor:width or CSS), you must
* connect to this signal and fill in the values.
*/
shell_generic_container_signals[GET_PREFERRED_WIDTH] =
g_signal_new ("get-preferred-width",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_FLOAT, SHELL_TYPE_GENERIC_CONTAINER_ALLOCATION);
/**
* ShellGenericContainer::get-preferred-height:
* @self: the #ShellGenericContainer
* @for_width: as in clutter_actor_get_preferred_height()
* @alloc: a #ShellGenericContainerAllocation to be filled in
*
* Emitted when clutter_actor_get_preferred_height() is called
* on @self. You should fill in the fields of @alloc with the
* your minimum and natural heights. #ShellGenericContainer
* will deal with taking its borders and padding into account
* for you.
*
* @alloc's fields are initialized to 0, so unless you have a fixed
* height specified (via #ClutterActor:height or CSS), you must
* connect to this signal and fill in the values.
*/
shell_generic_container_signals[GET_PREFERRED_HEIGHT] =
g_signal_new ("get-preferred-height",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_FLOAT, SHELL_TYPE_GENERIC_CONTAINER_ALLOCATION);
/**
* ShellGenericContainer::allocate:
* @self: the #ShellGenericContainer
* @box: @self's content box
* @flags: the allocation flags.
*
* Emitted when @self is allocated, after chaining up to the parent
* allocate method.
*
* Note that @box is @self's content box (qv
* st_theme_node_get_content_box()), NOT its allocation.
*/
shell_generic_container_signals[ALLOCATE] =
g_signal_new ("allocate",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2, CLUTTER_TYPE_ACTOR_BOX, CLUTTER_TYPE_ALLOCATION_FLAGS);
}
static void
shell_generic_container_actor_removed (ClutterContainer *container,
ClutterActor *actor)
{
ShellGenericContainerPrivate *priv = SHELL_GENERIC_CONTAINER (container)->priv;
g_hash_table_remove (priv->skip_paint, actor);
}
static void
shell_generic_container_iface_init (ClutterContainerIface *iface)
{
iface->actor_removed = shell_generic_container_actor_removed;
}
static void
shell_generic_container_init (ShellGenericContainer *area)
{
area->priv = shell_generic_container_get_instance_private (area);
area->priv->skip_paint = g_hash_table_new (NULL, NULL);
}
GType
shell_generic_container_allocation_get_type (void)
{
static GType gtype = G_TYPE_INVALID;
if (gtype == G_TYPE_INVALID)
{
gtype = g_boxed_type_register_static ("ShellGenericContainerAllocation",
(GBoxedCopyFunc)shell_generic_container_allocation_ref,
(GBoxedFreeFunc)shell_generic_container_allocation_unref);
}
return gtype;
}

View File

@@ -1,30 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#ifndef __SHELL_GENERIC_CONTAINER_H__
#define __SHELL_GENERIC_CONTAINER_H__
#include "st.h"
#define SHELL_TYPE_GENERIC_CONTAINER (shell_generic_container_get_type ())
G_DECLARE_FINAL_TYPE (ShellGenericContainer, shell_generic_container,
SHELL, GENERIC_CONTAINER, StWidget)
typedef struct {
float min_size;
float natural_size;
/* <private> */
guint _refcount;
} ShellGenericContainerAllocation;
#define SHELL_TYPE_GENERIC_CONTAINER_ALLOCATION (shell_generic_container_allocation_get_type ())
GType shell_generic_container_allocation_get_type (void);
guint shell_generic_container_get_n_skip_paint (ShellGenericContainer *self);
gboolean shell_generic_container_get_skip_paint (ShellGenericContainer *self,
ClutterActor *child);
void shell_generic_container_set_skip_paint (ShellGenericContainer *self,
ClutterActor *child,
gboolean skip);
#endif /* __SHELL_GENERIC_CONTAINER_H__ */

View File

@@ -10,8 +10,6 @@
#include <pwd.h>
#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
#include <polkitagent/polkitagent.h>
#include "shell-polkit-authentication-agent.h"
#include <glib/gi18n.h>
@@ -49,12 +47,6 @@ print_debug (const gchar *str, ...)
}
#endif
struct _ShellPolkitAuthenticationAgentClass
{
PolkitAgentListenerClass parent_class;
};
struct _AuthRequest;
typedef struct _AuthRequest AuthRequest;
@@ -326,8 +318,11 @@ shell_polkit_authentication_agent_unregister (ShellPolkitAuthenticationAgent *ag
if (agent->current_request != NULL)
auth_request_dismiss (agent->current_request);
polkit_agent_listener_unregister (agent->handle);
agent->handle = NULL;
if (agent->handle)
{
polkit_agent_listener_unregister (agent->handle);
agent->handle = NULL;
}
}
static void maybe_process_next_request (ShellPolkitAuthenticationAgent *agent);

View File

@@ -6,25 +6,23 @@
* Author: David Zeuthen <davidz@redhat.com>
*/
#ifndef __SHELL_POLKIT_AUTHENTICATION_AGENT_H__
#define __SHELL_POLKIT_AUTHENTICATION_AGENT_H__
#pragma once
#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
#include <polkitagent/polkitagent.h>
#include <glib-object.h>
G_BEGIN_DECLS
typedef struct _ShellPolkitAuthenticationAgent ShellPolkitAuthenticationAgent;
typedef struct _ShellPolkitAuthenticationAgentClass ShellPolkitAuthenticationAgentClass;
/* Polkit doesn't have g_autoptr support, thus we have to manually set the autoptr function here */
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAgentListener, g_object_unref)
#define SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT (shell_polkit_authentication_agent_get_type ())
#define SHELL_POLKIT_AUTHENTICATION_AGENT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT, ShellPolkitAuthenticationAgent))
#define SHELL_POLKIT_AUTHENTICATION_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT, ShellPolkitAuthenticationAgentClass))
#define SHELL_IS_POLKIT_AUTHENTICATION_AGENT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT))
#define SHELL_IS_POLKIT_AUTHENTICATION_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT))
#define SHELL_POLKIT_AUTHENTICATION_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT, ShellPolkitAuthenticationAgentClass))
#define SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT (shell_polkit_authentication_agent_get_type())
G_DECLARE_FINAL_TYPE (ShellPolkitAuthenticationAgent, shell_polkit_authentication_agent, SHELL, POLKIT_AUTHENTICATION_AGENT, PolkitAgentListener)
ShellPolkitAuthenticationAgent *shell_polkit_authentication_agent_new (void);
GType shell_polkit_authentication_agent_get_type (void) G_GNUC_CONST;
ShellPolkitAuthenticationAgent *shell_polkit_authentication_agent_new (void);
void shell_polkit_authentication_agent_complete (ShellPolkitAuthenticationAgent *agent,
gboolean dismissed);
void shell_polkit_authentication_agent_register (ShellPolkitAuthenticationAgent *agent,
@@ -33,4 +31,3 @@ void shell_polkit_authentication_agent_unregister (Sh
G_END_DECLS
#endif /* __SHELL_POLKIT_AUTHENTICATION_AGENT_H__ */

View File

@@ -14,9 +14,7 @@
#include <meta/util.h>
#include <meta/window.h>
#include <meta/meta-workspace-manager.h>
#define SN_API_NOT_YET_FROZEN 1
#include <libsn/sn.h>
#include <meta/meta-startup-notification.h>
#include "shell-window-tracker-private.h"
#include "shell-app-private.h"
@@ -74,6 +72,7 @@ static void on_focus_window_changed (MetaDisplay *display, GParamSpec *spec, She
static void track_window (ShellWindowTracker *tracker, MetaWindow *window);
static void disassociate_window (ShellWindowTracker *tracker, MetaWindow *window);
static ShellApp * shell_startup_sequence_get_app (MetaStartupSequence *sequence);
static void
shell_window_tracker_get_property (GObject *gobject,
@@ -115,7 +114,7 @@ shell_window_tracker_class_init (ShellWindowTrackerClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, SHELL_TYPE_STARTUP_SEQUENCE);
G_TYPE_NONE, 1, META_TYPE_STARTUP_SEQUENCE);
signals[TRACKED_WINDOWS_CHANGED] = g_signal_new ("tracked-windows-changed",
SHELL_TYPE_WINDOW_TRACKER,
G_SIGNAL_RUN_LAST,
@@ -430,8 +429,8 @@ get_app_for_window (ShellWindowTracker *tracker,
sequences = shell_window_tracker_get_startup_sequences (tracker);
for (iter = sequences; iter; iter = iter->next)
{
ShellStartupSequence *sequence = iter->data;
const char *id = shell_startup_sequence_get_id (sequence);
MetaStartupSequence *sequence = iter->data;
const char *id = meta_startup_sequence_get_id (sequence);
if (strcmp (id, startup_id) != 0)
continue;
@@ -457,12 +456,6 @@ get_app_for_window (ShellWindowTracker *tracker,
return result;
}
const char *
_shell_window_tracker_get_app_context (ShellWindowTracker *tracker, ShellApp *app)
{
return "";
}
static void
update_focus_app (ShellWindowTracker *self)
{
@@ -659,13 +652,13 @@ init_window_tracking (ShellWindowTracker *self)
}
static void
on_startup_sequence_changed (MetaDisplay *display,
SnStartupSequence *sequence,
ShellWindowTracker *self)
on_startup_sequence_changed (MetaStartupNotification *sn,
MetaStartupSequence *sequence,
ShellWindowTracker *self)
{
ShellApp *app;
app = shell_startup_sequence_get_app ((ShellStartupSequence*)sequence);
app = shell_startup_sequence_get_app (sequence);
if (app)
_shell_app_handle_startup_sequence (app, sequence);
@@ -676,12 +669,13 @@ static void
shell_window_tracker_init (ShellWindowTracker *self)
{
MetaDisplay *display = shell_global_get_display (shell_global_get ());
MetaStartupNotification *sn = meta_display_get_startup_notification (display);
self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) g_object_unref);
g_signal_connect (display, "startup-sequence-changed",
g_signal_connect (sn, "changed",
G_CALLBACK (on_startup_sequence_changed), self);
load_initial_windows (self);
@@ -792,60 +786,27 @@ on_focus_window_changed (MetaDisplay *display,
* shell_window_tracker_get_startup_sequences:
* @tracker:
*
* Returns: (transfer none) (element-type ShellStartupSequence): Currently active startup sequences
* Returns: (transfer none) (element-type MetaStartupSequence): Currently active startup sequences
*/
GSList *
shell_window_tracker_get_startup_sequences (ShellWindowTracker *self)
{
ShellGlobal *global = shell_global_get ();
MetaDisplay *display = shell_global_get_display (global);
MetaStartupNotification *sn = meta_display_get_startup_notification (display);
return meta_display_get_startup_sequences (display);
return meta_startup_notification_get_sequences (sn);
}
/* sn_startup_sequence_ref returns void, so make a
* wrapper which returns self */
static SnStartupSequence *
sequence_ref (SnStartupSequence *sequence)
{
sn_startup_sequence_ref (sequence);
return sequence;
}
GType
shell_startup_sequence_get_type (void)
{
static GType gtype = G_TYPE_INVALID;
if (gtype == G_TYPE_INVALID)
{
gtype = g_boxed_type_register_static ("ShellStartupSequence",
(GBoxedCopyFunc)sequence_ref,
(GBoxedFreeFunc)sn_startup_sequence_unref);
}
return gtype;
}
const char *
shell_startup_sequence_get_id (ShellStartupSequence *sequence)
{
return sn_startup_sequence_get_id ((SnStartupSequence*)sequence);
}
/**
* shell_startup_sequence_get_app:
* @sequence: A #ShellStartupSequence
*
* Returns: (transfer none): The application being launched, or %NULL if unknown.
*/
ShellApp *
shell_startup_sequence_get_app (ShellStartupSequence *sequence)
static ShellApp *
shell_startup_sequence_get_app (MetaStartupSequence *sequence)
{
const char *appid;
char *basename;
ShellAppSystem *appsys;
ShellApp *app;
appid = sn_startup_sequence_get_application_id ((SnStartupSequence*)sequence);
appid = meta_startup_sequence_get_application_id (sequence);
if (!appid)
return NULL;
@@ -856,61 +817,6 @@ shell_startup_sequence_get_app (ShellStartupSequence *sequence)
return app;
}
const char *
shell_startup_sequence_get_name (ShellStartupSequence *sequence)
{
return sn_startup_sequence_get_name ((SnStartupSequence*)sequence);
}
gboolean
shell_startup_sequence_get_completed (ShellStartupSequence *sequence)
{
return sn_startup_sequence_get_completed ((SnStartupSequence*)sequence);
}
int
shell_startup_sequence_get_workspace (ShellStartupSequence *sequence)
{
return sn_startup_sequence_get_workspace ((SnStartupSequence*)sequence);
}
/**
* shell_startup_sequence_create_icon:
* @sequence:
* @size: Size in pixels of icon
*
* Returns: (transfer none): A new #ClutterTexture containing an icon for the sequence
*/
ClutterActor *
shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
{
GIcon *themed;
const char *icon_name;
ClutterActor *texture;
gint scale;
ShellGlobal *global;
StThemeContext *context;
global = shell_global_get ();
context = st_theme_context_get_for_stage (shell_global_get_stage (global));
g_object_get (context, "scale-factor", &scale, NULL);
icon_name = sn_startup_sequence_get_icon_name ((SnStartupSequence*)sequence);
if (!icon_name)
{
texture = clutter_texture_new ();
clutter_actor_set_size (texture, size * scale, size * scale);
return texture;
}
themed = g_themed_icon_new (icon_name);
texture = st_texture_cache_load_gicon (st_texture_cache_get_default (),
NULL, themed, size, scale);
g_object_unref (G_OBJECT (themed));
return texture;
}
/**
* shell_window_tracker_get_default:
*

View File

@@ -5,6 +5,7 @@
#include <glib-object.h>
#include <glib.h>
#include <meta/window.h>
#include <meta/meta-startup-notification.h>
#include "shell-app.h"
#include "shell-app-system.h"
@@ -21,22 +22,8 @@ ShellApp *shell_window_tracker_get_window_app (ShellWindowTracker *tracker, Meta
ShellApp *shell_window_tracker_get_app_from_pid (ShellWindowTracker *tracker, int pid);
const char *_shell_window_tracker_get_app_context (ShellWindowTracker *tracker, ShellApp *app);
GSList *shell_window_tracker_get_startup_sequences (ShellWindowTracker *tracker);
/* Hidden typedef for SnStartupSequence */
typedef struct _ShellStartupSequence ShellStartupSequence;
#define SHELL_TYPE_STARTUP_SEQUENCE (shell_startup_sequence_get_type ())
GType shell_startup_sequence_get_type (void);
const char *shell_startup_sequence_get_id (ShellStartupSequence *sequence);
ShellApp *shell_startup_sequence_get_app (ShellStartupSequence *sequence);
const char *shell_startup_sequence_get_name (ShellStartupSequence *sequence);
gboolean shell_startup_sequence_get_completed (ShellStartupSequence *sequence);
int shell_startup_sequence_get_workspace (ShellStartupSequence *sequence);
ClutterActor *shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size);
G_END_DECLS
#endif /* __SHELL_WINDOW_TRACKER_H__ */

View File

@@ -177,15 +177,15 @@ st_bin_get_preferred_height (ClutterActor *self,
}
static void
st_bin_dispose (GObject *gobject)
st_bin_destroy (ClutterActor *actor)
{
StBinPrivate *priv = st_bin_get_instance_private (ST_BIN (gobject));
StBinPrivate *priv = st_bin_get_instance_private (ST_BIN (actor));
if (priv->child)
clutter_actor_destroy (priv->child);
g_assert (priv->child == NULL);
G_OBJECT_CLASS (st_bin_parent_class)->dispose (gobject);
CLUTTER_ACTOR_CLASS (st_bin_parent_class)->destroy (actor);
}
static void
@@ -315,11 +315,11 @@ st_bin_class_init (StBinClass *klass)
gobject_class->set_property = st_bin_set_property;
gobject_class->get_property = st_bin_get_property;
gobject_class->dispose = st_bin_dispose;
actor_class->get_preferred_width = st_bin_get_preferred_width;
actor_class->get_preferred_height = st_bin_get_preferred_height;
actor_class->allocate = st_bin_allocate;
actor_class->destroy = st_bin_destroy;
widget_class->popup_menu = st_bin_popup_menu;
widget_class->navigate_focus = st_bin_navigate_focus;

View File

@@ -282,13 +282,12 @@ st_box_layout_allocate (ClutterActor *actor,
StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (actor)->priv;
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
ClutterLayoutManager *layout = clutter_actor_get_layout_manager (actor);
ClutterActorBox viewport_content_box;
ClutterActorBox content_box;
gfloat avail_width, avail_height, min_width, natural_width, min_height, natural_height;
CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->allocate (actor, box, flags);
st_theme_node_get_content_box (theme_node, box, &content_box);
clutter_actor_box_get_size (&content_box, &avail_width, &avail_height);
st_theme_node_get_content_box (theme_node, box, &viewport_content_box);
clutter_actor_box_get_size (&viewport_content_box, &avail_width, &avail_height);
clutter_layout_manager_get_preferred_width (layout, CLUTTER_CONTAINER (actor),
avail_height,
@@ -297,6 +296,18 @@ st_box_layout_allocate (ClutterActor *actor,
MAX (avail_width, min_width),
&min_height, &natural_height);
/* Because StBoxLayout implements StScrollable, the allocation box passed here
* may not match the minimum sizes reported by the layout manager. When that
* happens, the content box needs to be adjusted to match the reported minimum
* sizes before being passed to clutter_layout_manager_allocate() */
clutter_actor_set_allocation (actor, box, flags);
content_box = viewport_content_box;
content_box.x2 += MAX (0, min_width - avail_width);
content_box.y2 += MAX (0, min_height - avail_height);
clutter_layout_manager_allocate (layout, CLUTTER_CONTAINER (actor),
&content_box, flags);
/* update adjustments for scrolling */
if (priv->vadjustment)

View File

@@ -248,14 +248,17 @@ st_button_touch_event (ClutterActor *actor,
if (event->type == CLUTTER_TOUCH_BEGIN && !priv->press_sequence)
{
clutter_input_device_sequence_grab (device, sequence, actor);
st_button_press (button, device, 0, sequence);
if (!clutter_event_is_pointer_emulated ((ClutterEvent*) event))
st_button_press (button, device, 0, sequence);
return CLUTTER_EVENT_STOP;
}
else if (event->type == CLUTTER_TOUCH_END &&
priv->device == device &&
priv->press_sequence == sequence)
{
st_button_release (button, device, mask, 0, sequence);
if (!clutter_event_is_pointer_emulated ((ClutterEvent*) event))
st_button_release (button, device, mask, 0, sequence);
clutter_input_device_sequence_ungrab (device, sequence);
return CLUTTER_EVENT_STOP;
}

View File

@@ -455,14 +455,13 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
CoglTexture *buffer;
CoglOffscreen *offscreen;
CoglFramebuffer *fb;
CoglContext *ctx;
CoglColor clear_color;
CoglError *catch_error = NULL;
float x, y;
buffer = cogl_texture_new_with_size (width,
height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
buffer = cogl_texture_2d_new_with_size (ctx, width, height);
if (buffer == NULL)
return NULL;

View File

@@ -66,10 +66,10 @@ st_scroll_view_fade_create_texture (ClutterOffscreenEffect *effect,
gfloat min_width,
gfloat min_height)
{
return cogl_texture_new_with_size (min_width,
min_height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
return cogl_texture_2d_new_with_size (ctx, min_width, min_height);
}
static char *

View File

@@ -984,7 +984,7 @@ file_changed_cb (GFileMonitor *monitor,
char *key;
guint file_hash;
if (event_type != G_FILE_MONITOR_EVENT_CHANGED)
if (event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
return;
file_hash = g_file_hash (file);

View File

@@ -229,9 +229,9 @@ unpremultiply (ClutterColor *color)
{
if (color->alpha != 0)
{
color->red = (color->red * 255 + 127) / color->alpha;
color->green = (color->green * 255 + 127) / color->alpha;
color->blue = (color->blue * 255 + 127) / color->alpha;
color->red = MIN((color->red * 255 + 127) / color->alpha, 255);
color->green = MIN((color->green * 255 + 127) / color->alpha, 255);
color->blue = MIN((color->blue * 255 + 127) / color->alpha, 255);
}
}
@@ -1414,6 +1414,32 @@ st_theme_node_load_background_image (StThemeNode *node)
return node->background_texture != COGL_INVALID_HANDLE;
}
static gboolean
st_theme_node_invalidate_resources_for_file (StThemeNode *node,
GFile *file)
{
StBorderImage *border_image;
gboolean changed = FALSE;
GFile *theme_file;
theme_file = st_theme_node_get_background_image (node);
if ((theme_file != NULL) && g_file_equal (theme_file, file))
{
st_theme_node_invalidate_background_image (node);
changed = TRUE;
}
border_image = st_theme_node_get_border_image (node);
theme_file = border_image ? st_border_image_get_file (border_image) : NULL;
if ((theme_file != NULL) && g_file_equal (theme_file, file))
{
st_theme_node_invalidate_border_image (node);
changed = TRUE;
}
return changed;
}
static void st_theme_node_prerender_shadow (StThemeNodePaintState *state);
static void
@@ -2220,12 +2246,15 @@ static void
st_theme_node_prerender_shadow (StThemeNodePaintState *state)
{
StThemeNode *node = state->node;
CoglContext *ctx;
guint border_radius[4];
int max_borders[4];
int center_radius, corner_id;
CoglHandle buffer, offscreen = COGL_INVALID_HANDLE;
CoglError *error = NULL;
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
/* Get infos from the node */
if (state->alloc_width < node->box_shadow_min_width ||
state->alloc_height < node->box_shadow_min_height)
@@ -2261,10 +2290,9 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
}
/* Render offscreen */
buffer = cogl_texture_new_with_size (state->box_shadow_width,
state->box_shadow_height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
buffer = cogl_texture_2d_new_with_size (ctx,
state->box_shadow_width,
state->box_shadow_height);
if (buffer == NULL)
return;
@@ -2751,3 +2779,17 @@ st_theme_node_paint_state_invalidate (StThemeNodePaintState *state)
state->alloc_width = 0;
state->alloc_height = 0;
}
gboolean
st_theme_node_paint_state_invalidate_for_file (StThemeNodePaintState *state,
GFile *file)
{
if (state->node != NULL &&
st_theme_node_invalidate_resources_for_file (state->node, file))
{
st_theme_node_paint_state_invalidate (state);
return TRUE;
}
return FALSE;
}

View File

@@ -240,12 +240,14 @@ setup_framebuffers (StThemeNodeTransition *transition,
const ClutterActorBox *allocation)
{
StThemeNodeTransitionPrivate *priv = transition->priv;
CoglContext *ctx;
guint width, height;
CoglError *catch_error = NULL;
/* template material to avoid unnecessary shader compilation */
static CoglHandle material_template = COGL_INVALID_HANDLE;
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
width = priv->offscreen_box.x2 - priv->offscreen_box.x1;
height = priv->offscreen_box.y2 - priv->offscreen_box.y1;
@@ -254,15 +256,11 @@ setup_framebuffers (StThemeNodeTransition *transition,
if (priv->old_texture)
cogl_handle_unref (priv->old_texture);
priv->old_texture = cogl_texture_new_with_size (width, height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
priv->old_texture = cogl_texture_2d_new_with_size (ctx, width, height);
if (priv->new_texture)
cogl_handle_unref (priv->new_texture);
priv->new_texture = cogl_texture_new_with_size (width, height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
priv->new_texture = cogl_texture_2d_new_with_size (ctx, width, height);
if (priv->old_texture == COGL_INVALID_HANDLE)
return FALSE;

View File

@@ -291,6 +291,9 @@ void st_theme_node_paint_state_free (StThemeNodePaintState *state);
void st_theme_node_paint_state_copy (StThemeNodePaintState *state,
StThemeNodePaintState *other);
void st_theme_node_paint_state_invalidate (StThemeNodePaintState *state);
gboolean st_theme_node_paint_state_invalidate_for_file (StThemeNodePaintState *state,
GFile *file);
void st_theme_node_paint_state_set_node (StThemeNodePaintState *state,
StThemeNode *node);

View File

@@ -289,44 +289,17 @@ st_widget_texture_cache_changed (StTextureCache *cache,
{
StWidget *actor = ST_WIDGET (user_data);
StWidgetPrivate *priv = st_widget_get_instance_private (actor);
StThemeNode *node = priv->theme_node;
StBorderImage *border_image;
gboolean changed = FALSE;
GFile *theme_file;
int i;
if (node == NULL)
return;
theme_file = st_theme_node_get_background_image (node);
if ((theme_file != NULL) && g_file_equal (theme_file, file))
for (i = 0; i < G_N_ELEMENTS (priv->paint_states); i++)
{
st_theme_node_invalidate_background_image (node);
changed = TRUE;
StThemeNodePaintState *paint_state = &priv->paint_states[i];
changed |= st_theme_node_paint_state_invalidate_for_file (paint_state, file);
}
border_image = st_theme_node_get_border_image (node);
theme_file = border_image ? st_border_image_get_file (border_image) : NULL;
if ((theme_file != NULL) && g_file_equal (theme_file, file))
{
st_theme_node_invalidate_border_image (node);
changed = TRUE;
}
if (changed)
{
/* If we prerender the background / border, we need to update
* the paint state. We should probably implement a method to
* the theme node to determine this, but for now, just wipe
* the entire paint state.
*
* Use the existing state instead of a new one because it's
* assumed the rest of the state will stay the same.
*/
st_theme_node_paint_state_invalidate (current_paint_state (actor));
if (clutter_actor_is_mapped (CLUTTER_ACTOR (actor)))
clutter_actor_queue_redraw (CLUTTER_ACTOR (actor));
}
if (changed && clutter_actor_is_mapped (CLUTTER_ACTOR (actor)))
clutter_actor_queue_redraw (CLUTTER_ACTOR (actor));
}
static void

View File

@@ -32,26 +32,22 @@ const BOX_WIDTHS = [
const SPACING = 10;
function FlowedBoxes() {
this._init();
}
var FlowedBoxes = new Lang.Class({
Name: 'FlowedBoxes',
Extends: St.Widget,
FlowedBoxes.prototype = {
_init() {
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.parent();
for (let i = 0; i < BOX_WIDTHS.length; i++) {
let child = new St.Bin({ width: BOX_WIDTHS[i], height: BOX_HEIGHT,
style: 'border: 1px solid #444444; background: #00aa44' })
this.actor.add_actor(child);
this.add_actor(child);
}
},
_getPreferredWidth(actor, forHeight, alloc) {
let children = this.actor.get_children();
vfunc_get_preferred_width(forHeight) {
let children = this.get_children();
let maxMinWidth = 0;
let totalNaturalWidth = 0;
@@ -65,12 +61,11 @@ FlowedBoxes.prototype = {
totalNaturalWidth += naturalWidth;
}
alloc.min_size = maxMinWidth;
alloc.natural_size = totalNaturalWidth;
return [maxMinWidth, totalNaturalWidth];
},
_layoutChildren(forWidth, callback) {
let children = this.actor.get_children();
let children = this.get_children();
let x = 0;
let y = 0;
@@ -99,24 +94,26 @@ FlowedBoxes.prototype = {
},
_getPreferredHeight(actor, forWidth, alloc) {
vfunc_get_preferred_height(forWidth) {
let height = 0;
this._layoutChildren(forWidth,
function(child, x1, y1, x2, y2) {
height = Math.max(height, y2);
});
alloc.min_size = alloc.natural_size = height;
return [height, height];
},
_allocate(actor, box, flags) {
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
this._layoutChildren(box.x2 - box.x1,
function(child, x1, y1, x2, y2) {
child.allocate(new Clutter.ActorBox({ x1: x1, y1: y1, x2: x2, y2: y2 }),
flags);
});
}
};
});
/****************************************************************************/
@@ -127,39 +124,34 @@ FlowedBoxes.prototype = {
//
// This is currently only written for the case where the child is height-for-width
function SizingIllustrator() {
this._init();
}
var SizingIllustrator = new Lang.Class({
Name: 'SizingIllustrator',
Extends: St.Widget,
SizingIllustrator.prototype = {
_init() {
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
this.actor.connect('allocate', this._allocate.bind(this));
this.parent();
this.minWidthLine = new St.Bin({ style: 'background: red' });
this.actor.add_actor(this.minWidthLine);
this.add_actor(this.minWidthLine);
this.minHeightLine = new St.Bin({ style: 'background: red' });
this.actor.add_actor(this.minHeightLine);
this.add_actor(this.minHeightLine);
this.naturalWidthLine = new St.Bin({ style: 'background: #4444ff' });
this.actor.add_actor(this.naturalWidthLine);
this.add_actor(this.naturalWidthLine);
this.naturalHeightLine = new St.Bin({ style: 'background: #4444ff' });
this.actor.add_actor(this.naturalHeightLine);
this.add_actor(this.naturalHeightLine);
this.currentWidthLine = new St.Bin({ style: 'background: #aaaaaa' });
this.actor.add_actor(this.currentWidthLine);
this.add_actor(this.currentWidthLine);
this.currentHeightLine = new St.Bin({ style: 'background: #aaaaaa' });
this.actor.add_actor(this.currentHeightLine);
this.add_actor(this.currentHeightLine);
this.handle = new St.Bin({ style: 'background: yellow; border: 1px solid black;',
reactive: true });
this.handle.connect('button-press-event', this._handlePressed.bind(this));
this.handle.connect('button-release-event', this._handleReleased.bind(this));
this.handle.connect('motion-event', this._handleMotion.bind(this));
this.actor.add_actor(this.handle);
this.add_actor(this.handle);
this._inDrag = false;
@@ -168,13 +160,13 @@ SizingIllustrator.prototype = {
},
add(child) {
this.child = child;
this.actor.add_actor(this.child);
this.child.lower_bottom();
this.child = child;
this.add_child(child);
this.child.lower_bottom();
},
_getPreferredWidth(actor, forHeight, alloc) {
let children = this.actor.get_children();
vfunc_get_preferred_width(forHeight) {
let children = this.get_children();
for (let i = 0; i < children.length; i++) {
let child = children[i];
let [minWidth, naturalWidth] = child.get_preferred_width(-1);
@@ -184,27 +176,28 @@ SizingIllustrator.prototype = {
}
}
alloc.min_size = 0;
alloc.natural_size = 400;
return [0, 400];
},
_getPreferredHeight(actor, forWidth, alloc) {
let children = this.actor.get_children();
vfunc_get_preferred_height(forWidth) {
let children = this.get_children();
for (let i = 0; i < children.length; i++) {
let child = children[i];
if (child == this.child) {
[this.minHeight, this.naturalHeight] = child.get_preferred_height(this.width);
} else {
let [minWidth, naturalWidth] = child.get_preferred_width(-1);
child.get_preferred_height(naturalWidth);
let [minWidth, naturalWidth] = child.get_preferred_height(naturalWidth);
}
}
alloc.min_size = 0;
alloc.natural_size = 400;
return [0, 400];
},
_allocate(actor, box, flags) {
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
box = this.get_theme_node().get_content_box(box);
let allocWidth = box.x2 - box.x1;
let allocHeight = box.y2 - box.y1;
@@ -244,13 +237,13 @@ SizingIllustrator.prototype = {
_handleMotion(handle, event) {
if (this._inDrag) {
let [x, y] = event.get_coords();
let [actorX, actorY] = this.actor.get_transformed_position();
let [actorX, actorY] = this.get_transformed_position();
this.width = x - this._dragX - actorX;
this.height = y - this._dragY - actorY;
this.actor.queue_relayout();
this.queue_relayout();
}
}
};
});
/****************************************************************************/
@@ -278,7 +271,7 @@ function test() {
mainBox.add(bin, { x_fill: true, y_fill: true, expand: true });
let illustrator = new SizingIllustrator();
bin.add_actor(illustrator.actor);
bin.add_actor(illustrator);
let scrollView = new St.ScrollView();
illustrator.add(scrollView);
@@ -287,7 +280,7 @@ function test() {
scrollView.add_actor(box);
let flowedBoxes = new FlowedBoxes();
box.add(flowedBoxes.actor, { expand: false, x_fill: true, y_fill: true });
box.add(flowedBoxes, { expand: false, x_fill: true, y_fill: true });
let policyBox = new St.BoxLayout({ vertical: false });
mainBox.add(policyBox);