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:
maxim 2016-12-06 22:58:52 +00:00
parent 90672ff228
commit 680574a5b3
3 changed files with 10 additions and 15 deletions

View File

@ -3747,6 +3747,10 @@ begin
{$IFDEF DEBUG_CLIPBOARD}
DebugLn('[ClipboardSelectionRequestHandler] Len=',dbgs(BufLength));
{$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,
Buffer,BufLength);
if Buffer<>nil then

View File

@ -794,7 +794,6 @@ class function TGtk2WSCustomListView.ColumnGetWidth(const ALV: TCustomListView;
var
Widgets: PTVWidgets;
GtkColumn: PGtkTreeViewColumn;
i: Integer;
begin
Result := -1;
@ -804,8 +803,7 @@ begin
GetCommonTreeViewWidgets({%H-}PGtkWidget(ALV.Handle), Widgets);
if not GTK_IS_TREE_VIEW(Widgets^.MainView) then
Exit;
i := AColumn.Index;
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), i);
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AIndex);
if GtkColumn <> nil then
Result := gtk_tree_view_column_get_width(GtkColumn);
end;
@ -885,26 +883,19 @@ var
Column: PGtkTreeViewColumn;
PrevColumn: PGtkTreeViewColumn;
begin
if not WSCheckHandleAllocated(ALV, 'ColumnMove')
then Exit;
if not WSCheckHandleAllocated(ALV, 'ColumnMove') then Exit;
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);
if Column <> nil then
begin
if ANewIndex = 0 then
PrevColumn := nil
else
PrevColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView),
ANewIndex-1);
gtk_tree_view_move_column_after(PGtkTreeView(Widgets^.MainView),
Column, PrevColumn);
PrevColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), ANewIndex);
gtk_tree_view_move_column_after(PGtkTreeView(Widgets^.MainView), Column, PrevColumn);
end;
end;

View File

@ -488,7 +488,7 @@ begin
if not WSCheckHandleAllocated(ALV, 'ColumnGetWidth') then
Exit;
// DebugLn('TGtk3WSCustomListView.ColumnGetWidth ');
Result := TGtk3ListView(ALV.Handle).ColumnGetWidth(AColumn.Index);
Result := TGtk3ListView(ALV.Handle).ColumnGetWidth(AIndex);
end;
class procedure TGtk3WSCustomListView.ColumnInsert(const ALV: TCustomListView;