Browse Source

Fixed slop from returning the wrong window ID in certain situations.

Dalton Nell 10 years ago
parent
commit
1d53e9f23a
6 changed files with 15 additions and 4 deletions
  1. 1
    1
      README.md
  2. 1
    1
      cmdline.h
  3. 3
    1
      main.cpp
  4. 1
    1
      options.ggo
  5. 7
    0
      x.cpp
  6. 2
    0
      x.hpp

+ 1
- 1
README.md View File

67
 help
67
 help
68
 ----
68
 ----
69
 ```text
69
 ```text
70
-slop v3.1.4
70
+slop v3.1.5
71
 
71
 
72
 Copyright (C) 2014 Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors)
72
 Copyright (C) 2014 Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors)
73
 
73
 

+ 1
- 1
cmdline.h View File

31
 
31
 
32
 #ifndef CMDLINE_PARSER_VERSION
32
 #ifndef CMDLINE_PARSER_VERSION
33
 /** @brief the program version */
33
 /** @brief the program version */
34
-#define CMDLINE_PARSER_VERSION "v3.1.4"
34
+#define CMDLINE_PARSER_VERSION "v3.1.5"
35
 #endif
35
 #endif
36
 
36
 
37
 /** @brief Where the command line options are stored */
37
 /** @brief Where the command line options are stored */

+ 3
- 1
main.cpp View File

213
                     } else {
213
                     } else {
214
                         selection->setGeo( t.m_x, t.m_y, t.m_x + t.m_width, t.m_y + t.m_height );
214
                         selection->setGeo( t.m_x, t.m_y, t.m_x + t.m_width, t.m_y + t.m_height );
215
                     }
215
                     }
216
-                    window = xengine->m_hoverWindow;
216
+                    //window = xengine->m_hoverWindow;
217
+                    // Since WindowRectangle can select different windows depending on click location...
218
+                    window = t.getWindow();
217
                 }
219
                 }
218
                 // If the user clicked we move on to the next state.
220
                 // If the user clicked we move on to the next state.
219
                 if ( xengine->mouseDown( 1 ) ) {
221
                 if ( xengine->mouseDown( 1 ) ) {

+ 1
- 1
options.ggo View File

1
 package "slop"
1
 package "slop"
2
-version "v3.1.4"
2
+version "v3.1.5"
3
 usage "slop [options]"
3
 usage "slop [options]"
4
 description "slop (Select Operation) is an application that queries for a selection from the user and prints the region to stdout."
4
 description "slop (Select Operation) is an application that queries for a selection from the user and prints the region to stdout."
5
 versiontext "Copyright (C) 2014 Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors)"
5
 versiontext "Copyright (C) 2014 Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors)"

+ 7
- 0
x.cpp View File

288
     }
288
     }
289
 }
289
 }
290
 
290
 
291
+Window slop::WindowRectangle::getWindow() {
292
+    return m_window;
293
+}
294
+
291
 void slop::WindowRectangle::applyMinMaxSize( int minimumsize, int maximumsize ) {
295
 void slop::WindowRectangle::applyMinMaxSize( int minimumsize, int maximumsize ) {
292
     if ( minimumsize > maximumsize && maximumsize > 0 ) {
296
     if ( minimumsize > maximumsize && maximumsize > 0 ) {
293
         fprintf( stderr, "Error: minimumsize is greater than maximumsize.\n" );
297
         fprintf( stderr, "Error: minimumsize is greater than maximumsize.\n" );
337
             status = XQueryTree( xengine->m_display, test, &root, &parent, &childlist, &ujunk);
341
             status = XQueryTree( xengine->m_display, test, &root, &parent, &childlist, &ujunk);
338
             free( childlist );
342
             free( childlist );
339
         }
343
         }
344
+        // test contains the window we're screenshotting.
345
+        m_window = test;
340
         // Once found, proceed normally.
346
         // Once found, proceed normally.
341
         if ( test && parent == root && status ) {
347
         if ( test && parent == root && status ) {
342
             XWindowAttributes attr;
348
             XWindowAttributes attr;
362
     m_height = attr.height;
368
     m_height = attr.height;
363
     m_border = attr.border_width;
369
     m_border = attr.border_width;
364
     XTranslateCoordinates( xengine->m_display, win, attr.root, -attr.border_width, -attr.border_width, &(m_x), &(m_y), &junk );
370
     XTranslateCoordinates( xengine->m_display, win, attr.root, -attr.border_width, -attr.border_width, &(m_x), &(m_y), &junk );
371
+    m_window = win;
365
 }
372
 }

+ 2
- 0
x.hpp View File

56
     unsigned int m_width;
56
     unsigned int m_width;
57
     unsigned int m_height;
57
     unsigned int m_height;
58
     unsigned int m_border;
58
     unsigned int m_border;
59
+    Window       m_window;
59
     bool         m_decorations;
60
     bool         m_decorations;
61
+    Window       getWindow();
60
     void         setGeometry( Window win, bool decorations );
62
     void         setGeometry( Window win, bool decorations );
61
     void         applyPadding( int padding );
63
     void         applyPadding( int padding );
62
     void         applyMinMaxSize( int minimumsize, int maximumsize );
64
     void         applyMinMaxSize( int minimumsize, int maximumsize );