win32: Fix gcc warnings

This commit is contained in:
Benjamin Otte 2021-09-24 21:22:12 +02:00
parent 47e0539968
commit d4f9d38368
5 changed files with 2 additions and 148 deletions

View File

@ -57,14 +57,12 @@ gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
{
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
GdkSurface *surface;
GdkWin32Surface *impl;
int scale;
cairo_t *cr;
int width, height;
RECT queued_window_rect;
surface = gdk_draw_context_get_surface (draw_context);
impl = GDK_WIN32_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);
queued_window_rect = gdk_win32_surface_handle_queued_move_resize (draw_context);
@ -121,11 +119,6 @@ gdk_win32_cairo_context_end_frame (GdkDrawContext *draw_context,
cairo_region_t *painted)
{
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
GdkSurface *surface;
int scale;
surface = gdk_draw_context_get_surface (draw_context);
scale = gdk_surface_get_scale_factor (surface);
/* The code to resize double-buffered windows immediately
* before blitting the buffer contents onto them used

View File

@ -1208,7 +1208,9 @@ gdk_win32_display_init_gl (GdkDisplay *display,
gpointer
gdk_win32_display_get_egl_display (GdkDisplay *display)
{
#ifdef GDK_WIN32_ENABLE_EGL
GdkWin32Display *display_win32;
#endif
g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), NULL);

View File

@ -2006,8 +2006,6 @@ static void
gdk_win32_drag_cancel (GdkDrag *drag,
GdkDragCancelReason reason)
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
const char *reason_str = NULL;
switch (reason)
{

View File

@ -769,143 +769,12 @@ close_it (gpointer data)
#endif
static GdkWin32MessageFilterReturn
gdk_dropfiles_filter (GdkWin32Display *display,
MSG *msg,
int *ret_valp,
gpointer data)
{
GdkSurface *window;
GdkDrop *drop;
GdkWin32Drop *drop_win32;
GString *result;
HANDLE hdrop;
POINT pt;
int nfiles, i;
char *fileName, *linkedFile;
if (msg->message != WM_DROPFILES)
return GDK_WIN32_MESSAGE_FILTER_CONTINUE;
GDK_NOTE (DND, g_print ("WM_DROPFILES: %p\n", msg->hwnd));
window = gdk_win32_handle_table_lookup (msg->hwnd);
drop = gdk_drop_new (GDK_DISPLAY (display),
gdk_seat_get_pointer (gdk_display_get_default_seat (GDK_DISPLAY (display))),
NULL,
/* WM_DROPFILES drops are always file names */
gdk_content_formats_new ((const char *[2]) {
"text/uri-list",
NULL
}, 1),
window,
GDK_DRAG_PROTO_WIN32_DROPFILES);
drop_win32 = GDK_WIN32_DROP (drop);
gdk_drop_set_actions (drop, GDK_ACTION_COPY);
hdrop = (HANDLE) msg->wParam;
DragQueryPoint (hdrop, &pt);
ClientToScreen (msg->hwnd, &pt);
nfiles = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
result = g_string_new (NULL);
for (i = 0; i < nfiles; i++)
{
char *uri;
wchar_t wfn[MAX_PATH];
DragQueryFileW (hdrop, i, wfn, MAX_PATH);
fileName = g_utf16_to_utf8 (wfn, -1, NULL, NULL, NULL);
/* Resolve shortcuts */
if (resolve_link (msg->hwnd, wfn, &linkedFile))
{
uri = g_filename_to_uri (linkedFile, NULL, NULL);
if (uri != NULL)
{
g_string_append (result, uri);
GDK_NOTE (DND, g_print ("... %s link to %s: %s\n",
fileName, linkedFile, uri));
g_free (uri);
}
g_free (fileName);
fileName = linkedFile;
}
else
{
uri = g_filename_to_uri (fileName, NULL, NULL);
if (uri != NULL)
{
g_string_append (result, uri);
GDK_NOTE (DND, g_print ("... %s: %s\n", fileName, uri));
g_free (uri);
}
}
#if 0
/* Awful hack to recognize temp files corresponding to
* images dragged from Firefox... Open the file right here
* so that it is less likely that Firefox manages to delete
* it before the GTK-using app (typically GIMP) has opened
* it.
*
* Not compiled in for now, because it means images dragged
* from Firefox would stay around in the temp folder which
* is not what Firefox intended. I don't feel comfortable
* with that, both from a geenral sanity point of view, and
* from a privacy point of view. It's better to wait for
* Firefox to fix the problem, for instance by deleting the
* temp file after a longer delay, or to wait until we
* implement the OLE2_DND...
*/
if (filename_looks_tempish (fileName))
{
int fd = g_open (fileName, _O_RDONLY|_O_BINARY, 0);
if (fd == -1)
{
GDK_NOTE (DND, g_print ("Could not open %s, maybe an image dragged from Firefox that it already deleted\n", fileName));
}
else
{
GDK_NOTE (DND, g_print ("Opened %s as %d so that Firefox won't delete it\n", fileName, fd));
g_timeout_add_seconds (1, close_it, GINT_TO_POINTER (fd));
}
}
#endif
g_free (fileName);
g_string_append (result, "\015\012");
}
g_clear_pointer (&drop_win32->dropfiles_list, g_free);
drop_win32->dropfiles_list = result->str;
g_string_free (result, FALSE);
if (drop_win32->dropfiles_list == NULL)
drop_win32->dropfiles_list = g_strdup ("");
gdk_drop_emit_drop_event (drop,
FALSE,
pt.x / drop_win32->scale + _gdk_offset_x,
pt.y / drop_win32->scale + _gdk_offset_y,
_gdk_win32_get_next_tick (msg->time));
DragFinish (hdrop);
*ret_valp = 0;
return GDK_WIN32_MESSAGE_FILTER_REMOVE;
}
static void
gdk_win32_drop_status (GdkDrop *drop,
GdkDragAction actions,
GdkDragAction preferred)
{
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
GdkDrag *drag;
g_return_if_fail (drop != NULL);

View File

@ -80,14 +80,12 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
GdkWin32GLContextWGL *context_wgl = GDK_WIN32_GL_CONTEXT_WGL (context);
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkWin32Display *display_win32 = (GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context)));
cairo_rectangle_int_t whole_window;
gboolean can_wait = display_win32->hasWglOMLSyncControl;
HDC hdc;
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->end_frame (draw_context, painted);
gdk_gl_context_make_current (context);
whole_window = (GdkRectangle) { 0, 0, gdk_surface_get_width (surface), gdk_surface_get_height (surface) };
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "win32", "swap buffers");
@ -122,11 +120,6 @@ static void
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
cairo_region_t *update_area)
{
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
GdkSurface *surface;
surface = gdk_gl_context_get_surface (context);
gdk_win32_surface_handle_queued_move_resize (draw_context);
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, update_area);
@ -563,7 +556,6 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
HGLRC hglrc;
int pixel_format;
HDC hdc;
HWND hwnd;
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkDisplay *display = gdk_gl_context_get_display (context);