Browse Source

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

naelstrof 9 years ago
parent
commit
0d5a32bba4
4 changed files with 15 additions and 9 deletions
  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 View File

3
 project( "slop" )
3
 project( "slop" )
4
 set( slop_VERSION_MAJOR 4 )
4
 set( slop_VERSION_MAJOR 4 )
5
 set( slop_VERSION_MINOR 2 )
5
 set( slop_VERSION_MINOR 2 )
6
-set( slop_VERSION_PATCH 19 )
6
+set( slop_VERSION_PATCH 20 )
7
 
7
 
8
 set( CMAKE_OPENGL_SUPPORT FALSE CACHE BOOL "Whether or not to compile with OpenGL, shaders, magnification, and theming support." )
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 View File

115
 help
115
 help
116
 ----
116
 ----
117
 ```text
117
 ```text
118
-slop v4.2.19
118
+slop v4.2.20
119
 
119
 
120
 Copyright (C) 2014 Dalton Nell, Slop Contributors
120
 Copyright (C) 2014 Dalton Nell, Slop Contributors
121
 (https://github.com/naelstrof/slop/graphs/contributors)
121
 (https://github.com/naelstrof/slop/graphs/contributors)

+ 11
- 0
src/glselectrectangle.cpp View File

214
 void slop::GLSelectRectangle::generateMagnifyingGlass() {
214
 void slop::GLSelectRectangle::generateMagnifyingGlass() {
215
     int x = xengine->m_mousex-m_glassPixels/2;
215
     int x = xengine->m_mousex-m_glassPixels/2;
216
     int y = xengine->m_mousey-m_glassPixels/2;
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
     int w = m_glassPixels;
228
     int w = m_glassPixels;
218
     int h = m_glassPixels;
229
     int h = m_glassPixels;
219
     constrainWithinMonitor( &x, &y, &w, &h );
230
     constrainWithinMonitor( &x, &y, &w, &h );

+ 2
- 7
src/main.cpp View File

54
 }
54
 }
55
 
55
 
56
 int printSelection( std::string format, bool cancelled, int x, int y, int w, int h, int window ) {
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
     size_t pos = 0;
57
     size_t pos = 0;
63
     while ( ( pos = format.find( "%", pos ) ) != std::string::npos ) {
58
     while ( ( pos = format.find( "%", pos ) ) != std::string::npos ) {
64
         if ( pos + 1 > format.size() ) {
59
         if ( pos + 1 > format.size() ) {
292
     cmdline_parser_free( &options );
287
     cmdline_parser_free( &options );
293
 #ifndef OPENGL_ENABLED
288
 #ifndef OPENGL_ENABLED
294
     if ( opengl || themeon || magenabled ) {
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
 #else // OPENGL_ENABLED
292
 #else // OPENGL_ENABLED
298
     if ( ( themeon || magenabled || shadergiven ) && !opengl ) {
293
     if ( ( themeon || magenabled || shadergiven ) && !opengl ) {
511
                 int sx, sy, ex, ey;
506
                 int sx, sy, ex, ey;
512
                 constrain( cx, cy, xengine->m_mousex, xengine->m_mousey, padding, minimumsize, maximumsize, &sx, &sy, &ex, &ey );
507
                 constrain( cx, cy, xengine->m_mousex, xengine->m_mousey, padding, minimumsize, maximumsize, &sx, &sy, &ex, &ey );
513
                 // Set the selection rectangle's dimensions to mouse movement.
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
                 selection->update( deltatime );
510
                 selection->update( deltatime );
516
                 break;
511
                 break;
517
             }
512
             }