* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
{
GdkEventType type;
gint state;
- gint button;
- state = get_keyboard_modifiers_from_ns_event (nsevent);
+ state = get_keyboard_modifiers_from_ns_event (nsevent) |
+ _gdk_quartz_events_get_current_mouse_modifiers ();
switch ([nsevent type])
{
case NSRightMouseDown:
case NSOtherMouseDown:
type = GDK_BUTTON_PRESS;
+ state &= ~get_mouse_button_modifiers_from_ns_event (nsevent);
break;
+
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
type = GDK_BUTTON_RELEASE;
state |= get_mouse_button_modifiers_from_ns_event (nsevent);
break;
+
default:
g_assert_not_reached ();
}
-
- button = get_mouse_button_from_ns_event (nsevent);
event->any.type = type;
event->button.window = window;
event->button.y_root = y_root;
/* FIXME event->axes */
event->button.state = state;
- event->button.button = button;
+ event->button.button = get_mouse_button_from_ns_event (nsevent);
event->button.device = _gdk_display->core_pointer;
}
gint x_root,
gint y_root)
{
- GdkModifierType state;
-
- state = get_keyboard_modifiers_from_ns_event (nsevent);
-
- switch ([nsevent type])
- {
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- case NSOtherMouseDragged:
- state |= get_mouse_button_modifiers_from_ns_event (nsevent);
- break;
-
- case NSMouseMoved:
- break;
- }
-
event->any.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
event->motion.time = get_time_from_ns_event (nsevent);
event->motion.x_root = x_root;
event->motion.y_root = y_root;
/* FIXME event->axes */
- event->motion.state = state;
+ event->motion.state = get_keyboard_modifiers_from_ns_event (nsevent) |
+ _gdk_quartz_events_get_current_mouse_modifiers ();
event->motion.is_hint = FALSE;
event->motion.device = _gdk_display->core_pointer;
}
event->key.state |= _gdk_quartz_events_get_current_mouse_modifiers ();
+ /* The X11 backend adds the first virtual modifier MOD2..MOD5 are
+ * mapped to. Since we only have one virtual modifier in the quartz
+ * backend, calling the standard function will do.
+ */
+ gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (_gdk_display),
+ &event->key.state);
+
event->key.string = NULL;
/* Fill in ->string since apps depend on it, taken from the x11 backend. */