| 134 | | gadget::EventPtr mouse_event(new gadget::MouseEvent(type, button, |
|---|
| 135 | | view_loc.x, view_loc.y, |
|---|
| 136 | | root_loc.x, root_loc.y, |
|---|
| 137 | | [event modifierFlags], |
|---|
| 138 | | [event timestamp])); |
|---|
| | 134 | |
|---|
| | 135 | // The Cocoa coordinate frame has the origin in the lower left-hand corner |
|---|
| | 136 | // just as we ought to want for mouse events, but for some reason, the other |
|---|
| | 137 | // windowing systems put the origin in the upper left-hand corner. Hence, |
|---|
| | 138 | // we have to transform the coordinate frame to be in the upper left-hand |
|---|
| | 139 | // corner to be portable. |
|---|
| | 140 | gadget::EventPtr mouse_event( |
|---|
| | 141 | new gadget::MouseEvent( |
|---|
| | 142 | type, button, view_loc.x, mHeight - view_loc.y, root_loc.x, |
|---|
| | 143 | [[mCocoaWindow screen] frame].size.height - root_loc.y, |
|---|
| | 144 | [event modifierFlags], [event timestamp] |
|---|
| | 145 | ) |
|---|
| | 146 | ); |
|---|
| 148 | | gadget::EventPtr move_event(new gadget::MouseEvent(gadget::MouseMoveEvent, |
|---|
| 149 | | gadget::NO_MBUTTON, |
|---|
| 150 | | view_loc.x, view_loc.y, |
|---|
| 151 | | root_loc.x, root_loc.y, |
|---|
| 152 | | [event modifierFlags], |
|---|
| 153 | | [event timestamp])); |
|---|
| | 155 | |
|---|
| | 156 | // The Cocoa coordinate frame has the origin in the lower left-hand corner |
|---|
| | 157 | // just as we ought to want for mouse events, but for some reason, the other |
|---|
| | 158 | // windowing systems put the origin in the upper left-hand corner. Hence, |
|---|
| | 159 | // we have to transform the coordinate frame to be in the upper left-hand |
|---|
| | 160 | // corner to be portable. |
|---|
| | 161 | gadget::EventPtr move_event( |
|---|
| | 162 | new gadget::MouseEvent( |
|---|
| | 163 | gadget::MouseMoveEvent, gadget::NO_MBUTTON, view_loc.x, |
|---|
| | 164 | mHeight - view_loc.y, root_loc.x, |
|---|
| | 165 | [[mCocoaWindow screen] frame].size.height - root_loc.y, |
|---|
| | 166 | [event modifierFlags], [event timestamp] |
|---|
| | 167 | ) |
|---|
| | 168 | ); |
|---|