Mercurial > dwindows
comparison gtk/dw.c @ 2618:156ad91481eb
WARNING: Standardize button press and release button parameter values.
This may break existing code using 3rd mouse button press/release events.
The motion callback and OS/2 had been passing the 3rd mouse button as value 4.
Other platforms were passing it as value 3. Since button/press and release
events only have a single button values 1,2,3 were unique... but OS/2 was
passing the mask value instead, making these not work cross platform.
I decided to make the button press/release and motion events all function the
same. Passing the mask values instead of button numbers. This change will
only affect button 3 on button press or release events on Windows, Mac and GTK.
OS/2 already functioned this way, iOS and Android do not support button 3.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 23 Jul 2021 20:26:56 +0000 |
parents | 2acc7ba5dea0 |
children | 401a3b9f21ba |
comparison
equal
deleted
inserted
replaced
2617:d17e3fb76bde | 2618:156ad91481eb |
---|---|
1294 | 1294 |
1295 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1295 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1296 if(work.window) | 1296 if(work.window) |
1297 { | 1297 { |
1298 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; | 1298 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
1299 int mybutton = event->button; | 1299 int mybutton = DW_BUTTON1_MASK; |
1300 | 1300 |
1301 if(event->button == 3) | 1301 if(event->button == 3) |
1302 mybutton = 2; | 1302 mybutton = DW_BUTTON2_MASK; |
1303 else if(event->button == 2) | 1303 else if(event->button == 2) |
1304 mybutton = 3; | 1304 mybutton = DW_BUTTON3_MASK; |
1305 | 1305 |
1306 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); | 1306 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
1307 } | 1307 } |
1308 return retval; | 1308 return retval; |
1309 } | 1309 } |
1315 | 1315 |
1316 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1316 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1317 if(work.window) | 1317 if(work.window) |
1318 { | 1318 { |
1319 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; | 1319 int (*buttonfunc)(HWND, int, int, int, void *) = work.func; |
1320 int mybutton = event->button; | 1320 int mybutton = DW_BUTTON1_MASK; |
1321 | 1321 |
1322 if(event->button == 3) | 1322 if(event->button == 3) |
1323 mybutton = 2; | 1323 mybutton = DW_BUTTON2_MASK; |
1324 else if(event->button == 2) | 1324 else if(event->button == 2) |
1325 mybutton = 3; | 1325 mybutton = DW_BUTTON3_MASK; |
1326 | 1326 |
1327 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); | 1327 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
1328 } | 1328 } |
1329 return retval; | 1329 return retval; |
1330 } | 1330 } |