Parcourir la source

Fixed another off-by-one bug, and a typo.

naelstrof il y a 9 ans
Parent
révision
0d5a32bba4
4 fichiers modifiés avec 15 ajouts et 9 suppressions
  1. 1
    1
      CMakeLists.txt
  2. 1
    1
      README.md
  3. 11
    0
      src/glselectrectangle.cpp
  4. 2
    7
      src/main.cpp

+ 1
- 1
CMakeLists.txt Voir le fichier

@@ -3,7 +3,7 @@ cmake_minimum_required( VERSION 2.8 )
3 3
 project( "slop" )
4 4
 set( slop_VERSION_MAJOR 4 )
5 5
 set( slop_VERSION_MINOR 2 )
6
-set( slop_VERSION_PATCH 19 )
6
+set( slop_VERSION_PATCH 20 )
7 7
 
8 8
 set( CMAKE_OPENGL_SUPPORT FALSE CACHE BOOL "Whether or not to compile with OpenGL, shaders, magnification, and theming support." )
9 9
 

+ 1
- 1
README.md Voir le fichier

@@ -115,7 +115,7 @@ Feel free to make your own themes and submit a pull request to see if it can be
115 115
 help
116 116
 ----
117 117
 ```text
118
-slop v4.2.19
118
+slop v4.2.20
119 119
 
120 120
 Copyright (C) 2014 Dalton Nell, Slop Contributors
121 121
 (https://github.com/naelstrof/slop/graphs/contributors)

+ 11
- 0
src/glselectrectangle.cpp Voir le fichier

@@ -214,6 +214,17 @@ void slop::GLSelectRectangle::findOptimalGlassPosition() {
214 214
 void slop::GLSelectRectangle::generateMagnifyingGlass() {
215 215
     int x = xengine->m_mousex-m_glassPixels/2;
216 216
     int y = xengine->m_mousey-m_glassPixels/2;
217
+    bool fx = xengine->m_mousex < m_x+m_width/2;
218
+    bool fy = xengine->m_mousey < m_y+m_height/2;
219
+    // Mouse behavior SUCKS
220
+    if ( !fx && !fy ) {
221
+        x += 1;
222
+        y += 1;
223
+    } else if ( fx && !fy ) {
224
+        y += 1;
225
+    } else if ( !fx && fy ) {
226
+        x += 1;
227
+    }
217 228
     int w = m_glassPixels;
218 229
     int h = m_glassPixels;
219 230
     constrainWithinMonitor( &x, &y, &w, &h );

+ 2
- 7
src/main.cpp Voir le fichier

@@ -54,11 +54,6 @@ void current_utc_time(struct timespec *ts) {
54 54
 }
55 55
 
56 56
 int printSelection( std::string format, bool cancelled, int x, int y, int w, int h, int window ) {
57
-    //Impossible to select nothing
58
-    if (!cancelled) {
59
-        w += 1;
60
-        h += 1;
61
-    }
62 57
     size_t pos = 0;
63 58
     while ( ( pos = format.find( "%", pos ) ) != std::string::npos ) {
64 59
         if ( pos + 1 > format.size() ) {
@@ -292,7 +287,7 @@ int app( int argc, char** argv ) {
292 287
     cmdline_parser_free( &options );
293 288
 #ifndef OPENGL_ENABLED
294 289
     if ( opengl || themeon || magenabled ) {
295
-        throw std::runtime_error( "Slop wasn't compiled with OpenGL support, so themes, magnifications, and shaders are disabled! Try compiling it with the CMAKE_OPENGL_ENABLED set to true." );
290
+        throw std::runtime_error( "Slop wasn't compiled with OpenGL support, so themes, magnifications, and shaders are disabled! Try compiling it with the CMAKE_OPENGL_SUPPORT set to true." );
296 291
     }
297 292
 #else // OPENGL_ENABLED
298 293
     if ( ( themeon || magenabled || shadergiven ) && !opengl ) {
@@ -511,7 +506,7 @@ int app( int argc, char** argv ) {
511 506
                 int sx, sy, ex, ey;
512 507
                 constrain( cx, cy, xengine->m_mousex, xengine->m_mousey, padding, minimumsize, maximumsize, &sx, &sy, &ex, &ey );
513 508
                 // Set the selection rectangle's dimensions to mouse movement.
514
-                selection->setGeo( sx + xoffset, sy + yoffset, ex-1, ey-1 );
509
+                selection->setGeo( sx + xoffset, sy + yoffset, ex, ey );
515 510
                 selection->update( deltatime );
516 511
                 break;
517 512
             }