diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2011-11-04 09:44:35 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2011-11-10 17:41:12 +0100 |
commit | 68d28aad97894c5b1fa6875b2cb3a9baa0c8284f (patch) | |
tree | 44dab0748c3af5fbb993a6788f5004d60c848ffe /gdk | |
parent | 4e10d9604b0a5a22d1105b3eab685f89239a9cc7 (diff) | |
download | gtk+-68d28aad97894c5b1fa6875b2cb3a9baa0c8284f.tar.gz |
win32: fix pasting screenshots taken with PrintScreen or Alt+PrintScreen
These are found on the clipboard in the biCompression == BI_BITFIELDS &&
biBitCount >= 16 format. In this case the BITMAPINFOHEADER is followed
by three DWORD specifying the masks of the red green and blue components,
but bfOffBits was not being adjusted accordingly.
Based on Massimo's comment on bug 631384 and verified on
http://msdn.microsoft.com/en-us/library/dd183386%28v=VS.85%29.aspx
https://bugzilla.gnome.org/show_bug.cgi?id=631384
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/win32/gdkselection-win32.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index f4e600b4fe..c734b0be46 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -721,6 +721,17 @@ _gdk_win32_display_convert_selection (GdkDisplay *display, bi->biSize + bi->biClrUsed * sizeof (RGBQUAD)); + if (bi->biCompression == BI_BITFIELDS && bi->biBitCount >= 16) + { + /* Screenshots taken with PrintScreen or + * Alt + PrintScreen are found on the clipboard in + * this format. In this case the BITMAPINFOHEADER is + * followed by three DWORD specifying the masks of the + * red green and blue components, so adjust the offset + * accordingly. */ + bf->bfOffBits += (3 * sizeof (DWORD)); + } + memcpy ((char *) data + sizeof (BITMAPFILEHEADER), bi, data_length); |