Patch by Wim van der Meer: Implemented global Interface Kit function to retrieve
the current mouse position and pressed buttons. I've changed the return code to status_t and added anal error checking, most of the rest of the file is not doing it, though... :-) Thanks, Wim! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36811 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4339f8be19
commit
1c73ffa102
@ -10,6 +10,7 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
class BRect;
|
class BRect;
|
||||||
|
class BPoint;
|
||||||
|
|
||||||
|
|
||||||
// some handy UTF-8 characters
|
// some handy UTF-8 characters
|
||||||
@ -380,6 +381,8 @@ mode_mouse mouse_mode();
|
|||||||
void set_focus_follows_mouse_mode(mode_focus_follows_mouse mode);
|
void set_focus_follows_mouse_mode(mode_focus_follows_mouse mode);
|
||||||
mode_focus_follows_mouse focus_follows_mouse_mode();
|
mode_focus_follows_mouse focus_follows_mouse_mode();
|
||||||
|
|
||||||
|
status_t get_mouse(BPoint* screenWhere, uint32* buttons);
|
||||||
|
|
||||||
void set_accept_first_click(bool acceptFirstClick);
|
void set_accept_first_click(bool acceptFirstClick);
|
||||||
bool accept_first_click();
|
bool accept_first_click();
|
||||||
|
|
||||||
|
@ -81,6 +81,8 @@ enum {
|
|||||||
|
|
||||||
AS_BEGIN_RECT_TRACKING,
|
AS_BEGIN_RECT_TRACKING,
|
||||||
AS_END_RECT_TRACKING,
|
AS_END_RECT_TRACKING,
|
||||||
|
|
||||||
|
AS_GET_CURSOR_POSITION,
|
||||||
|
|
||||||
// Window definitions
|
// Window definitions
|
||||||
AS_SHOW_WINDOW,
|
AS_SHOW_WINDOW,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* Caz <turok2@currantbun.com>
|
* Caz <turok2@currantbun.com>
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
* Michael Lotz <mmlr@mlotz.ch>
|
* Michael Lotz <mmlr@mlotz.ch>
|
||||||
|
* Wim van der Meer <WPJvanderMeer@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -23,9 +24,10 @@
|
|||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
|
#include <Point.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <ScrollBar.h>
|
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
|
#include <ScrollBar.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
@ -925,6 +927,42 @@ focus_follows_mouse_mode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
get_mouse(BPoint* screenWhere, uint32* buttons)
|
||||||
|
{
|
||||||
|
if (screenWhere == NULL && buttons == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
BPrivate::AppServerLink link;
|
||||||
|
link.StartMessage(AS_GET_CURSOR_POSITION);
|
||||||
|
|
||||||
|
int32 code;
|
||||||
|
status_t ret = link.FlushWithReply(code);
|
||||||
|
if (ret != B_OK)
|
||||||
|
return ret;
|
||||||
|
if (code != B_OK)
|
||||||
|
return code;
|
||||||
|
|
||||||
|
if (screenWhere != NULL)
|
||||||
|
ret = link.Read<BPoint>(screenWhere);
|
||||||
|
else {
|
||||||
|
BPoint dummy;
|
||||||
|
ret = link.Read<BPoint>(&dummy);
|
||||||
|
}
|
||||||
|
if (ret != B_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (buttons != NULL)
|
||||||
|
ret = link.Read<uint32>(buttons);
|
||||||
|
else {
|
||||||
|
uint32 dummy;
|
||||||
|
ret = link.Read<uint32>(&dummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_accept_first_click(bool acceptFirstClick)
|
set_accept_first_click(bool acceptFirstClick)
|
||||||
{
|
{
|
||||||
|
@ -61,6 +61,8 @@ string_for_message_code(uint32 code, BString& string)
|
|||||||
|
|
||||||
CODE(AS_BEGIN_RECT_TRACKING);
|
CODE(AS_BEGIN_RECT_TRACKING);
|
||||||
CODE(AS_END_RECT_TRACKING);
|
CODE(AS_END_RECT_TRACKING);
|
||||||
|
|
||||||
|
CODE(AS_GET_CURSOR_POSITION);
|
||||||
|
|
||||||
// Window definitions
|
// Window definitions
|
||||||
CODE(AS_SHOW_WINDOW);
|
CODE(AS_SHOW_WINDOW);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
* Jérôme Duval, jerome.duval@free.fr
|
* Jérôme Duval, jerome.duval@free.fr
|
||||||
* Andrej Spielmann, <andrej.spielmann@seh.ox.ac.uk>
|
* Andrej Spielmann, <andrej.spielmann@seh.ox.ac.uk>
|
||||||
* Philippe Saint-Pierre, stpere@gmail.com
|
* Philippe Saint-Pierre, stpere@gmail.com
|
||||||
|
* Wim van der Meer, <WPJvanderMeer@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -1165,7 +1166,21 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AS_GET_CURSOR_POSITION:
|
||||||
|
{
|
||||||
|
STRACE(("ServerApp %s: Get Cursor position\n", Signature()));
|
||||||
|
// Returns
|
||||||
|
// 1) BPoint mouse location
|
||||||
|
// 2) int32 button state
|
||||||
|
BPoint where;
|
||||||
|
int32 buttons;
|
||||||
|
fDesktop->GetLastMouseState(&where, &buttons);
|
||||||
|
fLink.StartMessage(B_OK);
|
||||||
|
fLink.Attach<BPoint>(where);
|
||||||
|
fLink.Attach<int32>(buttons);
|
||||||
|
fLink.Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case AS_GET_SCROLLBAR_INFO:
|
case AS_GET_SCROLLBAR_INFO:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Get ScrollBar info\n", Signature()));
|
STRACE(("ServerApp %s: Get ScrollBar info\n", Signature()));
|
||||||
|
Loading…
Reference in New Issue
Block a user