gtk2 intf: removed auto mouse capture on mouse btn press fixing X locks with modal forms, LCL: fixed some typos

git-svn-id: trunk@21198 -
This commit is contained in:
mattias 2009-08-12 14:04:52 +00:00
parent 7a30d2fdae
commit 1c5875ccfe
4 changed files with 20 additions and 23 deletions

View File

@ -4799,24 +4799,27 @@ var
i: integer;
AWinControl: TWinControl;
begin
///DebugLn(['TWinControl.DestroyHandle START ',DbgSName(Self)]);
if not HandleAllocated then begin
DebugLn('Warning: TWinControl.DestroyHandle ',Name,':',ClassName,' Handle not Allocated');
//RaiseGDBException('');
end;
// First destroy all children handles
//DebugLn(['TWinControl.DestroyHandle DESTROY CHILDS ',DbgSName(Self)]);
Include(FControlState, csDestroyingHandle);
if FWinControls <> nil then begin
for i:= 0 to FWinControls.Count - 1 do begin
//DebugLn([' i=',i]);
//DebugLn([' ',TWinControl(FWinControls[i]).Name,':',TWinControl(FWinControls[i]).ClassName]);
//DebugLn([' ',i,' ',DbgSName(TObject(FWinControls[i]))]);
AWinControl:=TWinControl(FWinControls[i]);
if AWinControl.HandleAllocated then
AWinControl.DestroyHandle;
end;
end;
//DebugLn(['TWinControl.DestroyHandle DESTROY SELF ',DbgSName(Self)]);
DestroyWnd;
Exclude(FControlState, csDestroyingHandle);
//DebugLn(['TWinControl.DestroyHandle END ',DbgSName(Self)]);
end;
{------------------------------------------------------------------------------
@ -7012,9 +7015,9 @@ begin
TWSWinControlClass(WidgetSetClass).DestroyHandle(Self);
Handle := 0;
// We don't know why we here. Maybe because handle is not needed at moment
// but later it will be created once again. To propely initialize control
// after we need to restore color and font. Therefore request update here.
// Maybe handle is not needed at moment but later it will be created once
// again. To propely initialize control after we need to restore color
// and font. Request update.
FWinControlFlags := FWinControlFlags + [wcfColorChanged, wcfFontChanged];
end;
end;

View File

@ -1530,17 +1530,19 @@ var
CaptureWidget: PGtkWidget;
EventXY: TPoint;
MappedXY: TPoint;
AWinControl: TWinControl;
begin
Result := CallBackDefaultReturn;
MousePositionValid := False;
AWinControl:=TWinControl(Data);
{$IFDEF VerboseMouseBugfix}
DebugLn('');
DesignOnlySignal:=GetDesignOnlySignalFlag(Widget,dstMousePress);
DebugLn('[gtkMouseBtnPress] ',
DbgSName(TObject(Data)),
DbgSName(AWinControl,
' Widget=',DbgS(Widget),
' ControlWidget=',DbgS(TWinControl(Data).Handle),
' ControlWidget=',DbgS(AWinControl.Handle),
' DSO='+dbgs(DesignOnlySignal),
' '+dbgs(TruncToInt(Event^.X)),',',dbgs(TruncToInt(Event^.Y)),
' Type='+dbgs(gdk_event_get_type(Event)));
@ -1562,19 +1564,22 @@ begin
if DesignOnlySignal then exit;
if not ControlGetsMouseDownBefore(TControl(Data), Widget) then Exit;
CaptureWidget := PGtkWidget(TWinControl(Data).Handle);
CaptureWidget := PGtkWidget(AWinControl.Handle);
if Event^.button = 1 then
begin
EventXY := Point(TruncToInt(Event^.X), TruncToInt(Event^.Y));
MappedXY := TranslateGdkPointToClientArea(Event^.Window, EventXY, CaptureWidget);
SetCaptureControl(TWinControl(Data), MappedXY);
{$IFDEF Gtk1}
// gtk2: the LCL will capture itself if DragMode=dmAutomatic
SetCaptureControl(AWinControl, MappedXY);
{$ENDIF}
//CaptureMouseForWidget(CaptureWidget,mctGTKIntf);
end
else
// how to skip default right click handling? LCL can tell only on mouse up
// if handling can be skiped but gtk needs on mouse down
if (Event^.button = 3) and
((TWinControl(Data).PopupMenu <> nil) or
((AWinControl.PopupMenu <> nil) or
(TWinControlAccess(Data).OnContextPopup <> nil)) then begin
{$IFDEF GTK1}
if (TControl(Data) is TCustomNoteBook) then

View File

@ -4835,8 +4835,8 @@ begin
if GtkWidgetIsA(Info^.CoreWidget, gtk_list_get_type) then
begin
// Paul Ishenin:
// listbox grabs pointer and other control for itself, when we click on lisebox item
// aslo it change its state to drag_selection
// listbox grabs pointer and other control for itself, when we click on listbox item
// also it changes its state to drag_selection
// this is not expected in LCL and as result cause bugs, such as 7892
// so we need end drag selection manually
OldMouseCaptureWidget := Info^.CoreWidget;

View File

@ -146,18 +146,7 @@ end;
class procedure TGtk2WSCustomCalendar.DestroyHandle(
const AWinControl: TWinControl);
var
CalendarCtrl: TCustomCalendar;
CalendarWidget: PGtkCalendar;
begin
// When the user drags a day number, the gtk2 starts a mouse capture.
// when the TCalendar is on a TDateEdit, the LCL destroys the widget while the
// gtk is still capturing. Result: The capture hangs.
// thaw it:
CalendarCtrl:=TCustomCalendar(AWinControl);
CalendarWidget:=GetCalendar(CalendarCtrl);
gtk_calendar_thaw(CalendarWidget);
TGtk2WSWinControl.DestroyHandle(AWinControl);
//inherited DestroyHandle(AWinControl);
end;