mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 04:09:20 +02:00
gtk2: use less hackish clipboard fix based on patch of Brad Campbell (#0012653)
git-svn-id: trunk@17417 -
This commit is contained in:
parent
34347f789c
commit
15a32b5102
@ -54,11 +54,4 @@ implementation
|
||||
{$I gtk2extra.inc}
|
||||
{$endif}
|
||||
|
||||
{$ifdef gtk2}
|
||||
initialization
|
||||
Initialize;
|
||||
finalization
|
||||
Finalize;
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
@ -5043,27 +5043,39 @@ const
|
||||
// MG: Reading in gtk internals is dirty, but there seems to be no other way
|
||||
// to clear the old target lists
|
||||
var
|
||||
SelectionLists, CurSelList: PGList;
|
||||
SelectionLists: PGList;
|
||||
{$ifdef gtk1}
|
||||
CurSelList: PGList;
|
||||
TargetSelList: PGtkTargetSelectionList;
|
||||
{$else}
|
||||
CurClipboard: TClipboardType;
|
||||
{$endif}
|
||||
begin
|
||||
{$IFDEF DEBUG_CLIPBOARD}
|
||||
DebugLn(' ClearTargetLists WWW START');
|
||||
{$ENDIF}
|
||||
{$ifdef gtk1}
|
||||
SelectionLists := gtk_object_get_data (PGtkObject(Widget),
|
||||
gtk_selection_handler_key);
|
||||
gtk_selection_handler_key);
|
||||
CurSelList := SelectionLists;
|
||||
while (CurSelList<>nil) do begin
|
||||
while (CurSelList<>nil) do
|
||||
begin
|
||||
TargetSelList := CurSelList^.Data;
|
||||
gtk_target_list_unref(TargetSelList^.List);
|
||||
{$ifndef gtk1}
|
||||
if (gtk_major_version = 2) and (gtk_minor_version > 12) and (@g_slice_free1 <> nil) then
|
||||
g_slice_free1(SizeOf(TGtkTargetSelectionList), TargetSelList)
|
||||
else
|
||||
{$endif}
|
||||
g_free(TargetSelList);
|
||||
CurSelList := CurSelList^.Next;
|
||||
end;
|
||||
g_list_free(SelectionLists);
|
||||
{$else}
|
||||
// clear 3 selections
|
||||
for CurClipboard := Low(TClipboardType) to High(CurClipboard) do
|
||||
gtk_selection_clear_targets(Widget, ClipboardTypeAtoms[CurClipboard]);
|
||||
|
||||
SelectionLists := gtk_object_get_data(PGtkObject(Widget),
|
||||
gtk_selection_handler_key);
|
||||
if SelectionLists <> nil then
|
||||
g_list_free(SelectionLists);
|
||||
{$endif}
|
||||
gtk_object_set_data (PGtkObject(Widget), gtk_selection_handler_key, GtkNil);
|
||||
{$IFDEF DEBUG_CLIPBOARD}
|
||||
DebugLn(' ClearTargetLists WWW END');
|
||||
|
@ -52,17 +52,3 @@ begin
|
||||
gdk_draw_pixmap(Dest, GC, Src, XSrc, YSrc, DestX, DestY, Width, Height);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
procedure Initialize;
|
||||
begin
|
||||
Pointer(g_slice_free1) := nil;
|
||||
glibhandle := LoadLibrary(gliblib);
|
||||
if glibhandle <> 0 then
|
||||
Pointer(g_slice_free1) := GetProcAddress(glibhandle, 'g_slice_free1');
|
||||
end;
|
||||
|
||||
procedure Finalize;
|
||||
begin
|
||||
if glibhandle <> NilHandle then
|
||||
FreeLibrary(glibhandle);
|
||||
end;
|
||||
|
@ -23,7 +23,7 @@ uses
|
||||
{$ifdef HasGdk2X}
|
||||
gdk2x,
|
||||
{$endif}
|
||||
Pango, dynlibs;
|
||||
Pango;
|
||||
|
||||
const
|
||||
gdkdll = gdklib;
|
||||
@ -190,6 +190,3 @@ procedure gtk_file_chooser_set_do_overwrite_confirmation(chooser:PGtkFileChooser
|
||||
{$ifdef GTK_2_10}
|
||||
function gdk_screen_is_composited(screen: PGdkScreen): gboolean; cdecl; external gdklib;
|
||||
{$endif}
|
||||
var
|
||||
glibhandle: TLibHandle = NilHandle;
|
||||
g_slice_free1: procedure(block_size:gsize; mem_block:gpointer); cdecl;
|
||||
|
Loading…
Reference in New Issue
Block a user