Bug 313612 - [wish] 'switch/toggle screen' action button
Summary: [wish] 'switch/toggle screen' action button
Status: RESOLVED FIXED
Alias: None
Product: wacomtablet
Classification: Plasma
Component: general (show other bugs)
Version: 1.3
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Jörg Ehrichs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-21 10:55 UTC by David REVOY
Modified: 2013-09-04 10:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
photo of my setup, 01-2013 : ( on left, a 1920x1200 monitor ) ( on right, a Cintiq 21UX serie 1 , 1600x1200 ) (208.56 KB, image/jpeg)
2013-01-21 10:55 UTC, David REVOY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David REVOY 2013-01-21 10:55:26 UTC
Created attachment 76593 [details]
photo of my setup, 01-2013 :  ( on left, a 1920x1200 monitor )  ( on right, a Cintiq 21UX serie 1 , 1600x1200 )

=== the wish ===

Hi, this is request for user with dual-screen ( or even more screen in the setup ) to assign a tablet button action to switch/toggle screen. On the old xsetwacom time when I worked on the open movie Sintel, a togglescreen was existing. 

* Action was toggling like this
screen 1 > screen 2 > both screen > screen 1 > screen 2 > both screen ...etc....

* But I'm also fine with :
screen 1 > screen 2 > screen 1 > screen 2 > screen 1 > screen 2 > ...etc...  

If one of the screen involved is a Cintiq tablet , it's also wanted to keep the calibration for this screen.

=== workaround ===
- Uninstall kde-config-tablet. Unconnect the non Cintiq screen. Run system in Cintiq only.
- I use : xinput_calibrator --device "Wacom Cintiq 21UX stylus"
- calibrate and get from terminal : calibration data: 327, 86436, 374, 65171
- then I can convert it into xsetwacom area stuff : xsetwacom set "Wacom Cintiq 21UX stylus" Area 327 374 86436 65171
- I reconnect the second monitor, and resetup the twinview ( I use nvidia proprio driver ) 
- then in my xsetwacom : xsetwacom set "Wacom Cintiq 21UX stylus" MapToOutput "HEAD-0"
- to switch now, I made a toggle action with a file as a token in bash :

ex: 
# twinview mapping
# toggle action, depend on script's calls
TOGGLE=$HOME/.wacomtoggle

if [ ! -e $TOGGLE ]; then
    touch $TOGGLE
		# then it's the Cintiq
		xsetwacom set "$STYLUS" MapToOutput "HEAD-0"
		xsetwacom set "$ERASER" MapToOutput "HEAD-0"
		xsetwacom set "$PAD" MapToOutput "HEAD-0"
		# user feedback
		notify-send 'Cintiq tablet' 'mapped on HEAD-0' --icon=dialog-information
else
    rm $TOGGLE
		# else it's the external screen
		xsetwacom set "$STYLUS" MapToOutput "HEAD-1"
		xsetwacom set "$ERASER" MapToOutput "HEAD-1"
		xsetwacom set "$PAD" MapToOutput "HEAD-1"
		# user feedback
		notify-send 'Asus screen' 'mapped on HEAD-1' --icon=dialog-information
fi


Note 1 : I've made a detailed article ( old ) about it here : http://www.davidrevoy.com/?article95/linux-mint-11-install-notes   , and one recent about using the GUI here : http://www.davidrevoy.com/article155/linux-mint-14-kde-for-painters

Note 2 : I use certainly a old depreciated version of kde-config-tablet ( 1.3.6 from Linux Mint KDE packages ) , sorry if the feature exist in more recent version. Is there a way to compile/update the module only ? In case yes, how to procede ? thx in advance.
Comment 1 Jörg Ehrichs 2013-01-21 12:54:26 UTC
I did not know 
MapToOutput "HEAD-0"
MapToOutput "HEAD-1"

can be used to toggle between screens.
I remember I tried something with screen toggle a long while ago but it always seems buggy (or maybe I was just doing it wrong)

I'll have a look at this and find a way to implement it when I have a bit more time.
Might take a while.

To get the latest sources from git you can do these steps:
git clone git://anongit.kde.org/wacomtablet
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=release
make
make install
Comment 2 David REVOY 2013-01-22 17:33:41 UTC
Thanks for the reply, and thanks for hearing my request. 
About MapToOutput "HEAD-0" and MapToOutput "HEAD-1" , yes, I think they are made only for Nvidia hardware with proprietary drivers. 

Note about compilation : I spent the afternoon in a Virtualbox Mint install to try to compile it without damaging my main system ( with extra + guest addition to have tablet input USB support ).  I failed, and I guess mainly because of I couldn't find a working install prefix.  kde4-config --prefix wasn't found, and so, fallback to default /usr/share/local  ; as I'm a beginner in compilation, I'm not surprise of the result : the daemon doesn't start , and all the installed stuff sound like non-installed. But no problem ; I'll wait Kubuntu backport package   :)
Comment 3 Jörg Ehrichs 2013-01-22 18:34:16 UTC
Git commit df37aac516f7b054ec304c00d10088d0e465b6ed by Jörg Ehrichs.
Committed on 22/01/2013 at 19:23.
Pushed by jehrichs into branch 'master'.

Support global shortcuts to switch screen mapping + TabletArea

The screen selected screen the user wants to use can now be switched
via shortcuts between "All screens"/"Screen 1"/"Screen 2"

Also the used TabletArea calibration can be set individually between
the selected screen mapping and will change accordingly. If the screen
is toggled the stylus/eraser will be set to Absolte mode automatically.

For the implementation the ScreenMapping property is now depricated
Instead the ScreenSpace can have the values
 * full
 * map0
 * map1
 * x y w h (for part of the screen mapping)

In full/map0/map1 mode the actually screen size as reported by qt will be
used automatically without looking into the config.
Whenever the screen mapping is changed the values are saved in the config
to be remembered for the next reconnect.

Also the Area value will be changed as copied from the
 * AreaMapFull
 * AreaMapPart
 * AreaMap0
 * AreaMap1

properties that store the tablet calibration configuration for each
screen mapping.
DIGEST: This patch makes working with multiple monitors a lot better

M  +4    -1    src/common/deviceproperty.cpp
M  +4    -1    src/common/deviceproperty.h
M  +4    -1    src/common/property.cpp
M  +5    -2    src/common/property.h
M  +20   -0    src/kcmodule/generalwidget.cpp
M  +186  -85   src/kcmodule/padmapping.cpp
M  +12   -5    src/kcmodule/padmapping.h
M  +11   -32   src/kcmodule/padmapping.ui
M  +0    -3    src/kcmodule/profilemanagement.cpp
M  +5    -0    src/kcmodule/tabletarea.cpp
M  +20   -0    src/kded/tabletdaemon.cpp
M  +184  -0    src/kded/tablethandler.cpp
M  +40   -0    src/kded/tablethandler.h
M  +61   -15   src/kded/xinputadaptor.cpp
M  +0    -2    src/kded/xsetwacomadaptor.cpp
M  +0    -6    tests/kded/testtablethandler.profilesrc

http://commits.kde.org/wacomtablet/df37aac516f7b054ec304c00d10088d0e465b6ed
Comment 4 Jörg Ehrichs 2013-01-22 18:39:44 UTC
(In reply to comment #2)
> Thanks for the reply, and thanks for hearing my request. 
> About MapToOutput "HEAD-0" and MapToOutput "HEAD-1" , yes, I think they are
> made only for Nvidia hardware with proprietary drivers. 

Luckily I implemented the MapToOutput part on my own a while ago (based on the xsetwacom implementation)
Your request was thus quite easily to implement and also fixed a few things.

> 
> Note about compilation : I spent the afternoon in a Virtualbox Mint install
> to try to compile it without damaging my main system ( with extra + guest
> addition to have tablet input USB support ).  I failed, and I guess mainly
> because of I couldn't find a working install prefix.  kde4-config --prefix
> wasn't found, and so, fallback to default /usr/share/local  ; as I'm a
> beginner in compilation, I'm not surprise of the result : the daemon doesn't
> start , and all the installed stuff sound like non-installed. But no problem
> ; I'll wait Kubuntu backport package   :)

thats a surprise. there are many dependencies to get this thing installed, but that you will miss kde4-config was never something I would have guessed.

on my kubuntu box kde4-config outputs just /usr.

Try
cmake ../ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=release

and after installation
kquitapp kde
and
kded4

to restart the deamon.
I'm not sure when the next update will be available in the backports.
I'm currently fixing/changing any bugs/wishes I can find and than get the next (and last) RC for the new 2.0 release out.
Comment 5 David REVOY 2013-01-28 18:05:28 UTC
Thanks for the answers.
I could make a successful install on a V.Box system :
http://wstaw.org/m/2013/01/28/wacom-tools.jpg

I'll try soon to make the same on my main system , to see how it behaves with :
- toggle display
- and calibration ( one Cintiq )
Comment 6 Jörg Ehrichs 2013-01-28 23:08:55 UTC
(In reply to comment #5)
> - toggle display
> - and calibration ( one Cintiq )

You might need to change the global shortcut keys from META+XXX to something else.
The Metakey is currently broken more or less (will be fixed soon too)
Comment 7 David REVOY 2013-09-04 10:48:17 UTC
Hi Jörg , a late feedback to let you know I started only to use the part of code you made on workstation based on 'buntu 13.04 , thanks to this PPA :
sudo add-apt-repository ppa:maret/wacom
sudo apt-get update
sudo apt-get upgrade
all work as expected for the switch screen with nvidia 3.10 gfx + Intuos 3 A4 size. 
I didn't made test with the Cintiq21ux I have who is now connected on 'standalone' PC. I must test if this one will keep the calibration when coming back to embed screen. But it will be a later test, because this configuration still run a very old version of KDE. 
Thanks again  ! ( and nice simplification of the GUI for buttons and mapping )