Browse Source

made output work with the 'eval' command by default

naelstrof 11 years ago
parent
commit
7a77bd4a2c
2 changed files with 25 additions and 22 deletions
  1. 19
    19
      main.cpp
  2. 6
    3
      x.cpp

+ 19
- 19
main.cpp View File

99
     while ( running ) {
99
     while ( running ) {
100
         xengine->tick();
100
         xengine->tick();
101
         if ( xengine->mouseDown( 3 ) ) {
101
         if ( xengine->mouseDown( 3 ) ) {
102
-            printf( "X: 0\n" );
103
-            printf( "Y: 0\n" );
104
-            printf( "W: 0\n" );
105
-            printf( "H: 0\n" );
102
+            printf( "X=0\n" );
103
+            printf( "Y=0\n" );
104
+            printf( "W=0\n" );
105
+            printf( "H=0\n" );
106
             printf( "User right-clicked. Canceled selection.\n" );
106
             printf( "User right-clicked. Canceled selection.\n" );
107
             state = -1;
107
             state = -1;
108
             running = false;
108
             running = false;
117
                         xengine->removeRect( windowselection );
117
                         xengine->removeRect( windowselection );
118
                     }
118
                     }
119
                     is::WindowRectangle t = xengine->m_hoverWindow;
119
                     is::WindowRectangle t = xengine->m_hoverWindow;
120
-                    windowselection = new is::Rectangle( t.m_x - padding - t.m_border,
121
-                                                         t.m_y - padding - t.m_border,
122
-                                                         t.m_width + padding*2 + t.m_border,
123
-                                                         t.m_height + padding*2 + t.m_border,
124
-                                                         borderSize, 0 );
120
+                    windowselection = new is::Rectangle( t.m_x - t.m_border,
121
+                                                         t.m_y - t.m_border,
122
+                                                         t.m_width + t.m_border,
123
+                                                         t.m_height + t.m_border,
124
+                                                         borderSize, padding );
125
                     xengine->addRect( windowselection );
125
                     xengine->addRect( windowselection );
126
                     window = xengine->m_hoverXWindow;
126
                     window = xengine->m_hoverXWindow;
127
                 }
127
                 }
134
                 break;
134
                 break;
135
             }
135
             }
136
             case 1: {
136
             case 1: {
137
-                selection = new is::Rectangle( xengine->m_mousex - padding, xengine->m_mousey - padding, padding, padding, borderSize, 0 );
137
+                selection = new is::Rectangle( xengine->m_mousex, xengine->m_mousey, 0, 0, borderSize, padding );
138
                 selection->setPos( xengine->m_mousex - padding, xengine->m_mousey - padding );
138
                 selection->setPos( xengine->m_mousex - padding, xengine->m_mousey - padding );
139
                 xengine->addRect( selection );
139
                 xengine->addRect( selection );
140
                 state++;
140
                 state++;
145
                     state++;
145
                     state++;
146
                     break;
146
                     break;
147
                 }
147
                 }
148
-                selection->setDim( xengine->m_mousex - selection->m_x + padding, xengine->m_mousey - selection->m_y + padding );
148
+                selection->setDim( xengine->m_mousex - selection->m_x, xengine->m_mousey - selection->m_y );
149
                 // x and y offsets can indicate if the selection is inside-out, which lets us know which kind of cursor we need.
149
                 // x and y offsets can indicate if the selection is inside-out, which lets us know which kind of cursor we need.
150
                 int x = selection->m_xoffset;
150
                 int x = selection->m_xoffset;
151
                 int y = selection->m_yoffset;
151
                 int y = selection->m_yoffset;
169
                 xengine->removeRect( selection );
169
                 xengine->removeRect( selection );
170
                 running = false;
170
                 running = false;
171
                 if ( w || h || xengine->m_hoverXWindow == None ) {
171
                 if ( w || h || xengine->m_hoverXWindow == None ) {
172
-                    printf( "X: %i\n", x );
173
-                    printf( "Y: %i\n", y );
174
-                    printf( "W: %i\n", w + 1 );
175
-                    printf( "H: %i\n", h + 1 );
172
+                    printf( "X=%i\n", x );
173
+                    printf( "Y=%i\n", y );
174
+                    printf( "W=%i\n", w + 1 );
175
+                    printf( "H=%i\n", h + 1 );
176
                     break;
176
                     break;
177
                 }
177
                 }
178
                 is::WindowRectangle t = xengine->m_hoverWindow;
178
                 is::WindowRectangle t = xengine->m_hoverWindow;
180
                 y = t.m_y - padding - t.m_border;
180
                 y = t.m_y - padding - t.m_border;
181
                 w = t.m_width + t.m_border + padding*2;
181
                 w = t.m_width + t.m_border + padding*2;
182
                 h = t.m_height + t.m_border + padding*2;
182
                 h = t.m_height + t.m_border + padding*2;
183
-                printf( "X: %i\n", x );
184
-                printf( "Y: %i\n", y );
185
-                printf( "W: %i\n", w );
186
-                printf( "H: %i\n", h );
183
+                printf( "X=%i\n", x );
184
+                printf( "Y=%i\n", y );
185
+                printf( "W=%i\n", w );
186
+                printf( "H=%i\n", h );
187
                 break;
187
                 break;
188
             }
188
             }
189
         }
189
         }

+ 6
- 3
x.cpp View File

217
                               CWSaveUnder | CWOverrideRedirect |
217
                               CWSaveUnder | CWOverrideRedirect |
218
                               CWColormap;
218
                               CWColormap;
219
 
219
 
220
-    m_window = XCreateWindow( xengine->m_display, xengine->m_root, m_x-m_border+m_xoffset, m_y-m_border+m_yoffset, m_width+m_border*2, m_height+m_border*2,
220
+    m_window = XCreateWindow( xengine->m_display, xengine->m_root, m_x-m_border+m_xoffset-m_padding, m_y-m_border+m_yoffset-m_padding, m_width+m_border*2+m_padding*2, m_height+m_border*2+m_padding*2,
221
                               0, CopyFromParent, InputOutput,
221
                               0, CopyFromParent, InputOutput,
222
                               CopyFromParent, valueMask, &attributes );
222
                               CopyFromParent, valueMask, &attributes );
223
     XRectangle rect;
223
     XRectangle rect;
224
     rect.x = rect.y = m_border;
224
     rect.x = rect.y = m_border;
225
-    rect.width = m_width;
226
-    rect.height = m_height;
225
+    rect.width = m_width+m_padding*2;
226
+    rect.height = m_height+m_padding*2;
227
 
227
 
228
     XShapeCombineRectangles( xengine->m_display, m_window, ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0);
228
     XShapeCombineRectangles( xengine->m_display, m_window, ShapeBounding, 0, 0, &rect, 1, ShapeSubtract, 0);
229
     XMapWindow( xengine->m_display, m_window );
229
     XMapWindow( xengine->m_display, m_window );
245
     if ( m_width == w && m_height == h ) {
245
     if ( m_width == w && m_height == h ) {
246
         return;
246
         return;
247
     }
247
     }
248
+    w += m_padding;
249
+    h += m_padding;
248
 
250
 
249
     m_xoffset = 0;
251
     m_xoffset = 0;
250
     m_yoffset = 0;
252
     m_yoffset = 0;
261
     if ( m_border == 0 ) {
263
     if ( m_border == 0 ) {
262
         return;
264
         return;
263
     }
265
     }
266
+
264
     XResizeWindow( xengine->m_display, m_window, m_width+m_border*2, m_height+m_border*2 );
267
     XResizeWindow( xengine->m_display, m_window, m_width+m_border*2, m_height+m_border*2 );
265
     XMoveWindow( xengine->m_display, m_window, m_x-m_border+m_xoffset, m_y-m_border+m_yoffset );
268
     XMoveWindow( xengine->m_display, m_window, m_x-m_border+m_xoffset, m_y-m_border+m_yoffset );
266
     // Now punch another hole in it.
269
     // Now punch another hole in it.