Hello community,

here is the log from the commit of package slop for openSUSE:Factory checked in 
at 2020-08-18 15:11:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/slop (Old)
 and      /work/SRC/openSUSE:Factory/.slop.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "slop"

Tue Aug 18 15:11:38 2020 rev:5 rq:827257 version:7.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/slop/slop.changes        2018-11-08 
09:50:50.804932919 +0100
+++ /work/SRC/openSUSE:Factory/.slop.new.3399/slop.changes      2020-08-18 
15:11:49.936060076 +0200
@@ -1,0 +2,7 @@
+Sun Aug 16 11:40:43 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 7.5:
+  * Added --nodrag option
+  * Selections can be moved by holding the space-bar mid-drag!
+
+-------------------------------------------------------------------

Old:
----
  slop-7.4.tar.gz

New:
----
  slop-7.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ slop.spec ++++++
--- /var/tmp/diff_new_pack.53TAR8/_old  2020-08-18 15:11:50.736060407 +0200
+++ /var/tmp/diff_new_pack.53TAR8/_new  2020-08-18 15:11:50.736060407 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package slop
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,13 +18,13 @@
 
 # See also http://en.opensuse.org/openSUSE:Specfile_guidelines
 Name:           slop
-%define lname  libslopy7_4
-Version:        7.4
+%define lname  libslopy7_5
+Version:        7.5
 Release:        0
 Summary:        Tool to query for a screen region selection
 License:        GPL-3.0-or-later
 Group:          Productivity/Graphics/Other
-Url:            https://github.com/naelstrof/slop
+URL:            https://github.com/naelstrof/slop
 Source0:        
https://github.com/naelstrof/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  gcc-c++
@@ -77,8 +77,8 @@
 %postun -n %{lname} -p /sbin/ldconfig
 
 %files
-%defattr(-,root,root,-)
-%doc COPYING README.md
+%license COPYING
+%doc README.md
 %{_bindir}/%{name}
 %{_mandir}/man1/*.1*
 

++++++ slop-7.4.tar.gz -> slop-7.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/.gitignore new/slop-7.5/.gitignore
--- old/slop-7.4/.gitignore     2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/.gitignore     2020-04-10 23:16:07.000000000 +0200
@@ -4,3 +4,6 @@
 bin/
 cmake_install.cmake
 libslopy.so
+.vscode
+libslopy.so*
+install_manifest.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/CMakeLists.txt new/slop-7.5/CMakeLists.txt
--- old/slop-7.4/CMakeLists.txt 2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/CMakeLists.txt 2020-04-10 23:16:07.000000000 +0200
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.1.3)
 
-project(slop VERSION 7.4 LANGUAGES CXX)
+project(slop VERSION 7.5 LANGUAGES CXX)
 
 set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or 
Release)")
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/README.md new/slop-7.5/README.md
--- old/slop-7.4/README.md      2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/README.md      2020-04-10 23:16:07.000000000 +0200
@@ -13,9 +13,10 @@
     * Set the color of the selection rectangles to match your theme! (Even 
supports transparency!)
     * Remove window decorations from selections.
 * Supports custom programmable shaders.
+* Move started selection by holding down the space bar.
 
 ## Practical Applications
-slop can be used to create a video recording script in only two lines of code.
+slop can be used to create a video recording script in only three lines of 
code.
 ```bash
 #!/bin/bash
 slop=$(slop -f "%x %y %w %h %g %i") || exit 1
@@ -48,12 +49,16 @@
 * [Arch Linux: 
community/slop](https://www.archlinux.org/packages/community/x86_64/slop/)
 * [Void Linux: 
slop](https://github.com/voidlinux/void-packages/blob/24ac22af44018e2598047e5ef7fd3522efa79db5/srcpkgs/slop/template)
 * [FreeBSD: x11/slop](http://www.freshports.org/x11/slop/)
+* [NetBSD: x11/slop](http://pkgsrc.se/x11/slop)
 * [OpenBSD: graphics/slop](http://openports.se/graphics/slop)
 * [CRUX: 6c37/slop](https://github.com/6c37/crux-ports/tree/3.2/slop)
 * [Gentoo: x11-misc/slop](https://packages.gentoo.org/packages/x11-misc/slop)
+* [NixOS: 
slop](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/slop/default.nix)
 * [GNU Guix: slop](https://www.gnu.org/software/guix/packages/#slop)
 * [Debian: slop](https://packages.debian.org/sid/slop)
-* [Fedora COPR: 
amahdal/slop](https://copr.fedorainfracloud.org/coprs/amahdal/slop/) 
(experimental!)
+* [Fedora: slop](https://src.fedoraproject.org/rpms/slop)
+* [Ravenports: 
slop](http://www.ravenports.com/catalog/bucket_CB/slop/standard/)
+* [Alpine Linux: 
testing/slop](https://pkgs.alpinelinux.org/package/edge/testing/x86_64/slop)
 * Please make a package for slop on your favorite system, and make a pull 
request to add it to this list.
 
 ### Install using CMake (Requires CMake)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/slop.1 new/slop-7.5/slop.1
--- old/slop-7.4/slop.1 2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/slop.1 2020-04-10 23:16:07.000000000 +0200
@@ -42,6 +42,9 @@
 .BR \-l ", " \-\-highlight
 Instead of outlining a selection, slop will highlight it instead. This is 
particularly useful if the color is set to an opacity lower than 1.
 .TP
+.BR \-D ", " \-\-nodrag
+Allows you to click twice to indicate a selection, rather than click-dragging.
+.TP
 .BR \-q ", " \-\-quiet
 Disable any unnecessary cerr output. Any warnings simply won't print.
 .TP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/keyboard.cpp 
new/slop-7.5/src/keyboard.cpp
--- old/slop-7.4/src/keyboard.cpp       2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/keyboard.cpp       2020-04-10 23:16:07.000000000 +0200
@@ -35,6 +35,9 @@
     keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
     keycode = XKeysymToKeycode( x11->display, XK_Down );
     keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
+    // Also deleting Space for move operation
+    keycode = XKeysymToKeycode( x11->display, XK_space );
+    keys[ keycode / 8 ] = keys[ keycode / 8 ] & ~( 1 << ( keycode % 8 ) );
     keyDown = false;
     for ( int i=0;i<32;i++ ) {
         if ( deltaState[i] == keys[i] ) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/keyboard.hpp 
new/slop-7.5/src/keyboard.hpp
--- old/slop-7.4/src/keyboard.hpp       2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/keyboard.hpp       2020-04-10 23:16:07.000000000 +0200
@@ -22,6 +22,7 @@
 #define N_KEYBOARD_H_
 
 #define XK_MISCELLANY
+#define XK_LATIN1 // for XK_space
 #include <X11/keysymdef.h>
 
 #include "x.hpp"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/main.cpp new/slop-7.5/src/main.cpp
--- old/slop-7.4/src/main.cpp   2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/main.cpp   2020-04-10 23:16:07.000000000 +0200
@@ -96,6 +96,9 @@
     if ( options.count( "highlight" ) > 0 ) {
         foo->highlight = options["highlight"].as<bool>();
     }
+    if ( options.count( "nodrag" ) > 0 ) {
+        foo->nodrag = options["nodrag"].as<bool>();
+    }
     if ( options.count( "quiet" ) > 0 ) {
         foo->quiet = options["quiet"].as<bool>();
     }
@@ -170,6 +173,8 @@
     std::cout << "                                  Alternatively setting it 
to 999999 would.\n";
     std::cout << "                                  only allow for window 
selections.\n";
     std::cout << "                                  (default=`2')\n";
+    std::cout << "  -D, --nodrag                  Select region with two 
clicks instead of\n";
+    std::cout << "                                  click and drag\n";
     std::cout << "  -c, --color=FLOAT,FLOAT,FLOAT,FLOAT\n";
     std::cout << "                                Set the selection 
rectangle's color. Supports\n";
     std::cout << "                                  RGB or RGBA values.\n";
@@ -182,6 +187,8 @@
     std::cout << "                                  Supplying slop with just 
`-n` is\n";
     std::cout << "                                  equivalent to supplying 
`-n1`.\n";
     std::cout << "                                  (default=`0')\n";
+    std::cout << "  -D, --nodrag                         Allows you to click 
twice to indicate a \n";
+    std::cout << "                                  selection, rather than 
click-dragging.\n";
     std::cout << "  -q, --quiet                   Disable any unnecessary cerr 
output. Any\n";
     std::cout << "                                  warnings simply won't 
print.\n";
     std::cout << "  -l, --highlight               Instead of outlining 
selections, slop\n";
@@ -217,6 +224,7 @@
     std::cout << "Tips\n";
     std::cout << "    * If you don't like a selection: you can cancel it by 
right-clicking\n";
     std::cout << "regardless of which options are enabled or disabled for 
slop.\n";
+    std::cout << "    * You can move the selection by holding down the space 
bar!\n";
     std::cout << "    * If slop doesn't seem to select a window accurately, 
the problem could be\n";
     std::cout << "because of decorations getting in the way. Try enabling the 
--nodecorations\n";
     std::cout << "flag.\n";
@@ -232,6 +240,7 @@
     ("b,bordersize", "Sets the selection rectangle's thickness.", 
cxxopts::value<float>())
     ("p,padding", "Sets the padding size for the selection, this can be 
negative.", cxxopts::value<float>())
     ("t,tolerance", "How far in pixels the mouse can move after clicking, and 
still be detected as a normal click instead of a click-and-drag. Setting this 
to 0 will disable window selections. Alternatively setting it to 9999999 would 
force a window selection.", cxxopts::value<float>())
+    ("D,nodrag", "Select region with two clicks instead of click and drag")
     ("c,color", "Sets  the  selection  rectangle's  color.  Supports  RGB or 
RGBA input. Depending on the system's window manager/OpenGL  support, the 
opacity may be ignored.", cxxopts::value<std::string>())
     ("r,shader", "This  sets  the  vertex shader, and fragment shader combo to 
use when drawing the final framebuffer to the screen. This obviously only  
works  when OpenGL is enabled. The shaders are loaded from ~/.config/maim. See 
https://github.com/naelstrof/slop for more information on how to create your 
own shaders.", cxxopts::value<std::string>())
     ("n,nodecorations", "Sets the level of aggressiveness when trying to 
remove window decorations. `0' is off, `1' will try lightly to remove 
decorations, and `2' will recursively descend into the root tree until it gets 
the deepest available visible child under the mouse. Defaults to `0'.", 
cxxopts::value<int>()->implicit_value("1"))
@@ -279,12 +288,13 @@
 
     // Finally we do the real selection.
     selection = SlopSelect(parsedOptions);
-    
+
+    bool quiet = parsedOptions->quiet;
     // Here we're done with the parsed option data.
     delete parsedOptions;
     // We know if we cancelled or not
     if ( selection.cancelled ) {
-        if ( !parsedOptions->quiet ) {
+        if ( !quiet ) {
             std::cerr << "Selection was cancelled by keystroke or 
right-click.\n";
         }
         return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/resource.cpp 
new/slop-7.5/src/resource.cpp
--- old/slop-7.4/src/resource.cpp       2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/resource.cpp       2020-04-10 23:16:07.000000000 +0200
@@ -34,7 +34,10 @@
     usrconfig += "/slop/";
 }
 
-std::string slop::Resource::getRealPath( std::string localpath ) {
+std::string slop::Resource::getRealPath( const std::string& localpath ) {
+    if (localpath[0] == '/' && validatePath(dirname(localpath))) {
+        return localpath;
+    }
     if ( validatePath( usrconfig + localpath ) ) {
         return usrconfig + localpath;
     }
@@ -43,7 +46,12 @@
     return localpath;
 }
 
-bool slop::Resource::validatePath( std::string path ) {
+std::string slop::Resource::dirname(const std::string& localpath) {
+    size_t i = localpath.find_last_of("/");
+    return (i != std::string::npos ? localpath.substr(0, i) : localpath);
+}
+
+bool slop::Resource::validatePath( const std::string& path ) {
     struct stat st;
     const char* dirname = path.c_str();
     if ( stat( dirname, &st ) != 0 ) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/resource.hpp 
new/slop-7.5/src/resource.hpp
--- old/slop-7.4/src/resource.hpp       2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/resource.hpp       2020-04-10 23:16:07.000000000 +0200
@@ -38,9 +38,10 @@
 class Resource {
 public:
     Resource();
-    std::string getRealPath( std::string localpath );
+    std::string getRealPath( const std::string& localpath );
 private:
-    bool validatePath( std::string path );
+    std::string dirname(const std::string& localpath);
+    bool validatePath( const std::string& path );
     std::string usrconfig;
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/slop.cpp new/slop-7.5/src/slop.cpp
--- old/slop-7.4/src/slop.cpp   2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/slop.cpp   2020-04-10 23:16:07.000000000 +0200
@@ -70,6 +70,7 @@
     border = 1;
     nokeyboard = false;
     noopengl = false;
+    nodrag = false;
     nodecorations = false;
     tolerance = 2;
     padding = 0;
@@ -124,7 +125,7 @@
             window = new SlopWindow();
             if (!GLEW_VERSION_3_0) {
                 delete window;
-                throw std::runtime_error( "OpenGL version is not high enough, 
slop requires OpenGL 3.0!\nOpenGL accelleration is disabled. Use -o or -q to 
suppress this message." );
+                throw std::runtime_error( "OpenGL version is not high enough, 
slop requires OpenGL 3.0!\nOpenGL acceleration is disabled. Use -o or -q to 
suppress this message." );
             }
             success = true;
         } catch( std::exception& e ) {
@@ -134,7 +135,7 @@
             success = false;
         }
     } else {
-        errorstring += "Failed to detect a compositor, OpenGL 
hardware-accelleration disabled...\n";
+        errorstring += "Failed to detect a compositor, OpenGL 
hardware-acceleration disabled...\n";
     }
     if ( !success ) {
         // If we fail, we launch the XShape version of slop.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/slop.hpp new/slop-7.5/src/slop.hpp
--- old/slop-7.4/src/slop.hpp   2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/slop.hpp   2020-04-10 23:16:07.000000000 +0200
@@ -63,6 +63,7 @@
     float border;
     float padding;
     float tolerance;
+    bool nodrag;
     bool highlight;
     bool noopengl;
     bool nokeyboard;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/slopstates.cpp 
new/slop-7.5/src/slopstates.cpp
--- old/slop-7.4/src/slopstates.cpp     2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/slopstates.cpp     2020-04-10 23:16:07.000000000 +0200
@@ -3,10 +3,12 @@
 using namespace slop;
 
 slop::SlopMemory::SlopMemory( SlopOptions* options, Rectangle* rect ) {
+    up = false;
     running = true;
     state = (SlopState*)new SlopStart();
     nextState = NULL;
     tolerance = options->tolerance;
+    nodrag = options->nodrag;
     nodecorations = options->nodecorations;
     rectangle = rect;
     selectedWindow = x11->root;
@@ -43,7 +45,6 @@
     state->draw( *this, matrix );
 }
 
-
 slop::SlopState::~SlopState() {
 }
 void slop::SlopState::onEnter( SlopMemory& memory ) {
@@ -53,29 +54,33 @@
 void slop::SlopState::update( SlopMemory& memory, double dt ) {
 }
 void slop::SlopState::draw( SlopMemory& memory, glm::mat4 matrix ) {
+    memory.rectangle->draw( matrix );
 }
-
 void slop::SlopStart::onEnter( SlopMemory& memory ) {
     setStartPos = false;
 }
 void slop::SlopStart::update( SlopMemory& memory, double dt ) {
     if ( mouse->getButton( 1 ) && !setStartPos ) {
-        startPos = mouse->getMousePos();
+        startPoint = mouse->getMousePos();
         setStartPos = true;
     }
-    if ( setStartPos && glm::distance( startPos, mouse->getMousePos() ) >= 
memory.tolerance ) {
-        memory.setState( (SlopState*)new SlopStartDrag( startPos ) );
+    if ( setStartPos && glm::distance( startPoint, mouse->getMousePos() ) >= 
memory.tolerance ) {
+        memory.setState( (SlopState*)new SlopStartDrag( startPoint ) );
     }
     if ( mouse->hoverWindow != None ) {
         glm::vec4 rect = getWindowGeometry( mouse->hoverWindow, 
memory.nodecorations );
         memory.rectangle->setPoints( glm::vec2( (float)rect.x, (float)rect.y 
), glm::vec2( (float)rect.x+rect.z, (float)rect.y+rect.w ) );
     }
-    if ( setStartPos && !mouse->getButton( 1 ) ) {
+    if ( (setStartPos && !mouse->getButton( 1 ) && !memory.nodrag) ||
+         (setStartPos && memory.nodrag && memory.up && mouse->getButton( 1 ) )
+       ) {
         memory.selectedWindow = mouse->hoverWindow;
         memory.setState( (SlopState*)new SlopEndDrag() );
     }
+    if ( setStartPos && memory.nodrag && !mouse->getButton( 1 )) {
+        memory.up = true;
+    }
 }
-
 void slop::SlopStart::draw( SlopMemory& memory, glm::mat4 matrix ) {
     if ( memory.tolerance > 0 ) {
         memory.rectangle->draw( matrix );
@@ -85,35 +90,48 @@
 slop::SlopStartDrag::SlopStartDrag( glm::vec2 point ) {
     startPoint = point;
 }
-
 void slop::SlopStartDrag::onEnter( SlopMemory& memory ) {
-    memory.rectangle->setPoints(startPoint, startPoint);
+    // redundant because it happens in upate() anyway
+    //compensation comp = determineCompensation();
+    //setPoints( memory, comp );
 }
-
 void slop::SlopStartDrag::update( SlopMemory& memory, double dt ) {
+    if ( memory.nodrag && !memory.up && !mouse->getButton( 1 ) ) {
+        memory.up = true;
+    }
+    if ( memory.nodrag && memory.up && mouse->getButton( 1 ) ) {
+        memory.setState( (SlopState*)new SlopEndDrag() );
+    }
+
+    // Determine which cursor to use
     char a = startPoint.y > mouse->getMousePos().y;
     char b = startPoint.x > mouse->getMousePos().x;
     char c = (a << 1) | b;
-    int xm = (mouse->getMousePos().x == 0 || mouse->getMousePos().x == 
WidthOfScreen(x11->screen)-1);
-    int ym = (mouse->getMousePos().y == 0 || mouse->getMousePos().y == 
HeightOfScreen(x11->screen)-1);
     switch ( c ) {
         case 0: mouse->setCursor( XC_lr_angle );
-                memory.rectangle->setPoints(startPoint+glm::vec2(0,0), 
mouse->getMousePos()+glm::vec2(1*xm,1*ym));
                 break;
         case 1: mouse->setCursor( XC_ll_angle );
-                memory.rectangle->setPoints(startPoint+glm::vec2(0,0), 
mouse->getMousePos()+glm::vec2(1*xm,1*ym));
                 break;
         case 2: mouse->setCursor( XC_ur_angle );
-                memory.rectangle->setPoints(startPoint+glm::vec2(0,1*ym), 
mouse->getMousePos()+glm::vec2(1*xm,0));
                 break;
         case 3: mouse->setCursor( XC_ul_angle );
-                memory.rectangle->setPoints(startPoint+glm::vec2(1*xm,1*ym), 
mouse->getMousePos()+glm::vec2(0,0));
                 break;
     }
-    if ( !mouse->getButton( 1 ) ) {
+    // Compensate for edges of screen, depending on the mouse position in 
relation to the start point.
+    int lx = mouse->getMousePos().x < startPoint.x;
+    int ly = mouse->getMousePos().y < startPoint.y;
+    memory.rectangle->setPoints(startPoint+glm::vec2(1*lx,1*ly), 
mouse->getMousePos()+glm::vec2(1*(!lx), 1*(!ly)));
+
+    if ( !memory.nodrag && !mouse->getButton( 1 ) ) {
         memory.setState( (SlopState*)new SlopEndDrag() );
+        return;
     }
+
     if ( keyboard ) {
+        if ( keyboard->getKey(XK_space) ) {
+            memory.setState( (SlopState*)new SlopStartMove( startPoint, 
mouse->getMousePos() ) );
+            return;
+        }
         int arrows[2];
         arrows[0] = keyboard->getKey(XK_Down)-keyboard->getKey(XK_Up);
         arrows[1] = keyboard->getKey(XK_Right)-keyboard->getKey(XK_Left);
@@ -133,10 +151,40 @@
     }
 }
 
-void slop::SlopStartDrag::draw( SlopMemory& memory, glm::mat4 matrix ) {
-    memory.rectangle->draw( matrix );
-}
-
 void slop::SlopEndDrag::onEnter( SlopMemory& memory ) {
     memory.running = false;
 }
+
+slop::SlopStartMove::SlopStartMove( glm::vec2 oldPoint, glm::vec2 newPoint ) {
+    // oldPoint is where drag was started and newPoint where move was
+    startPoint = oldPoint;
+    // This vector is the diagonal of the rectangle
+    // it will be used to move the startPoint along with mousePos
+    diagonal = newPoint - oldPoint;
+}
+void slop::SlopStartMove::onEnter( SlopMemory& memory ) {
+    // redundant because of update()
+    //compensation comp = determineCompensation();
+    //setPoints( memory, comp );
+
+    mouse->setCursor( XC_fleur );
+}
+void slop::SlopStartMove::update( SlopMemory& memory, double dt ) {
+    // Unclear why it has to be - and not +
+    startPoint = mouse->getMousePos() - diagonal;
+
+    int lx = mouse->getMousePos().x < startPoint.x;
+    int ly = mouse->getMousePos().y < startPoint.y;
+    memory.rectangle->setPoints(startPoint+glm::vec2(1*lx,1*ly), 
mouse->getMousePos()+glm::vec2(1*(!lx), 1*(!ly)));
+
+    // space or mouse1 released, return to drag
+    // if mouse1 is released then drag will end also
+    if ( !keyboard->getKey(XK_space) or !mouse->getButton( 1 ) ) {
+        // clip rectangle on edges of screen.
+        startPoint.x = glm::min((int)startPoint.x, WidthOfScreen(x11->screen));
+        startPoint.x = glm::max((int)startPoint.x, 0);
+        startPoint.y = glm::min((int)startPoint.y, 
HeightOfScreen(x11->screen));
+        startPoint.y = glm::max((int)startPoint.y, 0);
+        memory.setState( (SlopState*) new SlopStartDrag(startPoint) );
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/slop-7.4/src/slopstates.hpp 
new/slop-7.5/src/slopstates.hpp
--- old/slop-7.4/src/slopstates.hpp     2018-04-23 09:56:02.000000000 +0200
+++ new/slop-7.5/src/slopstates.hpp     2020-04-10 23:16:07.000000000 +0200
@@ -33,18 +33,19 @@
 class SlopOptions;
 
 class SlopState {
+protected:
+    glm::vec2 startPoint;
 public:
-    virtual ~SlopState();
     virtual void onEnter( SlopMemory& memory );
     virtual void onExit( SlopMemory& memory );
     virtual void update( SlopMemory& memory, double dt );
     virtual void draw( SlopMemory& memory, glm::mat4 matrix );
+    virtual ~SlopState();
 };
 
 class SlopStart : SlopState {
 private:
     bool setStartPos;
-    glm::vec2 startPos;
 public:
     virtual void onEnter( SlopMemory& memory );
     virtual void update( SlopMemory& memory, double dt );
@@ -53,14 +54,12 @@
 
 class SlopStartDrag : SlopState {
 private:
-    glm::vec2 startPoint;
     float repeatTimer;
     float multiplier;
 public:
     SlopStartDrag( glm::vec2 point );
     virtual void onEnter( SlopMemory& memory );
     virtual void update( SlopMemory& memory, double dt );
-    virtual void draw( SlopMemory& memory, glm::mat4 matrix );
 };
 
 class SlopEndDrag : SlopState {
@@ -68,6 +67,15 @@
     virtual void onEnter( SlopMemory& memory );
 };
 
+class SlopStartMove : SlopState {
+private:
+    glm::vec2 diagonal;
+public:
+    SlopStartMove( glm::vec2 oldPoint, glm::vec2 newPoint );
+    virtual void onEnter( SlopMemory& memory );
+    virtual void update( SlopMemory& memory, double dt );
+};
+
 class SlopMemory {
 private:
     SlopState* state;
@@ -79,6 +87,8 @@
     bool running;
     float tolerance;
     bool nodecorations;
+    bool nodrag;
+    bool up;
     Rectangle* rectangle;
     void setState( SlopState* state );
     void update( double dt );


Reply via email to