Ticket #6019: MarkAs-wim.patch

File MarkAs-wim.patch, 1.2 KB (added by Wim, 14 years ago)

Remove the hack that retrieves the mouse location by creating a BView

  • src/add-ons/tracker/mark_as/MarkAs.cpp

     
    99#include <Directory.h>
    1010#include <Entry.h>
    1111#include <FindDirectory.h>
     12#include <InterfaceDefs.h>
    1213#include <MenuItem.h>
    1314#include <Message.h>
    1415#include <Node.h>
    1516#include <Path.h>
    1617#include <PopUpMenu.h>
    1718#include <String.h>
    18 #include <View.h>
    19 #include <Window.h>
    2019
    2120
    22 /*! Returns the current mouse position in screen coordinates.
    23     Since there is no method to retrieve this in the Be API without a view,
    24     this looks a bit more complicated.
    25 */
    2621static BPoint
    2722mouse_position()
    2823{
    29     BWindow* window = new BWindow(BRect(-1000, -1000, -900, -900), "mouse",
    30         B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
    31         B_AVOID_FRONT | B_AVOID_FOCUS);
    32     BView* view = new BView(window->Bounds(), "mouse", B_FOLLOW_ALL, 0);
    33     window->AddChild(view);
    34     window->Run();
    35 
    36     window->Lock();
    37 
     24    // Returns the mouse position in screen coordinates
    3825    BPoint position;
    39     uint32 buttons;
    40     view->GetMouse(&position, &buttons);
    41     view->ConvertToScreen(&position);
    42 
    43     window->Quit();
    44 
     26    get_mouse(&position, NULL);
    4527    return position;
    4628}
    4729