mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 14:31:29 +02:00
gtk: fix setting cursor for TGroupBox and probably for some other controls (issue #0015351)
git-svn-id: trunk@23153 -
This commit is contained in:
parent
98f9a52bdf
commit
c6e04024a2
@ -5,7 +5,7 @@
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@ -28,7 +28,10 @@ begin
|
||||
if Window = nil then Exit;
|
||||
// always recurse windows which do not accept controls.
|
||||
// this way we will catch all widgets with double windows
|
||||
SetWindowCursor(Window, AInfo^.ControlCursor, not (csAcceptsControls in TControl(AInfo^.LCLObject).ControlStyle));
|
||||
if not (csAcceptsControls in TControl(AInfo^.LCLObject).ControlStyle) then
|
||||
SetWindowCursor(Window, AInfo^.ControlCursor, True)
|
||||
else
|
||||
SetCursorForWindowsWithInfo(Window, AInfo);
|
||||
end;
|
||||
|
||||
class procedure TGtkPrivateWidget.SetDefaultCursor(AInfo: PWidgetInfo);
|
||||
|
@ -185,6 +185,7 @@ type
|
||||
|
||||
function GetWidgetWithWindow(const AHandle: THandle): PGtkWidget;
|
||||
procedure SetWindowCursor(AWindow: PGdkWindow; ACursor: HCursor; ARecursive: Boolean);
|
||||
procedure SetCursorForWindowsWithInfo(AWindow: PGdkWindow; AInfo: PWidgetInfo);
|
||||
|
||||
implementation
|
||||
|
||||
@ -244,6 +245,41 @@ begin
|
||||
else gdk_window_set_cursor(AWindow, Cursor);
|
||||
end;
|
||||
|
||||
procedure SetCursorForWindowsWithInfo(AWindow: PGdkWindow; AInfo: PWidgetInfo);
|
||||
var
|
||||
Cursor: PGdkCursor;
|
||||
Data: gpointer;
|
||||
Info: PWidgetInfo;
|
||||
|
||||
procedure SetCursorRecursive(AWindow: PGdkWindow);
|
||||
var
|
||||
ChildWindows, ListEntry: PGList;
|
||||
begin
|
||||
gdk_window_get_user_data(AWindow, @Data);
|
||||
if (Data <> nil) and GTK_IS_WIDGET(Data) then
|
||||
begin
|
||||
Info := GetWidgetInfo(PGtkWidget(Data), False);
|
||||
if Info = AInfo then
|
||||
gdk_window_set_cursor(AWindow, Cursor);
|
||||
end;
|
||||
|
||||
ChildWindows := gdk_window_get_children(AWindow);
|
||||
|
||||
ListEntry := ChildWindows;
|
||||
while ListEntry <> nil do
|
||||
begin
|
||||
SetCursorRecursive(PGdkWindow(ListEntry^.Data));
|
||||
ListEntry := ListEntry^.Next;
|
||||
end;
|
||||
g_list_free(ChildWindows);
|
||||
end;
|
||||
begin
|
||||
if AInfo = nil then Exit;
|
||||
Cursor := PGdkCursor(AInfo^.ControlCursor);
|
||||
if Cursor = nil then Exit;
|
||||
SetCursorRecursive(AWindow);
|
||||
end;
|
||||
|
||||
{ TGtkPrivateScrolling }
|
||||
{ temp class to keep things working }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user