From d8cafdbc6da78c188986fe70b5abd2368e297d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Vinicius=20Semprebom=20Gon=C3=A7alves?= <lucass.semprebom@gmail.com> Date: Thu, 24 Apr 2014 13:50:05 -0300 Subject: [PATCH] le-proinfodata: Fix #1591 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lucas Vinicius Semprebom Gonçalves <lucass.semprebom@gmail.com> --- le-proinfodata/package/DEBIAN/control | 2 +- le-proinfodata/package/DEBIAN/postinst | 11 ++- .../package/usr/local/bin/exec_dialog.sh | 78 ++++++++++++++----- 3 files changed, 69 insertions(+), 22 deletions(-) diff --git a/le-proinfodata/package/DEBIAN/control b/le-proinfodata/package/DEBIAN/control index 55805527..9336c925 100644 --- a/le-proinfodata/package/DEBIAN/control +++ b/le-proinfodata/package/DEBIAN/control @@ -1,5 +1,5 @@ Package: le-proinfodata -Version: 1.2.38 +Version: 1.2.39 Maintainer: <proinfodata@c3sl.ufpr.br> Architecture: i386 Section: main diff --git a/le-proinfodata/package/DEBIAN/postinst b/le-proinfodata/package/DEBIAN/postinst index b6a64e69..b939f36c 100755 --- a/le-proinfodata/package/DEBIAN/postinst +++ b/le-proinfodata/package/DEBIAN/postinst @@ -53,11 +53,16 @@ fi # Set lightdm to open the le-proinfodata configuration script when user # session starts -if ! grep -q "session.*exec_dialog.sh" "/etc/lightdm/lightdm.conf"; then - sed -i '/\[SeatDefaults\]/ a\session-setup-script=/usr/local/bin/exec_dialog.sh' \ +if [[ ! -d $MULTISEAT_DIR ]]; then + if ! grep -q "session.*exec_dialog.sh" "/etc/lightdm/lightdm.conf"; then + sed -i '/\[SeatDefaults\]/ a\session-setup-script=/usr/local/bin/exec_dialog.sh' \ + /etc/lightdm/lightdm.conf + fi +else + sed -i '\,session-setup-script=/usr/local/bin/exec_dialog.sh,d' \ /etc/lightdm/lightdm.conf fi - + # We will no longer need this files, but as the postrm would only remove the # diverts when this package were removed, we have to do it here DIVERTS=" diff --git a/le-proinfodata/package/usr/local/bin/exec_dialog.sh b/le-proinfodata/package/usr/local/bin/exec_dialog.sh index 374d1c91..1fc48219 100755 --- a/le-proinfodata/package/usr/local/bin/exec_dialog.sh +++ b/le-proinfodata/package/usr/local/bin/exec_dialog.sh @@ -25,25 +25,48 @@ BACKGROUND="/usr/share/backgrounds/le5-wallpaper1600X1200.png" LE_EDUBAR_POS="/usr/share/gnome/autostart/le-edubar_position.sh" function enable_mouse () { + # Enable mouse right-click and left-click xmodmap -e "pointer = default" - xmodmap -e "keycode 64 = Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L" } function disable_mouse () { - xmodmap -e "pointer = 1 2 32 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3" + if [[ -z "$1" ]]; then + # Disable mouse right-click + xmodmap -e "pointer = 1 2 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32" + xmodmap -e "keycode 64 = " + else + # Disable mouse right-click and left-click + xmodmap -e "pointer = 0 2 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32" + xmodmap -e "keycode 64 = " + fi +} + +function disable_keyboard () { + # Disable keyboard control-button and alt-button + xmodmap -e "remove Control = Control_L" xmodmap -e "keycode 64 = " } +function enable_keyboard () { + # Enable keyboard control-button and alt-button + xmodmap -e "add Control = Control_L" + xmodmap -e "keycode 64 = Alt_L Meta_L Alt_L Meta_L Alt_L Meta_L" +} + function call_dialog_inep_mult_off () { - #Disable mouse right-click + # Disable mouse right-click disable_mouse - #Set background + # Disable keyboard control-button and alt-button + disable_keyboard + # Set background xli -onroot -fillscreen $BACKGROUND dialog_inep.sh - #Reset background to default + # Reset background to default xli -onroot -background black - #Enable mouse right-click + # Enable mouse right-click enable_mouse + # Enable keyboard control-button and alt-button + enable_keyboard } # Disable user interaction with gnome panel @@ -88,12 +111,31 @@ function call_dialog_inep_mult_on () { # Disable user interaction disable_mouse disable_gnome - + # Disable keyboard control-button and alt-button + disable_keyboard + # Start Inep Dialog dialog_inep.sh - # Enable user interaction enable_gnome enable_mouse + enable_keyboard +} + +function warning_dialog_inep_on () { + # Disable user interaction + # Disable mouse right-click and left-click + disable_mouse "all" + # Disable keyboard control-button and alt-button + disable_keyboard + # Warning other INEP setting + while [ ! -e $F_LOCK ]; do + echo wait + sleep 1 + done | zenity --progress --pulsate --no-cancel --auto-close --title="INEP" \ + --text="Aguarde a configuração do PROINFODATA" + # Enable user interaction + enable_keyboard + enable_mouse } export LANG="pt_BR.UTF-8" @@ -111,18 +153,18 @@ fi # Check whether the computer is running on a the multiterminal if dpkg --get-selections "le-multiterminal" | grep -q 'install$'; then # In the first call (lightdm) in multiterminal this is script must leave, to be called again after. - if [ -f $F_MULT ];then - touch $F_LOCK - echo "0" > $F_LOCK - call_dialog_inep_mult_on - else - touch $F_MULT - exit 0 - fi + ( + flock -n 200 + if [ $? != "0" ]; then + warning_dialog_inep_on + else + call_dialog_inep_mult_on + touch $F_LOCK + fi + ) 200>$F_MULT else - touch $F_LOCK - echo "1" > $F_LOCK call_dialog_inep_mult_off + touch $F_LOCK fi exit 0 -- GitLab