Selaa lähdekoodia

Moved global to local ccordinate transformation to the sequencer thread in order to provide correct coordinates.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6811 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 vuotta sitten
vanhempi
commit
9fd34f234f
4 muutettua tiedostoa jossa 10 lisäystä ja 4 poistoa
  1. 1 1
      source/ComponentViewer.Mod
  2. 1 1
      source/WMMessages.Mod
  3. 6 1
      source/WMWindowManager.Mod
  4. 2 1
      source/WindowManager.Mod

+ 1 - 1
source/ComponentViewer.Mod

@@ -314,4 +314,4 @@ SystemTools.FreeDownTo  ComponentViewer ~
 ComponentViewer.Open FractalDemo.XML ~
 
 ComponentViewer.Open ComponentHelper:Panel:1 ~
-ComponentViewer.Open TLEmulator:Panel:1 ~
+ComponentViewer.Open --moveable --width=100 --height=100 WMStandardComponents.GenButton  ~

+ 1 - 1
source/WMMessages.Mod

@@ -191,7 +191,7 @@ TYPE
 						TRACE(msg.ext);
 					END;
 				END;
-				D.TraceBack;
+				(*D.TraceBack;*)
 			END;
 
 			IF MergePointers & (msg.msgType = MsgPointer) & (msg.msgSubType = MsgSubPointerMove) & (num > 0) THEN  (* reduce pointer moves in buffer *)

+ 6 - 1
source/WMWindowManager.Mod

@@ -441,6 +441,9 @@ TYPE
 			IF m.msgType = Messages.MsgKey THEN
 				KeyEvent(m.x, m.flags, m.y)
 			ELSIF m.msgType = Messages.MsgPointer THEN
+				(* global to local transformation by sequencer thread: *)
+				m.x := m.x-bounds.l;
+				m.y := m.y-bounds.t;
 				IF m.msgSubType = Messages.MsgSubPointerMove THEN
 					IF (m.dz # 0) THEN WheelMove(m.dz) END;
 					PointerMove(m.x, m.y, m.flags)
@@ -561,7 +564,9 @@ TYPE
 		BEGIN
 			w := GetWidth(); h := GetHeight();
 			IF (w > 0) & (h > 0) & ((w # img.width) OR (h # img.height)) & (m.msgType = Messages.MsgPointer) THEN
-				fx := img.width / w; fy := img.height / h; m.x := ENTIER(m.x * fx); m.y := ENTIER(m.y * fy)
+				m.x := m.x-bounds.l; m.y := m.y-bounds.t;
+				fx := img.width / w; fy := img.height / h; m.x := ENTIER(m.x * fx); m.y := ENTIER(m.y * fy);
+				m.x := m.x + bounds.l; m.y := m.y+bounds.l;
 			END;
 			Handle^(m)
 		END Handle;

+ 2 - 1
source/WindowManager.Mod

@@ -1054,7 +1054,8 @@ TYPE
 							END;
 						ELSE
 							bounds := pointerOwner.bounds;
-							m.x := msg.x - bounds.l; m.y := msg.y - bounds.t;
+							(* do not translate to local coordinates here: must be done by sequencer! *)
+							m.x := msg.x; m.y := msg.y;
 						END;
 						m.flags := keys;
 						IF pointerOwner.sequencer # NIL THEN IF ~pointerOwner.sequencer.Add(m) THEN END (* ignore missed mouse messages *)