Commit graph

169 commits

Author SHA1 Message Date
Pino Toscano
c3f9889c83 i18n: typo fix 2013-03-04 10:34:16 +01:00
Martin Gräßlin
898e120be9 Extract messages from scripts and scripting module
Messages in scripts are written to kwin_scripts.pot, messages in
scripting are written to kwin_scripting.pot. The cataloges are loaded in
the configuration interfaces and in main kwin.

REVIEW: 108975
2013-03-04 10:29:25 +01:00
Martin Gräßlin
650c606e95 Provide config interface for scripted effects and KWin scripts
A scripted component providing:
* ui/config.ui
* config/main.xml

can get a config interface by using the following in metadata.desktop:
X-KDE-ServiceTypes=KWin/Effect,KCModule
X-KDE-PluginKeyword=`X-KDE-PluginInfo-Name`
X-KDE-Library=kcm_kwin4_genericscripted
X-KDE-ParentComponents=`X-KDE-PluginInfo-Name`

`X-KDE-PluginInfo-Name` has to be replaced by the actual value. In case
of a KWin Script the X-KDE-ServiceTypes needs to be:
X-KDE-ServiceTypes=KWin/Script,KCModule

The GenericScriptedConfig tries to identify the package from the keyword
and creates a Plasma::ConfigLoader and loads the UI from the packaged UI
file.
2013-03-04 10:29:24 +01:00
Martin Gräßlin
d9d9aad674 Use Plasma::ConfigLoader to read config values in scripted effects
Advantage is that the default value is no longer needed and scripted
effects are anyway supposed to add a kconfigxt file.
2013-03-04 10:29:24 +01:00
Martin Gräßlin
25bb1482e3 Adding NOTIFY signals to desktopGrid(Size/Width/Height)
Since the introduction of VirtualDesktopManager we do have a signal
emitted when the desktop layout changes which we can use as NOTIFY for
the desktopGrid properties.

REVIEW: 108953
2013-02-18 09:19:46 +01:00
Martin Gräßlin
3389d68c50 Print useful information for a Client in scripting
Reusing the debug information already specified for QDebug.

FEATURE: 314402
FIXED-IN: 4.11
REVIEW: 108959
2013-02-18 09:16:31 +01:00
Martin Gräßlin
8205adcac3 Export Toplevel to KWin::Scripts
Without the scripting system is not able to handle signals defined on
Toplevel instead of Client.

REVIEW: 108807
2013-02-14 08:16:19 +01:00
Martin Gräßlin
a8539ff54e Turn ScreenEdges into a Singleton
In fact it already used to be a Singleton as there is just one object
hold by the Singleton Workspace. So let's make it a proper Singleton
following our kind of standard approach of having a ::create factory
method called from Workspace ctor and a ::self to get to the singleton
instance.
2013-02-07 09:46:52 +01:00
Martin Gräßlin
7a7f9d1a34 Change the way how screen edges interact with Effects/Scripts
The main difference is that the activation of an edge is no longer
broadcasted to all effects and scripts, but instead a passed in slot of
the Effect/Script is invoked.

For this the EffectsHandler API is changed to take the Effect as an
argument to (un)reserveElectricBorder. As callback slot the existing
borderActivated is used.

In addition the ScreenEdge monitors the object for beeing destroyed and
unregisters the the edge automatically. This removes the need from the
Effect to call unregister in the dtor.

BUG: 309695
FIXED-IN: 4.11
2013-02-07 09:46:52 +01:00
Martin Gräßlin
d9aedf620b Rewrite of KWin's Screen Edge Handling
This rewrite is mostly motivated by the need to handle multi screen
setups correctly. That is have edges per screen and not for the combined
geometry. Also porting from XLib to XCB has been a motivation for the
rewrite.

The design of the new ScreenEdge handling is described in the
documentation of ScreenEdges in screenedge.h.

In addition the following changes have been performed:
* move configuration from Options to ScreenEdge
* add screen edge information to Workspace::supportInformation (obviously
  replaces what had been read from Options)
* have Workspace hold a pointer to ScreenEdges instead of an object
* forward declaration of ScreenEdges in workspaces.h, this explains the
  seemingly unrelated changes of just another include in some files

BUG: 290887
FIXED-IN: 4.11
2013-02-07 09:46:52 +01:00
Marco Martin
baf21f6b34 Merge branch 'KDE/4.10'
Conflicts:
	plasma/generic/applets/batterymonitor/metadata.desktop
	plasma/generic/applets/lock_logout/metadata.desktop
2013-01-31 17:00:02 +01:00
Script Kiddy
f193c56957 SVN_SILENT made messages (.desktop file) 2013-01-31 16:31:28 +01:00
Script Kiddy
ca2cf4d697 SVN_SILENT made messages (.desktop file) 2013-01-31 12:00:36 +01:00
Script Kiddy
1416c8d62c SVN_SILENT made messages (.desktop file) 2013-01-30 16:27:26 +01:00
Marco Martin
240dd25d8d Merge branch 'KDE/4.10'
Conflicts:
	plasma/generic/applets/lock_logout/metadata.desktop
2013-01-22 13:20:13 +01:00
Script Kiddy
589ed300d1 SVN_SILENT made messages (.desktop file) 2013-01-17 12:53:52 +01:00
Martin Gräßlin
debb71285f Support arrays in callDBus method of KWin Scripting
Thanks to Jan Palus for providing the patch.

BUG: 311896
FIXED-IN: 4.10
2013-01-17 09:30:09 +01:00
Script Kiddy
8154d50dec SVN_SILENT made messages (.desktop file) 2013-01-17 08:15:16 +01:00
Martin Gräßlin
0168e8f2c1 Add documentation for global KWin object in KWin scripting 2013-01-11 18:12:25 +01:00
Albert Astals Cid
dec63fb987 Merge remote-tracking branch 'origin/KDE/4.10' 2013-01-07 11:04:39 +01:00
Martin Gräßlin
334b4bf622 Move handling of Virtual Desktops into a VirtualDesktopManager
The ownership for virtual desktops is moved from Workspace into a new
VirtualDesktopManager. The manager is responsible for providing the count
of virtual desktops and keeping track of the currently used virtual
desktop.

All methods related to moving between desktops are also moved from
Workspace to the new manager, though all methods related to Clients on
Virtual Desktops remain in Workspace for the time being. This is to have
the new manager as independent from KWin core as possible.

An rather important change for the handling of virtual desktops is that
the count and the id of a desktop is now an unsinged integer instead of
an integer. The reason for that is that we cannot have a negative count
of desktops as well as it is not possible to be on a desktop with a
negative identifier.

In that regard it is important to remember that a Client can be on a
desktop with a negative identifier. The special value for a Client being
on all desktops is handled by using -1 as a desktop. For the time being
this is not adjusted but instead of comparing the virtual desktop ids one
should prefer to use the convenient methods like isOnDesktop and
isOnAllDesktops. This would allow in future to internally change the
representation for on all desktops.
2013-01-07 09:47:51 +01:00
Script Kiddy
c6d91ac7eb SVN_SILENT made messages (.desktop file) 2013-01-07 08:11:48 +01:00
Martin Gräßlin
533d57da60 Mark most ctors as explicit as reported by Krazy2 checker 2013-01-02 18:35:46 +01:00
Script Kiddy
12f341712c SVN_SILENT made messages (.desktop file) 2012-12-24 09:05:36 +01:00
Script Kiddy
d7316b9fcb SVN_SILENT made messages (.desktop file) 2012-12-23 08:01:50 +01:00
Script Kiddy
dc5da9b081 SVN_SILENT made messages (.desktop file) 2012-12-22 08:12:14 +01:00
Script Kiddy
ef0cae8dab SVN_SILENT made messages (.desktop file) 2012-12-18 15:28:22 +01:00
Script Kiddy
dda5cbea69 SVN_SILENT made messages (.desktop file) 2012-12-13 07:29:15 +01:00
Script Kiddy
49a373b681 SVN_SILENT made messages (.desktop file) 2012-12-01 08:03:43 +01:00
Script Kiddy
5fc8da9ad7 SVN_SILENT made messages (.desktop file) 2012-11-30 07:40:50 +01:00
Script Kiddy
313b1833bc SVN_SILENT made messages (.desktop file) 2012-11-25 07:01:07 +01:00
Martin Gräßlin
85d2f1cb61 Export QEasingCurve to scripted Effects
That allows reference QEasingCurve::Type to be used in the animate
functions.

REVIEW: 107265
2012-11-24 10:19:59 +01:00
Martin Gräßlin
7ad25b663e Adding more declarative way to animate a window in JavaScript
The current API call to animate a window does not feel very JavaScripty.
Therefore a new method "animate" is added to the global scope, which
takes a JavaScript object of the following structure:

{
    window: EffectWindow, /* the window to animate, required */
    duration: int, /* duration in msec, required */
    curve: QEasingCurve.Type, /* global easing curve, optional */
    type: Effect.Attribute, /* for first animation, optional */
    from: FPx2, /* for first animation, optional */
    to: FPx2, /* for first animation, optional */
    delay: int, /* for first animation, optional */
    animations: [ /* additional animations, optional */
        {
        curve: QEasingCurve.Type, /* overrides global */
        type: Effect.Attribute,
        from: FPx2,
        to: FPx2,
        delay: int
        }
    ]
}

At least one animation needs to be specified either on the root level
or in the array of animations. Curve is the only property on root level
which is used in the animations, if not provided.

REVIEW: 107079
2012-11-09 08:05:02 +01:00
Martin Gräßlin
550ac7d2b0 Documentation for global methods and properties of scripted effects
Using Doxygen xml structure which can be converted to MediaWiki using
the xslt from git repo scratch/graesslin/kwin-scripting-api-generator.git
2012-10-28 10:06:00 +01:00
Martin Gräßlin
62dd1d57f0 Fix documentation error for global KWin script method
SVN_SILENT
2012-10-28 09:50:34 +01:00
Script Kiddy
2141dc821b SVN_SILENT made messages (.desktop file) 2012-10-16 18:43:37 +02:00
Script Kiddy
5b5f20581a SVN_SILENT made messages (.desktop file) 2012-09-24 11:20:52 +02:00
Reza Shah
211fdfde4a Merge branch 'KDE/4.9'
Conflicts:
	kcontrol/access/kcmaccess.desktop
	kcontrol/autostart/autostart.desktop
	kcontrol/colors/colors.desktop
	kcontrol/dateandtime/clock.desktop
	kcontrol/desktoppaths/desktoppath.desktop
	kcontrol/fonts/fonts.desktop
	kcontrol/hardware/joystick/joystick.desktop
	kcontrol/keys/keys.desktop
2012-09-23 20:06:44 +09:00
Script Kiddy
a916d99ada SVN_SILENT made messages (.desktop file) 2012-09-22 17:37:32 +02:00
Thomas Lübking
24cf0e75f3 Merge branch 'KDE/4.9'
Conflicts:
	kwin/scene.cpp
	plasma/generic/applets/batterymonitor/metadata.desktop
	plasma/generic/applets/lock_logout/metadata.desktop
2012-09-19 20:21:18 +02:00
Thomas Lübking
cb265d96fc Sync script loading, KConfGroup is not thread safe
REVIEW: 106377
BUG: 305361
FIXED-IN: 4.9.2
2012-09-19 20:16:34 +02:00
Martin Gräßlin
3aee94d798 Merge branch 'KDE/4.9'
Conflicts:
	ksysguard/gui/ksysguard.desktop
	kwin/effects/translucency/translucency.cpp
2012-09-07 07:59:10 +02:00
Martin Gräßlin
2764565f9d Allow Scripts to add menus to the UserActionsMenu
A script can register a callback through registerUserActionsMenu to be
informed when the UserActionsMenu is about to be shown. This menu calls
the Scripting component to gather actions to add to a Scripts submenu.

The Scripting component now asks all scripts for the actions, which will
invoke the registered callbacks with the Client for which the menu is to
be shown as argument.

The callback is supposed to return a JSON structure describing how the
menu should look like. The returned object can either be a menu item or
a complete menu. If multiple menu items or menus are supposed to be added
by the script it should just register multiple callbacks.

The structure for an item looks like the following:
{
    text: "My caption",
    checkable: true,
    checked: false,
    triggered: function (action) {
       print("The triggered action as parameter");
    }
}

The structure for a complete menu looks quite similar:
{
    text: "My menu caption",
    items: [
         {...}, {...} // items as described above
    ]
}

The C++ part of the script parses the returned object and generates
either QAction or QMenu from it. All objects become children of the
scripts QMenu provided by the UserActionsMenu.

Before the menu is shown again the existing menu is deleted to ensure
that no outdated values from no longer existing scripts are around. This
means the scripts are queried each time the menu is shown.

FEATURE: 303756
FIXED-IN: 4.10
REVIEW: 106285
2012-09-07 07:32:00 +02:00
Martin Gräßlin
b92557a0af Return displayHeight for property displayHeight and not displayWidth
Typo in the scripting bindings.

BUG: 306225
FIXED-IN: 4.9.2
2012-09-04 06:26:39 +02:00
Script Kiddy
61d565885a SVN_SILENT made messages (.desktop file) 2012-08-11 12:40:05 +02:00
Script Kiddy
9c40152c03 SVN_SILENT made messages (.desktop file) 2012-08-10 17:29:15 +02:00
Thomas Lübking
498783c66b move KServiceTypeTrader::query() to main thread
KConfigGroup is not the least thread safe and unfortunately
the KServiceTypeTrader::self()->query() will in doubt create
one if the sycoca database was damaged.

BUG: 303713
REVIEW: 105608
(cherry picked from commit e3edcbcf66b324febcc2014ca4c1fbfa383d8972)
2012-07-21 19:59:36 +02:00
Script Kiddy
b909bdc5c4 SVN_SILENT made messages (.desktop file) 2012-07-21 11:43:56 +02:00
Script Kiddy
88710b0f60 SVN_SILENT made messages (.desktop file) 2012-07-19 10:14:19 +02:00
Guy Maurel
dcf33ff419 missing include
Cherry-Picked from cb90b1e6a1125d41b55a7a608b1d917f84306070
BUG: 303630
FIXED-IN: 4.9.0
REVIEW: 105522
2012-07-19 07:11:45 +02:00