WIN32: get Unicode filename of Dropped files
This commit is contained in:
parent
322d95add8
commit
b706566f57
15
src/engine.c
15
src/engine.c
@ -697,17 +697,25 @@ void Main_handler(void)
|
|||||||
char* flimit;
|
char* flimit;
|
||||||
byte old_cursor_shape;
|
byte old_cursor_shape;
|
||||||
|
|
||||||
Upload_infos_page(&Main);
|
|
||||||
|
|
||||||
flimit = Find_last_separator(Drop_file_name);
|
flimit = Find_last_separator(Drop_file_name);
|
||||||
|
if (flimit != NULL)
|
||||||
|
{
|
||||||
*(flimit++) = '\0';
|
*(flimit++) = '\0';
|
||||||
|
|
||||||
|
Upload_infos_page(&Main);
|
||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
old_cursor_shape=Cursor_shape;
|
old_cursor_shape=Cursor_shape;
|
||||||
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
Cursor_shape=CURSOR_SHAPE_HOURGLASS;
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
Init_context_layered_image(&context, flimit, Drop_file_name);
|
Init_context_layered_image(&context, flimit, Drop_file_name);
|
||||||
|
if (Drop_file_name_unicode != NULL)
|
||||||
|
{
|
||||||
|
context.File_name_unicode = Find_last_separator_unicode(Drop_file_name_unicode);
|
||||||
|
if (context.File_name_unicode != NULL)
|
||||||
|
context.File_name_unicode++;
|
||||||
|
}
|
||||||
Load_image(&context);
|
Load_image(&context);
|
||||||
if (File_error!=1)
|
if (File_error!=1)
|
||||||
{
|
{
|
||||||
@ -730,8 +738,11 @@ void Main_handler(void)
|
|||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free(Drop_file_name);
|
free(Drop_file_name);
|
||||||
Drop_file_name=NULL;
|
Drop_file_name=NULL;
|
||||||
|
free(Drop_file_name_unicode);
|
||||||
|
Drop_file_name_unicode=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Get_input(0))
|
if(Get_input(0))
|
||||||
|
|||||||
@ -82,6 +82,7 @@ int Snap_axis_origin_X;
|
|||||||
int Snap_axis_origin_Y;
|
int Snap_axis_origin_Y;
|
||||||
|
|
||||||
char * Drop_file_name = NULL;
|
char * Drop_file_name = NULL;
|
||||||
|
word * Drop_file_name_unicode = NULL;
|
||||||
|
|
||||||
#if defined(USE_X11) || (defined(SDL_VIDEO_DRIVER_X11) && !defined(NO_X11))
|
#if defined(USE_X11) || (defined(SDL_VIDEO_DRIVER_X11) && !defined(NO_X11))
|
||||||
char * X11_clipboard = NULL;
|
char * X11_clipboard = NULL;
|
||||||
|
|||||||
@ -75,6 +75,7 @@ extern int Snap_axis_origin_Y;
|
|||||||
/// This malloced string is set when a drag-and-drop event
|
/// This malloced string is set when a drag-and-drop event
|
||||||
/// brings a file to Grafx2's window.
|
/// brings a file to Grafx2's window.
|
||||||
extern char * Drop_file_name;
|
extern char * Drop_file_name;
|
||||||
|
extern word * Drop_file_name_unicode;
|
||||||
|
|
||||||
#if defined __HAIKU__
|
#if defined __HAIKU__
|
||||||
#define SHORTCUT_COPY (KEY_c|MOD_ALT)
|
#define SHORTCUT_COPY (KEY_c|MOD_ALT)
|
||||||
|
|||||||
@ -1435,7 +1435,7 @@ int main(int argc,char * argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
GFX2_Log(GFX2_DEBUG, "built with _MSC_VER=%d\n", _MSC_VER);
|
GFX2_Log(GFX2_DEBUG, "built with _MSC_VER=%d Windows ANSI Code Page=%u\n", _MSC_VER, GetACP());
|
||||||
#endif
|
#endif
|
||||||
Main_handler();
|
Main_handler();
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
#include "unicode.h"
|
||||||
|
|
||||||
extern int user_feedback_required;
|
extern int user_feedback_required;
|
||||||
extern word Input_new_mouse_X;
|
extern word Input_new_mouse_X;
|
||||||
@ -259,8 +260,10 @@ static LRESULT CALLBACK Win32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
{
|
{
|
||||||
TCHAR LongDropFileName[MAX_PATH];
|
TCHAR LongDropFileName[MAX_PATH];
|
||||||
TCHAR ShortDropFileName[MAX_PATH];
|
TCHAR ShortDropFileName[MAX_PATH];
|
||||||
if (DragQueryFile(hDrop, 0 , LongDropFileName ,(UINT) MAX_PATH)
|
if (DragQueryFile(hDrop, 0 , LongDropFileName ,(UINT) MAX_PATH))
|
||||||
&& GetShortPathName(LongDropFileName, ShortDropFileName, MAX_PATH))
|
{
|
||||||
|
Drop_file_name_unicode = Unicode_strdup((word *)LongDropFileName);
|
||||||
|
if (GetShortPathName(LongDropFileName, ShortDropFileName, MAX_PATH))
|
||||||
{
|
{
|
||||||
Drop_file_name = (char *)malloc(lstrlen(ShortDropFileName) + 1);
|
Drop_file_name = (char *)malloc(lstrlen(ShortDropFileName) + 1);
|
||||||
if (Drop_file_name != NULL)
|
if (Drop_file_name != NULL)
|
||||||
@ -274,6 +277,7 @@ static LRESULT CALLBACK Win32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case WM_STYLECHANGING: // app can change the styles
|
case WM_STYLECHANGING: // app can change the styles
|
||||||
case WM_STYLECHANGED: // app can not change the styles
|
case WM_STYLECHANGED: // app can not change the styles
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user