From 48a45ff672cb084cf72c132bcc50d0c2cfb845d7 Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Sat, 16 Jun 2007 15:41:27 +0000 Subject: Implement, to be used to detect if the window is currently being moved 2007-06-16 Richard Hult * gdk/quartz/GdkQuartzWindow.c: (isInMove): Implement, to be used to detect if the window is currently being moved with the mouse. svn path=/trunk/; revision=18159 --- ChangeLog | 5 +++++ gdk/quartz/GdkQuartzWindow.c | 37 +++++++++++++++++++++++++++++++++++-- gdk/quartz/GdkQuartzWindow.h | 8 ++++++-- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58afdf812e..7af406dec4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-16 Richard Hult + + * gdk/quartz/GdkQuartzWindow.c: (isInMove): Implement, to be used + to detect if the window is currently being moved with the mouse. + 2007-06-16 Richard Hult * gdk/quartz/gdkwindow-quartz.c (gdk_window_set_transient_for): diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c index 9a97ec4aee..cd18e7f9be 100644 --- a/gdk/quartz/GdkQuartzWindow.c +++ b/gdk/quartz/GdkQuartzWindow.c @@ -1,6 +1,6 @@ /* GdkQuartzWindow.m * - * Copyright (C) 2005 Imendio AB + * Copyright (C) 2005-2007 Imendio AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,6 @@ * Boston, MA 02111-1307, USA. */ - #import "GdkQuartzWindow.h" #include "gdkwindow-quartz.h" #include "gdkprivate-quartz.h" @@ -69,6 +68,40 @@ _gdk_quartz_events_update_focus_window (window, FALSE); } +/* Used in combination with NSLeftMouseUp in sendEvent to keep track + * of when the window is being moved with the mouse. + */ +-(void)windowWillMove:(NSNotification *)aNotification +{ + if (leftDown) + inMove = YES; +} + +-(void)sendEvent:(NSEvent *)event +{ + switch ([event type]) + { + case NSLeftMouseDown: + leftDown = YES; + break; + + case NSLeftMouseUp: + leftDown = NO; + inMove = NO; + break; + + default: + break; + } + + [super sendEvent:event]; +} + +-(BOOL)isInMove +{ + return inMove; +} + -(void)windowDidMove:(NSNotification *)aNotification { NSRect content_rect = [self contentRectForFrameRect:[self frame]]; diff --git a/gdk/quartz/GdkQuartzWindow.h b/gdk/quartz/GdkQuartzWindow.h index 5a00397095..4c2276d3c6 100644 --- a/gdk/quartz/GdkQuartzWindow.h +++ b/gdk/quartz/GdkQuartzWindow.h @@ -1,6 +1,6 @@ /* GdkQuartzWindow.h * - * Copyright (C) 2005 Imendio AB + * Copyright (C) 2005-2007 Imendio AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,15 @@ */ #import -#include "gdkwindow.h" +#include @interface GdkQuartzWindow : NSWindow { + BOOL leftDown; + BOOL inMove; } +-(BOOL)isInMove; + @end -- cgit v1.2.1