GtkClipboard and MS Windows port



Hello,

(sorry for those seeing this message twice, I post this message in
this list also, after gtk-app-devel-list).

...As I am trying to port a program written in C using Gtk+ on a
Debian GNU/Linux to MS Windows (using the MingGW32 compiler set) I
have a problem using GtkClipboard.

The program should simply do copy/paste stuff with simple text. While
I can happily use the X Window selection mechanisms (PRIMARY and
CLIPBOARD) on my GNU/Linux box, the copy/paste stuff does not work
with the MS Windows executable.

This is the error message I get upon creation of a window (before even
trying to use the clipboard):

Gdk-WARNING ** gdk_selection-win32.c:1068
OpenClipboard failed : Handle de fenêtre non valide

which means that the window handle is not valid.

Now, if I go to the gdk_selection-win32.c file at line 1068 I find the
following (see arrow on the right-hand side margin below) :


void
gdk_win32_selection_add_targets (GdkWindow  *owner,
				GdkAtom selection,
				 gint n_targets,
				 GdkAtom *targets)
{
  HWND hwnd;
  guint formatid;
  gint i;
  GSList *convertable_formats, *format;
  gboolean has_set_dib = FALSE, has_real_dib = FALSE;

#ifdef G_ENABLE_DEBUG
  if (_gdk_debug_flags & GDK_DEBUG_DND)
    {
      gchar *sel_name = gdk_atom_name (selection);
      
      g_print ("gdk_win32_selection_add_targets: %p: %s: ",
             owner ? GDK_WINDOW_HWND (owner) : NULL,
	            sel_name);
      g_free (sel_name);

      for (i = 0; i < n_targets; i++)
      {
        gchar *tgt_name = gdk_atom_name (targets[i]);

	  g_print ("%s ", tgt_name);
	    g_free (tgt_name);
	    }
      g_print ("\n");
    }
#endif

  if (selection != GDK_SELECTION_CLIPBOARD)
    return;

  if (owner != NULL)
    {
      if (GDK_WINDOW_DESTROYED (owner))
      return;
      hwnd = GDK_WINDOW_HWND (owner);
    }

  if (!API_CALL (OpenClipboard, (hwnd))) <<<<------ line 1068
    return;

So it seems that the error message is produced upon execution of the

API_CALL (OpenClipboard, (hwnd)) 

call, as if the hwnd handle returned by GDK_WINDOW_HWND (owner) were
invalid.

Does anybody encounter this problem ? How could I fix it ?

Thank you for your ideas,

Cheers,

Filippo

--
Filippo Rusconi, PhD - CNRS researcher - key C78F687C @ pgp.mit.edu
Author of ``GNU polyxmass'' at http://www.polyxmass.org

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]