mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 04:49:26 +02:00
Merged revision(s) 53376 #69a39c63a3, 53485 #85e7d6da06 from trunk:
LCL-GTK2: Remove trailing zero when copying to clipboard. Issues #21453, #30071, patch from BBaz. ........ LCL-GTK2: Use AIndex param for column width. Fix off by 1 (ANewIndex-1) error in TGtk2WSCustomListView.ColumnMove. Solves issue #31024. ........ git-svn-id: branches/fixes_1_6@53585 -
This commit is contained in:
parent
90672ff228
commit
680574a5b3
@ -3747,6 +3747,10 @@ begin
|
|||||||
{$IFDEF DEBUG_CLIPBOARD}
|
{$IFDEF DEBUG_CLIPBOARD}
|
||||||
DebugLn('[ClipboardSelectionRequestHandler] Len=',dbgs(BufLength));
|
DebugLn('[ClipboardSelectionRequestHandler] Len=',dbgs(BufLength));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
// workaround for issues 21453 and 30071.
|
||||||
|
// gtk_selection_data_set auto adds the required null term. Remove it here.
|
||||||
|
if (BufLength>0) and (PChar(Buffer+BufLength-1)^ = #0) then
|
||||||
|
dec(BufLength);
|
||||||
gtk_selection_data_set(SelectionData,SelectionData^.Target,BitCount,
|
gtk_selection_data_set(SelectionData,SelectionData^.Target,BitCount,
|
||||||
Buffer,BufLength);
|
Buffer,BufLength);
|
||||||
if Buffer<>nil then
|
if Buffer<>nil then
|
||||||
|
@ -794,7 +794,6 @@ class function TGtk2WSCustomListView.ColumnGetWidth(const ALV: TCustomListView;
|
|||||||
var
|
var
|
||||||
Widgets: PTVWidgets;
|
Widgets: PTVWidgets;
|
||||||
GtkColumn: PGtkTreeViewColumn;
|
GtkColumn: PGtkTreeViewColumn;
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
Result := -1;
|
Result := -1;
|
||||||
|
|
||||||
@ -804,8 +803,7 @@ begin
|
|||||||
GetCommonTreeViewWidgets({%H-}PGtkWidget(ALV.Handle), Widgets);
|
GetCommonTreeViewWidgets({%H-}PGtkWidget(ALV.Handle), Widgets);
|
||||||
if not GTK_IS_TREE_VIEW(Widgets^.MainView) then
|
if not GTK_IS_TREE_VIEW(Widgets^.MainView) then
|
||||||
Exit;
|
Exit;
|
||||||
i := AColumn.Index;
|
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AIndex);
|
||||||
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), i);
|
|
||||||
if GtkColumn <> nil then
|
if GtkColumn <> nil then
|
||||||
Result := gtk_tree_view_column_get_width(GtkColumn);
|
Result := gtk_tree_view_column_get_width(GtkColumn);
|
||||||
end;
|
end;
|
||||||
@ -885,26 +883,19 @@ var
|
|||||||
Column: PGtkTreeViewColumn;
|
Column: PGtkTreeViewColumn;
|
||||||
PrevColumn: PGtkTreeViewColumn;
|
PrevColumn: PGtkTreeViewColumn;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ALV, 'ColumnMove')
|
if not WSCheckHandleAllocated(ALV, 'ColumnMove') then Exit;
|
||||||
then Exit;
|
|
||||||
|
|
||||||
GetCommonTreeViewWidgets({%H-}PGtkWidget(ALV.Handle), Widgets);
|
GetCommonTreeViewWidgets({%H-}PGtkWidget(ALV.Handle), Widgets);
|
||||||
|
if not GTK_IS_TREE_VIEW(Widgets^.MainView) then Exit;
|
||||||
if not GTK_IS_TREE_VIEW(Widgets^.MainView) then
|
|
||||||
Exit;
|
|
||||||
|
|
||||||
Column := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AOldIndex);
|
Column := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AOldIndex);
|
||||||
if Column <> nil then
|
if Column <> nil then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if ANewIndex = 0 then
|
if ANewIndex = 0 then
|
||||||
PrevColumn := nil
|
PrevColumn := nil
|
||||||
else
|
else
|
||||||
PrevColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView),
|
PrevColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), ANewIndex);
|
||||||
ANewIndex-1);
|
gtk_tree_view_move_column_after(PGtkTreeView(Widgets^.MainView), Column, PrevColumn);
|
||||||
|
|
||||||
gtk_tree_view_move_column_after(PGtkTreeView(Widgets^.MainView),
|
|
||||||
Column, PrevColumn);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ begin
|
|||||||
if not WSCheckHandleAllocated(ALV, 'ColumnGetWidth') then
|
if not WSCheckHandleAllocated(ALV, 'ColumnGetWidth') then
|
||||||
Exit;
|
Exit;
|
||||||
// DebugLn('TGtk3WSCustomListView.ColumnGetWidth ');
|
// DebugLn('TGtk3WSCustomListView.ColumnGetWidth ');
|
||||||
Result := TGtk3ListView(ALV.Handle).ColumnGetWidth(AColumn.Index);
|
Result := TGtk3ListView(ALV.Handle).ColumnGetWidth(AIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk3WSCustomListView.ColumnInsert(const ALV: TCustomListView;
|
class procedure TGtk3WSCustomListView.ColumnInsert(const ALV: TCustomListView;
|
||||||
|
Loading…
Reference in New Issue
Block a user