mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Merge branch 'for-master' into 'main'
For master See merge request GNOME/gtk!5095
This commit is contained in:
commit
6cc44eb0fe
@ -17,34 +17,29 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#define GDK_PIXBUF_ENABLE_BACKEND /* Ugly? */
|
|
||||||
#include "gdkdisplay.h"
|
#include "gdkdisplay.h"
|
||||||
#include "gdkcursor.h"
|
#include "gdkcursor.h"
|
||||||
#include "gdkwin32.h"
|
#include "gdkwin32.h"
|
||||||
#include "gdktextureprivate.h"
|
#include "gdktextureprivate.h"
|
||||||
#include <glib/gi18n-lib.h>
|
|
||||||
|
|
||||||
#include "gdkdisplay-win32.h"
|
#include "gdkdisplay-win32.h"
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
#include <w32api.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "xcursors.h"
|
#include "xcursors.h"
|
||||||
|
|
||||||
typedef struct _DefaultCursor {
|
#include <stdint.h>
|
||||||
|
|
||||||
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
char *id;
|
char *id;
|
||||||
} DefaultCursor;
|
} default_cursors[] = {
|
||||||
|
/* -- Win32 cursor names: -- */
|
||||||
static DefaultCursor default_cursors[] = {
|
|
||||||
{ "appstarting", IDC_APPSTARTING },
|
{ "appstarting", IDC_APPSTARTING },
|
||||||
{ "arrow", IDC_ARROW },
|
{ "arrow", IDC_ARROW },
|
||||||
{ "cross", IDC_CROSS },
|
{ "cross", IDC_CROSS },
|
||||||
{ "hand", IDC_HAND },
|
{ "hand", IDC_HAND },
|
||||||
{ "help", IDC_HELP },
|
{ "help", IDC_HELP },
|
||||||
{ "ibeam", IDC_IBEAM },
|
{ "ibeam", IDC_IBEAM },
|
||||||
/* an X cursor name, for compatibility with GTK: */
|
/* -- X11 cursor names: -- */
|
||||||
{ "left_ptr_watch", IDC_APPSTARTING },
|
{ "left_ptr_watch", IDC_APPSTARTING },
|
||||||
{ "sizeall", IDC_SIZEALL },
|
{ "sizeall", IDC_SIZEALL },
|
||||||
{ "sizenesw", IDC_SIZENESW },
|
{ "sizenesw", IDC_SIZENESW },
|
||||||
@ -53,7 +48,7 @@ static DefaultCursor default_cursors[] = {
|
|||||||
{ "sizewe", IDC_SIZEWE },
|
{ "sizewe", IDC_SIZEWE },
|
||||||
{ "uparrow", IDC_UPARROW },
|
{ "uparrow", IDC_UPARROW },
|
||||||
{ "wait", IDC_WAIT },
|
{ "wait", IDC_WAIT },
|
||||||
/* css cursor names: */
|
/* -- CSS cursor names: -- */
|
||||||
{ "default", IDC_ARROW },
|
{ "default", IDC_ARROW },
|
||||||
{ "pointer", IDC_HAND },
|
{ "pointer", IDC_HAND },
|
||||||
{ "progress", IDC_APPSTARTING },
|
{ "progress", IDC_APPSTARTING },
|
||||||
@ -93,18 +88,17 @@ struct _GdkWin32HCursor
|
|||||||
|
|
||||||
/* Do not do any modifications to the handle
|
/* Do not do any modifications to the handle
|
||||||
* (i.e. do not call DestroyCursor() on it).
|
* (i.e. do not call DestroyCursor() on it).
|
||||||
* It's a "read-only" copy, the original is stored
|
* It's a "read-only" copy, the original is
|
||||||
* in the display instance.
|
* stored in the display instance */
|
||||||
*/
|
|
||||||
HANDLE readonly_handle;
|
HANDLE readonly_handle;
|
||||||
|
|
||||||
/* This is a way to access the real handle stored
|
/* This is a way to access the real handle
|
||||||
* in the display.
|
* stored in the display.
|
||||||
* TODO: make it a weak reference
|
* TODO: make it a weak reference */
|
||||||
*/
|
|
||||||
GdkWin32Display *display;
|
GdkWin32Display *display;
|
||||||
|
|
||||||
/* A copy of the "destoyable" attribute of the handle */
|
/* A copy of the "destoyable" attribute of
|
||||||
|
* the handle */
|
||||||
gboolean readonly_destroyable;
|
gboolean readonly_destroyable;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -382,7 +376,8 @@ hcursor_from_x_cursor (int i,
|
|||||||
int j, x, y, ofs;
|
int j, x, y, ofs;
|
||||||
HCURSOR rv;
|
HCURSOR rv;
|
||||||
int w, h;
|
int w, h;
|
||||||
guchar *and_plane, *xor_plane;
|
uint8_t *and_plane;
|
||||||
|
uint8_t *xor_plane;
|
||||||
|
|
||||||
w = GetSystemMetrics (SM_CXCURSOR);
|
w = GetSystemMetrics (SM_CXCURSOR);
|
||||||
h = GetSystemMetrics (SM_CYCURSOR);
|
h = GetSystemMetrics (SM_CYCURSOR);
|
||||||
@ -406,7 +401,7 @@ hcursor_from_x_cursor (int i,
|
|||||||
for (x = 0; x < cursors[i].width && x < w ; x++, j++)
|
for (x = 0; x < cursors[i].width && x < w ; x++, j++)
|
||||||
{
|
{
|
||||||
int pofs = ofs + x / 8;
|
int pofs = ofs + x / 8;
|
||||||
guchar data = (cursors[i].data[j/4] & (0xc0 >> (2 * (j%4)))) >> (2 * (3 - (j%4)));
|
uint8_t data = (cursors[i].data[j/4] & (0xc0 >> (2 * (j%4)))) >> (2 * (3 - (j%4)));
|
||||||
int bit = 7 - (j % cursors[i].width) % 8;
|
int bit = 7 - (j % cursors[i].width) % 8;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
@ -852,7 +847,7 @@ static GdkWin32HCursor *
|
|||||||
create_blank_win32hcursor (GdkWin32Display *display)
|
create_blank_win32hcursor (GdkWin32Display *display)
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
guchar *and_plane, *xor_plane;
|
uint8_t *and_plane, *xor_plane;
|
||||||
HCURSOR rv;
|
HCURSOR rv;
|
||||||
|
|
||||||
w = GetSystemMetrics (SM_CXCURSOR);
|
w = GetSystemMetrics (SM_CXCURSOR);
|
||||||
@ -1009,7 +1004,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
|||||||
RGBQUAD colors[2];
|
RGBQUAD colors[2];
|
||||||
} bmi;
|
} bmi;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
guchar *pixels, *bits;
|
uint8_t *pixels, *bits;
|
||||||
int rowstride, x, y, w, h;
|
int rowstride, x, y, w, h;
|
||||||
|
|
||||||
if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
|
if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
|
||||||
@ -1117,7 +1112,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
|||||||
|
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
const guchar *andp, *xorp;
|
const uint8_t *andp, *xorp;
|
||||||
if (bmi.bi.biHeight < 0)
|
if (bmi.bi.biHeight < 0)
|
||||||
{
|
{
|
||||||
andp = bits + bpl*y;
|
andp = bits + bpl*y;
|
||||||
@ -1179,7 +1174,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
|
|||||||
|
|
||||||
static HBITMAP
|
static HBITMAP
|
||||||
create_alpha_bitmap (int size,
|
create_alpha_bitmap (int size,
|
||||||
guchar **outdata)
|
uint8_t **outdata)
|
||||||
{
|
{
|
||||||
BITMAPV5HEADER bi;
|
BITMAPV5HEADER bi;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
@ -1217,7 +1212,7 @@ create_alpha_bitmap (int size,
|
|||||||
|
|
||||||
static HBITMAP
|
static HBITMAP
|
||||||
create_color_bitmap (int size,
|
create_color_bitmap (int size,
|
||||||
guchar **outdata,
|
uint8_t **outdata,
|
||||||
int bits)
|
int bits)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
@ -1265,8 +1260,9 @@ pixbuf_to_hbitmaps_alpha_winxp (GdkPixbuf *pixbuf,
|
|||||||
* http://www.dotnet247.com/247reference/msgs/13/66301.aspx
|
* http://www.dotnet247.com/247reference/msgs/13/66301.aspx
|
||||||
*/
|
*/
|
||||||
HBITMAP hColorBitmap, hMaskBitmap;
|
HBITMAP hColorBitmap, hMaskBitmap;
|
||||||
guchar *indata, *inrow;
|
const uint8_t *indata;
|
||||||
guchar *colordata, *colorrow, *maskdata, *maskbyte;
|
const uint8_t *inrow;
|
||||||
|
uint8_t *colordata, *colorrow, *maskdata, *maskbyte;
|
||||||
int width, height, size, i, i_offset, j, j_offset, rowstride;
|
int width, height, size, i, i_offset, j, j_offset, rowstride;
|
||||||
guint maskstride, mask_bit;
|
guint maskstride, mask_bit;
|
||||||
|
|
||||||
@ -1289,7 +1285,7 @@ pixbuf_to_hbitmaps_alpha_winxp (GdkPixbuf *pixbuf,
|
|||||||
/* MSDN says mask rows are aligned to "LONG" boundaries */
|
/* MSDN says mask rows are aligned to "LONG" boundaries */
|
||||||
maskstride = (((size + 31) & ~31) >> 3);
|
maskstride = (((size + 31) & ~31) >> 3);
|
||||||
|
|
||||||
indata = gdk_pixbuf_get_pixels (pixbuf);
|
indata = gdk_pixbuf_read_pixels (pixbuf);
|
||||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||||
|
|
||||||
if (width > height)
|
if (width > height)
|
||||||
@ -1343,8 +1339,9 @@ pixbuf_to_hbitmaps_normal (GdkPixbuf *pixbuf,
|
|||||||
* http://www.dotnet247.com/247reference/msgs/13/66301.aspx
|
* http://www.dotnet247.com/247reference/msgs/13/66301.aspx
|
||||||
*/
|
*/
|
||||||
HBITMAP hColorBitmap, hMaskBitmap;
|
HBITMAP hColorBitmap, hMaskBitmap;
|
||||||
guchar *indata, *inrow;
|
const uint8_t *indata;
|
||||||
guchar *colordata, *colorrow, *maskdata, *maskbyte;
|
const uint8_t *inrow;
|
||||||
|
uint8_t *colordata, *colorrow, *maskdata, *maskbyte;
|
||||||
int width, height, size, i, i_offset, j, j_offset, rowstride, nc, bmstride;
|
int width, height, size, i, i_offset, j, j_offset, rowstride, nc, bmstride;
|
||||||
gboolean has_alpha;
|
gboolean has_alpha;
|
||||||
guint maskstride, mask_bit;
|
guint maskstride, mask_bit;
|
||||||
@ -1373,7 +1370,7 @@ pixbuf_to_hbitmaps_normal (GdkPixbuf *pixbuf,
|
|||||||
/* MSDN says mask rows are aligned to "LONG" boundaries */
|
/* MSDN says mask rows are aligned to "LONG" boundaries */
|
||||||
maskstride = (((size + 31) & ~31) >> 3);
|
maskstride = (((size + 31) & ~31) >> 3);
|
||||||
|
|
||||||
indata = gdk_pixbuf_get_pixels (pixbuf);
|
indata = gdk_pixbuf_read_pixels (pixbuf);
|
||||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||||
nc = gdk_pixbuf_get_n_channels (pixbuf);
|
nc = gdk_pixbuf_get_n_channels (pixbuf);
|
||||||
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
||||||
|
@ -2229,6 +2229,7 @@ gdk_event_translate (MSG *msg,
|
|||||||
generate_button_event (GDK_BUTTON_PRESS, button,
|
generate_button_event (GDK_BUTTON_PRESS, button,
|
||||||
window, msg);
|
window, msg);
|
||||||
|
|
||||||
|
*ret_valp = (msg->message == WM_XBUTTONDOWN ? TRUE : 0);
|
||||||
return_val = TRUE;
|
return_val = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2312,6 +2313,7 @@ gdk_event_translate (MSG *msg,
|
|||||||
mouse_window_ignored_leave = NULL;
|
mouse_window_ignored_leave = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*ret_valp = (msg->message == WM_XBUTTONUP ? TRUE : 0);
|
||||||
return_val = TRUE;
|
return_val = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
/* Vista or newer */
|
/* Vista or newer */
|
||||||
#define _WIN32_WINNT 0x0600
|
#define _WIN32_WINNT 0x0600
|
||||||
#define WINVER _WIN32_WINNT
|
#include <sdkddkver.h>
|
||||||
#define NTDDI_VERSION NTDDI_VISTA
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
|
||||||
#include "gtkfilechoosernativeprivate.h"
|
#include "gtkfilechoosernativeprivate.h"
|
||||||
@ -469,7 +469,7 @@ filechooser_win32_thread (gpointer _data)
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IFileDialog *pfd = NULL;
|
IFileDialog *pfd = NULL;
|
||||||
IFileDialog2 *pfd2 = NULL;
|
IFileDialog2 *pfd2 = NULL;
|
||||||
DWORD flags;
|
DWORD flags = 0;
|
||||||
DWORD cookie;
|
DWORD cookie;
|
||||||
guint j, n_items;
|
guint j, n_items;
|
||||||
|
|
||||||
@ -491,7 +491,10 @@ filechooser_win32_thread (gpointer _data)
|
|||||||
if (FAILED (hr))
|
if (FAILED (hr))
|
||||||
g_error ("Can't get FileDialog options: %s", g_win32_error_message (hr));
|
g_error ("Can't get FileDialog options: %s", g_win32_error_message (hr));
|
||||||
|
|
||||||
flags |= FOS_FORCEFILESYSTEM;
|
flags |= FOS_FORCEFILESYSTEM |
|
||||||
|
FOS_OVERWRITEPROMPT |
|
||||||
|
FOS_NOTESTFILECREATE |
|
||||||
|
FOS_NOCHANGEDIR;
|
||||||
|
|
||||||
if (data->folder)
|
if (data->folder)
|
||||||
flags |= FOS_PICKFOLDERS;
|
flags |= FOS_PICKFOLDERS;
|
||||||
@ -502,8 +505,6 @@ filechooser_win32_thread (gpointer _data)
|
|||||||
if (data->select_multiple)
|
if (data->select_multiple)
|
||||||
flags |= FOS_ALLOWMULTISELECT;
|
flags |= FOS_ALLOWMULTISELECT;
|
||||||
|
|
||||||
flags |= FOS_OVERWRITEPROMPT;
|
|
||||||
|
|
||||||
hr = IFileDialog_SetOptions (pfd, flags);
|
hr = IFileDialog_SetOptions (pfd, flags);
|
||||||
if (FAILED (hr))
|
if (FAILED (hr))
|
||||||
g_error ("Can't set FileDialog options: %s", g_win32_error_message (hr));
|
g_error ("Can't set FileDialog options: %s", g_win32_error_message (hr));
|
||||||
|
Loading…
Reference in New Issue
Block a user