1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

Compare commits

...

32 Commits

Author SHA1 Message Date
Danyil Blyschak
09a6d0f291 gdi32/uniscribe: Ensure the cache is initialised.
Call init_script_cache() in ScriptTextOut() to ensure that a cache
exists for the logic around the ETO_GLYPH_INDEX flag.
2024-06-25 21:58:22 +02:00
Rémi Bernon
5e4a5b0be2 winemac: Remove unnecessary surface_clip_to_visible_rect.
The surface bounds aren't used anyway and surface images are cropped
to the UI layer extends, regardless of the dirty area.
2024-06-25 21:55:06 +02:00
Rémi Bernon
22c517319a winemac: Remove now unnecessary cocoa window surface pointer. 2024-06-25 21:55:06 +02:00
Rémi Bernon
66051c2aa1 winemac: Push window surface image updates to the main thread. 2024-06-25 21:55:06 +02:00
Rémi Bernon
e7a82cc24b winemac: Create window surface CGImageRef on surface flush.
Avoid accessing the surface color bits field
from macdrv_get_surface_display_image.
2024-06-25 21:55:06 +02:00
Rémi Bernon
f8f93c9bfc winemac: Create a provider for the surface and a HBITMAP wrapping it. 2024-06-25 21:55:06 +02:00
Rémi Bernon
446c8ff670 winemac: Remove unused macdrv_get_surface_display_image copy_data parameter. 2024-06-25 21:55:06 +02:00
Ilia Docin
9cf95e76ef sane.ds: Improve color mode and paper source detection. 2024-06-25 21:55:06 +02:00
Vijay Kiran Kamuju
49457ccf21 wevtapi: Add stub EvtCreateRenderContext().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52879
2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
d09e423e61 winemac.drv: Give dead keys a friendly name in GetKeyNameText. 2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
2d319acccd winemac.drv: Add additional German symbol vkeys. 2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
c579dcc471 winemac.drv: Resolve symbol vkeys first without modifiers. 2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
c9d9ff6129 winemac.drv: Use UCCompareText in char_matches_string. 2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
5a97ad97dc winemac.drv: Uppercase single keys in GetKeyNameText. 2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
7a3e09640b winemac.drv: Do not append " dead" to dead keycodes in GetKeyNameText. 2024-06-25 21:55:06 +02:00
Marc-Aurel Zent
3b40b49c91 winemac.drv: Handle length of dead keycodes in ToUnicodeEx correctly. 2024-06-25 21:55:06 +02:00
Elizabeth Figura
53c70aec87 widl: Respect u and l modifiers in expressions. 2024-06-25 21:55:06 +02:00
Elizabeth Figura
e261f187ad widl: Use struct integer for the aNUM and aHEXNUM tokens. 2024-06-25 21:55:06 +02:00
Elizabeth Figura
22929dd8af widl: Store the hexadecimal flag inside of the expr_t union. 2024-06-25 21:55:06 +02:00
Elizabeth Figura
992cafc9ed widl: Do not allow "lu" as an integer suffix.
MIDL does not.
2024-06-25 21:55:06 +02:00
Alexandre Julliard
d9b364f6f5 makefiles: No longer ignore makedep.c. 2024-06-25 21:54:59 +02:00
Alexandre Julliard
fcc5629f7e server: Build relative paths at run-time instead of depending on makedep. 2024-06-25 13:32:57 +02:00
Alexandre Julliard
06fdcba7cf loader: Build relative paths at run-time instead of depending on makedep. 2024-06-25 13:32:57 +02:00
Alexandre Julliard
8c700a4e83 ntdll: Build relative paths at run-time instead of depending on makedep. 2024-06-25 13:32:57 +02:00
Alexandre Julliard
6311297c15 tools: Add helper functions to get the standard directories. 2024-06-25 11:33:46 +02:00
Aurimas Fišeras
69e3c712dc po: Update Lithuanian translation. 2024-06-25 09:20:11 +02:00
Brendan Shanks
3fac8334d2 winemac.drv: Fix warning in [WineContentView viewWillDraw]. 2024-06-25 09:20:00 +02:00
Brendan Shanks
1620d8f7ca winemac.drv: Fix warning in [WineWindow grabDockIconSnapshotFromWindow:force:]. 2024-06-25 09:19:59 +02:00
Elizabeth Figura
0c4743e9c1 ntdll: Move set_async_direct_result() to file.c.
Similar helpers are in file.c, and sync.c has nothing to do with file I/O otherwise.
2024-06-25 09:19:55 +02:00
Elizabeth Figura
5493ff11fa ntdll: Factor filling the IOSB into set_async_direct_result(). 2024-06-25 09:19:54 +02:00
Elizabeth Figura
62df7633e5 ntdll: Do not set io->Status at the end of sock_ioctl().
The only cases this affects are Wine-internal sockopt ioctls, and ws2_32 does not read back the IOSB status for those.
2024-06-25 09:19:52 +02:00
Elizabeth Figura
506cd1345b quartz/tests: Handle the case where ddraw returns system memory.
Fixes test failures with Windows 7.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56189
2024-06-25 09:19:47 +02:00
46 changed files with 742 additions and 476 deletions

View File

@ -3510,7 +3510,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
int iReserved, const WORD *pwGlyphs, int cGlyphs, const int *piAdvance,
const int *piJustify, const GOFFSET *pGoffset)
{
HRESULT hr = S_OK;
HRESULT hr;
INT i, dir = 1;
INT *lpDx;
WORD *reordered_glyphs = (WORD *)pwGlyphs;
@ -3521,6 +3521,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
if (!hdc || !psc) return E_INVALIDARG;
if (!piAdvance || !psa || !pwGlyphs) return E_INVALIDARG;
if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
fuOptions &= ETO_CLIPPED | ETO_OPAQUE;
fuOptions |= ETO_IGNORELANGUAGE;

View File

@ -75,6 +75,6 @@ EXTRA_OBJS = unix/version.o
unix_loader_EXTRADEFS = \
-DBINDIR=\"${bindir}\" \
-DSYSTEMDLLPATH=\"${system_dllpath}\" \
-DDLL_TO_BINDIR=\"`${MAKEDEP} -R ${libdir}/wine ${bindir}`\" \
-DBIN_TO_DATADIR=\"`${MAKEDEP} -R ${bindir} ${datadir}/wine`\"
-DLIBDIR=\"${libdir}\" \
-DDATADIR=\"${datadir}\" \
-DSYSTEMDLLPATH=\"${system_dllpath}\"

View File

@ -5484,6 +5484,37 @@ static void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULO
SERVER_END_REQ;
}
/* notify direct completion of async and close the wait handle if it is no longer needed */
void set_async_direct_result( HANDLE *async_handle, IO_STATUS_BLOCK *io,
NTSTATUS status, ULONG_PTR information, BOOL mark_pending )
{
unsigned int ret;
/* if we got STATUS_ALERTED, we must have a valid async handle */
assert( *async_handle );
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
SERVER_START_REQ( set_async_direct_result )
{
req->handle = wine_server_obj_handle( *async_handle );
req->status = status;
req->information = information;
req->mark_pending = mark_pending;
ret = wine_server_call( req );
if (ret == STATUS_SUCCESS)
*async_handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
if (ret != STATUS_SUCCESS)
ERR( "cannot report I/O result back to server: %#x\n", ret );
}
/* complete async file I/O, signaling completion in all ways necessary */
void file_complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, NTSTATUS status, ULONG_PTR information )

View File

@ -302,6 +302,42 @@ static char *build_path( const char *dir, const char *name )
return ret;
}
/* build a path with the relative dir from 'from' to 'dest' appended to base */
static char *build_relative_path( const char *base, const char *from, const char *dest )
{
const char *start;
char *ret;
unsigned int dotdots = 0;
for (;;)
{
while (*from == '/') from++;
while (*dest == '/') dest++;
start = dest; /* save start of next path element */
if (!*from) break;
while (*from && *from != '/' && *from == *dest) { from++; dest++; }
if ((!*from || *from == '/') && (!*dest || *dest == '/')) continue;
do /* count remaining elements in 'from' */
{
dotdots++;
while (*from && *from != '/') from++;
while (*from == '/') from++;
}
while (*from);
break;
}
ret = malloc( strlen(base) + 3 * dotdots + strlen(start) + 2 );
strcpy( ret, base );
while (dotdots--) strcat( ret, "/.." );
if (!start[0]) return ret;
strcat( ret, "/" );
strcat( ret, start );
return ret;
}
/* build a path to a binary and exec it */
static int build_path_and_exec( pid_t *pid, const char *dir, const char *name, char **argv )
@ -444,8 +480,8 @@ static void init_paths( char *argv[] )
free( path );
}
#endif
if (!bin_dir) bin_dir = build_path( dll_dir, DLL_TO_BINDIR );
data_dir = build_path( bin_dir, BIN_TO_DATADIR );
if (!bin_dir) bin_dir = build_relative_path( dll_dir, LIBDIR "/wine", BINDIR );
data_dir = build_relative_path( bin_dir, BINDIR, DATADIR "/wine" );
wineloader = build_path( bin_dir, basename );
}
else

View File

@ -1202,15 +1202,13 @@ static NTSTATUS wait_on( HANDLE handle, int fd, HANDLE event, PIO_APC_ROUTINE ap
if (events)
{
status = STATUS_SUCCESS;
io->Status = STATUS_SUCCESS;
io->Information = sizeof(events);
*out_buffer = events;
set_async_direct_result( &wait_handle, STATUS_SUCCESS, sizeof(events), FALSE );
set_async_direct_result( &wait_handle, io, STATUS_SUCCESS, sizeof(events), FALSE );
}
else
{
status = STATUS_PENDING;
set_async_direct_result( &wait_handle, STATUS_PENDING, 0, TRUE );
set_async_direct_result( &wait_handle, io, STATUS_PENDING, 0, TRUE );
}
}

View File

@ -875,12 +875,7 @@ static NTSTATUS sock_recv( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
status = try_recv( fd, async, &information );
if (status == STATUS_DEVICE_NOT_READY && (force_async || !nonblocking))
status = STATUS_PENDING;
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
set_async_direct_result( &wait_handle, status, information, FALSE );
set_async_direct_result( &wait_handle, io, status, information, FALSE );
}
if (status != STATUS_PENDING)
@ -1125,8 +1120,6 @@ static NTSTATUS sock_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
if (status == STATUS_ALERTED)
{
ULONG_PTR information;
status = try_send( fd, async );
if (status == STATUS_DEVICE_NOT_READY && (force_async || !nonblocking))
status = STATUS_PENDING;
@ -1138,14 +1131,7 @@ static NTSTATUS sock_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
if (status == STATUS_DEVICE_NOT_READY && async->sent_len)
status = STATUS_SUCCESS;
information = async->sent_len;
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
set_async_direct_result( &wait_handle, status, information, FALSE );
set_async_direct_result( &wait_handle, io, status, async->sent_len, FALSE );
}
if (status != STATUS_PENDING)
@ -1401,13 +1387,7 @@ static NTSTATUS sock_transmit( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc,
status = STATUS_PENDING;
information = async->head_cursor + async->file_cursor + async->tail_cursor;
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
set_async_direct_result( &wait_handle, status, information, TRUE );
set_async_direct_result( &wait_handle, io, status, information, TRUE );
}
if (status != STATUS_PENDING)
@ -1485,6 +1465,10 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
TRACE( "handle %p, code %#x, in_buffer %p, in_size %u, out_buffer %p, out_size %u\n",
handle, code, in_buffer, in_size, out_buffer, out_size );
/* many of the below internal codes return success but don't completely
* fill the iosb or signal completion; such sockopts are only called
* synchronously by ws2_32 */
switch (code)
{
case IOCTL_AFD_BIND:
@ -2528,7 +2512,5 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
if (needs_close) close( fd );
if (status != STATUS_PENDING && !NT_ERROR(status)) io->Status = status;
return status;
}

View File

@ -2667,33 +2667,6 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG
#endif
/* Notify direct completion of async and close the wait handle if it is no longer needed.
*/
void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULONG_PTR information, BOOL mark_pending )
{
unsigned int ret;
/* if we got STATUS_ALERTED, we must have a valid async handle */
assert( *async_handle );
SERVER_START_REQ( set_async_direct_result )
{
req->handle = wine_server_obj_handle( *async_handle );
req->status = status;
req->information = information;
req->mark_pending = mark_pending;
ret = wine_server_call( req );
if (ret == STATUS_SUCCESS)
*async_handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
if (ret != STATUS_SUCCESS)
ERR( "cannot report I/O result back to server: %08x\n", ret );
return;
}
/***********************************************************************
* NtCreateTransaction (NTDLL.@)
*/

View File

@ -344,7 +344,8 @@ extern void init_files(void);
extern void init_cpu_info(void);
extern void file_complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, NTSTATUS status, ULONG_PTR information );
extern void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULONG_PTR information, BOOL mark_pending );
extern void set_async_direct_result( HANDLE *async_handle, IO_STATUS_BLOCK *io,
NTSTATUS status, ULONG_PTR information, BOOL mark_pending );
extern NTSTATUS unixcall_wine_dbg_write( void *args );
extern NTSTATUS unixcall_wine_server_call( void *args );

View File

@ -3641,6 +3641,7 @@ static void test_default_presenter_allocate(void)
IVMRSurfaceAllocator *allocator;
VMRALLOCATIONINFO info;
DDSURFACEDESC2 desc;
HWND window;
HRESULT hr;
LONG ref;
@ -3669,6 +3670,9 @@ static void test_default_presenter_allocate(void)
{16, mmioFOURCC('Y','U','Y','2')},
};
window = CreateWindowA("static", "quartz_test", WS_OVERLAPPEDWINDOW, 0, 0,
100, 100, NULL, NULL, NULL, NULL);
hr = CoCreateInstance(&CLSID_AllocPresenter, NULL, CLSCTX_INPROC_SERVER,
&IID_IVMRSurfaceAllocator, (void **)&allocator);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
@ -3687,6 +3691,8 @@ static void test_default_presenter_allocate(void)
for (unsigned int i = 0; i < ARRAY_SIZE(tests); ++i)
{
DWORD expect_caps = 0;
HRESULT expect_hr;
DWORD count = 2;
winetest_push_context("Compression %#lx, depth %u", tests[i].compression, tests[i].depth);
@ -3694,14 +3700,53 @@ static void test_default_presenter_allocate(void)
bitmap_header.biBitCount = tests[i].depth;
bitmap_header.biCompression = tests[i].compression;
ddraw = create_ddraw(window);
/* Test whether we can create a surface directly, and how that will
* be translated to the error message and caps. */
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_BACKBUFFERCOUNT | DDSD_WIDTH | DDSD_HEIGHT;
desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
desc.dwWidth = desc.dwHeight = 32;
desc.dwBackBufferCount = 2;
desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat);
if (tests[i].compression)
{
desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
desc.ddpfPixelFormat.dwFourCC = tests[i].compression;
}
else
{
desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
desc.ddpfPixelFormat.dwRGBBitCount = 32;
desc.ddpfPixelFormat.dwRBitMask = 0x00ff0000;
desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00;
desc.ddpfPixelFormat.dwBBitMask = 0x000000ff;
}
hr = IDirectDraw7_CreateSurface(ddraw, &desc, &frontbuffer, NULL);
ok(hr == S_OK || hr == DDERR_INVALIDPIXELFORMAT, "Got hr %#lx.\n", hr);
expect_hr = (hr == S_OK ? S_OK : VFW_E_DDRAW_CAPS_NOT_SUITABLE);
if (hr == S_OK)
{
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(frontbuffer, &desc);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
expect_caps = desc.ddsCaps.dwCaps & ~(DDSCAPS_FRONTBUFFER | DDSCAPS_COMPLEX);
IDirectDrawSurface7_Release(frontbuffer);
}
IDirectDraw7_Release(ddraw);
hr = IVMRSurfaceAllocator_AllocateSurface(allocator, 0, &info, &count, &frontbuffer);
ok(hr == expect_hr, "Got hr %#lx.\n", hr);
if (hr == VFW_E_DDRAW_CAPS_NOT_SUITABLE)
{
skip("Format is not supported.\n");
winetest_pop_context();
continue;
}
ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(count == 3, "Got count %lu.\n", count);
memset(&desc, 0, sizeof(desc));
@ -3710,8 +3755,8 @@ static void test_default_presenter_allocate(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine ok(desc.dwFlags == (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT),
"Got flags %#lx.\n", desc.dwFlags);
todo_wine ok(desc.ddsCaps.dwCaps == (DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN
| DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP), "Got caps %#lx.\n", desc.ddsCaps.dwCaps);
todo_wine ok(desc.ddsCaps.dwCaps == (expect_caps | DDSCAPS_FRONTBUFFER),
"Expected caps %#lx, got %#lx.\n", (expect_caps | DDSCAPS_FRONTBUFFER), desc.ddsCaps.dwCaps);
ok(!desc.ddsCaps.dwCaps2, "Got caps2 %#lx.\n", desc.ddsCaps.dwCaps2);
ok(!desc.ddsCaps.dwCaps3, "Got caps2 %#lx.\n", desc.ddsCaps.dwCaps3);
ok(!desc.ddsCaps.dwCaps4, "Got caps2 %#lx.\n", desc.ddsCaps.dwCaps4);
@ -3744,8 +3789,8 @@ static void test_default_presenter_allocate(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine ok(desc.dwFlags == (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT),
"Got flags %#lx.\n", desc.dwFlags);
todo_wine ok(desc.ddsCaps.dwCaps == (DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN
| DDSCAPS_BACKBUFFER | DDSCAPS_FLIP), "Got caps %#lx.\n", desc.ddsCaps.dwCaps);
todo_wine ok(desc.ddsCaps.dwCaps == (expect_caps | DDSCAPS_BACKBUFFER),
"Expected caps %#lx, got %#lx.\n", (expect_caps | DDSCAPS_BACKBUFFER), desc.ddsCaps.dwCaps);
desc.ddsCaps.dwCaps = DDSCAPS_FLIP;
hr = IDirectDrawSurface7_GetAttachedSurface(backbuffer, &desc.ddsCaps, &backbuffer2);
@ -3757,12 +3802,10 @@ static void test_default_presenter_allocate(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
todo_wine ok(desc.dwFlags == (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_PIXELFORMAT),
"Got flags %#lx.\n", desc.dwFlags);
todo_wine_if(desc.ddsCaps.dwCaps == (DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN
| DDSCAPS_FLIP | DDSCAPS_COMPLEX))
ok(desc.ddsCaps.dwCaps == (DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN
| DDSCAPS_FLIP), "Got caps %#lx.\n", desc.ddsCaps.dwCaps);
todo_wine ok(desc.ddsCaps.dwCaps == expect_caps,
"Expected caps %#lx, got %#lx.\n", expect_caps, desc.ddsCaps.dwCaps);
desc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
desc.ddsCaps.dwCaps = DDSCAPS_FLIP;
hr = IDirectDrawSurface7_GetAttachedSurface(backbuffer2, &desc.ddsCaps, &backbuffer3);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
if (hr == S_OK)
@ -3804,6 +3847,7 @@ static void test_default_presenter_allocate(void)
ok(!ref, "Got outstanding refcount %ld.\n", ref);
ref = IDirectDraw7_Release(prev_ddraw);
ok(!ref, "Got outstanding refcount %ld.\n", ref);
DestroyWindow(window);
}
START_TEST(vmr7)

View File

@ -277,47 +277,32 @@ static TW_UINT16 SANE_CAPXferCount (pTW_CAPABILITY pCapability, TW_UINT16 action
return twCC;
}
static TW_UINT16 set_color_mode(TW_UINT32 pixeltype)
static TW_UINT16 set_option_value(const char* option_name, char* option_value)
{
TW_UINT16 twCC = TWCC_BADCAP;
TW_UINT16 twCC = TWCC_BADVALUE;
BOOL reload = FALSE;
int i;
const char * const * modes;
/* most of the values are taken from https://gitlab.gnome.org/GNOME/simple-scan/-/blob/master/src/scanner.vala */
static const char * const gray[] = {"Gray", "Grayscale", "True Gray", "8-bit Grayscale", "Grayscale - 256 Levels", "gray",
0};
static const char * const rgb[] = {"Color", "24bit Color[Fast]", "24bit Color",
"24 bit Color", "Color - 16 Million Colors", 0};
static const char * const bw[] = {"Lineart", "LineArt", "Black & White", "Binary", "Thresholded", "1-bit Black & White",
"Black and White - Line Art", "Black and White - Halftone", "Monochrome", 0};
switch (pixeltype)
if (*option_value)
{
case TWPT_GRAY:
modes = gray;
break;
case TWPT_RGB:
modes = rgb;
break;
case TWPT_BW:
modes = bw;
break;
default:
ERR("Unsupported pixeltype %lu\n", pixeltype);
return TWCC_BADVALUE;
break;
}
TRACE("Setting pixeltype to %lu\n", pixeltype);
for(i=0; modes[i]; ++i)
{
twCC = sane_option_set_str("mode", (char*)modes[i], &reload);
twCC = sane_option_set_str(option_name, option_value, &reload);
if (twCC == TWCC_SUCCESS) {
if (reload) get_sane_params(&activeDS.frame_params);
break;
}
}
return twCC;
}
static TW_UINT16 find_value_pos(const char* value, const char* values, TW_UINT16 buf_len, TW_UINT16 buf_count)
{
TW_UINT16 index;
for (index=0; index<buf_count; ++index)
{
if (!strncmp(value, values, buf_len))
return index;
values += buf_len;
}
return buf_count;
}
/* ICAP_PIXELTYPE */
static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 action)
{
@ -326,16 +311,39 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
int possible_value_count;
TW_UINT32 val;
TW_UINT16 current_pixeltype = TWPT_BW;
enum { buf_len = 64, buf_count = 3 };
char color_modes[buf_len * buf_count] = {'\0'}, current_mode[buf_len] = {'\0'}, *output = 0;
/* most of the values are taken from https://gitlab.gnome.org/GNOME/simple-scan/-/blob/master/src/scanner.vala */
static const WCHAR* bw[] = {L"Lineart", L"LineArt", L"Black & White", L"Binary", L"Thresholded",
L"1-bit Black & White", L"Black and White - Line Art", L"Black and White - Halftone", L"Monochrome", L"bw", 0};
static const WCHAR* gray[] = {L"Gray", L"Grayscale", L"True Gray", L"8-bit Grayscale", L"Grayscale - 256 Levels",
L"gray", 0};
static const WCHAR* rgb[] = {L"Color", L"24bit Color[Fast]", L"24bit Color", L"24 bit Color",
L"Color - 16 Million Colors", L"color", 0};
static const WCHAR* const* filter[] = {bw, gray, rgb, 0};
TRACE("ICAP_PIXELTYPE\n");
twCC = sane_option_probe_mode(&current_pixeltype, possible_values, &possible_value_count);
twCC = sane_option_probe_str("mode", filter, color_modes, buf_len);
if (twCC != TWCC_SUCCESS)
{
ERR("Unable to retrieve mode from sane, ICAP_PIXELTYPE unsupported\n");
ERR("Unable to retrieve modes from sane, ICAP_PIXELTYPE unsupported\n");
return twCC;
}
twCC = sane_option_get_str("mode", current_mode, buf_len);
if (twCC != TWCC_SUCCESS)
{
ERR("Unable to retrieve current mode from sane, ICAP_PIXELTYPE unsupported\n");
return twCC;
}
current_pixeltype = find_value_pos(current_mode, color_modes, buf_len, buf_count);
if (current_pixeltype == buf_count)
{
ERR("Wrong current mode value, ICAP_PIXELTYPE unsupported\n");
twCC = TWCC_BADVALUE;
return twCC;
}
/* Sane does not support a concept of a default mode, so we simply cache
* the first mode we find */
if (! activeDS.PixelTypeSet)
@ -352,17 +360,28 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
break;
case MSG_GET:
possible_value_count = 0;
for (val=TWPT_BW; val<=TWPT_RGB; ++val)
{
if (*(color_modes + val * buf_len))
possible_values[possible_value_count++] = val;
}
twCC = msg_get_enum(pCapability, possible_values, possible_value_count,
TWTY_UINT16, current_pixeltype, activeDS.defaultPixelType);
break;
case MSG_SET:
twCC = msg_set(pCapability, &val);
if (twCC == TWCC_SUCCESS)
if ((twCC == TWCC_SUCCESS) && (val < buf_count))
{
TRACE("Setting pixeltype to %ld\n", val);
twCC = set_color_mode(val);
output = color_modes + val * buf_len;
TRACE("Setting pixeltype to %lu: %s\n", val, output);
twCC = set_option_value("mode", output);
if (twCC != TWCC_SUCCESS)
ERR("Unable to set pixeltype to %lu: %s\n", val, output);
}
else
twCC = TWCC_BADVALUE;
break;
case MSG_GETDEFAULT:
@ -370,7 +389,7 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
break;
case MSG_RESET:
twCC = set_color_mode(activeDS.defaultPixelType);
twCC = set_option_value("mode", color_modes + activeDS.defaultPixelType * buf_len);
if (twCC == TWCC_SUCCESS)
current_pixeltype = activeDS.defaultPixelType;
else
@ -933,17 +952,39 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac
TW_UINT16 twCC = TWCC_BADCAP;
TW_UINT32 val;
TW_BOOL enabled;
char source[64];
enum { buf_len = 64, buf_count = 2 };
char paper_sources[buf_len * buf_count] = {'\0'}, current_source[buf_len] = {'\0'}, *output = 0;
/* most of the values are taken from https://gitlab.gnome.org/GNOME/simple-scan/-/blob/master/src/scanner.vala */
static const WCHAR* flatbed[] = {L"Flatbed", L"FlatBed", L"Platen", L"Normal", L"Document Table", 0};
static const WCHAR* autofeeder[] = {L"Auto", L"ADF", L"ADF Front", L"ADF Back", L"adf",
L"Automatic Document Feeder", L"Automatic Document Feeder(centrally aligned)",
L"Automatic Document Feeder(center aligned)", L"Automatic Document Feeder(left aligned)",
L"ADF Simplex" L"DP", 0};
static const WCHAR* const* filter[] = {flatbed, autofeeder, 0};
TRACE("CAP_FEEDERENABLED\n");
twCC = sane_option_probe_str("source", filter, paper_sources, buf_len);
if (twCC != TWCC_SUCCESS)
{
ERR("Unable to retrieve paper sources from sane, CAP_FEEDERENABLED unsupported\n");
return twCC;
}
if (sane_option_get_str("source", source, sizeof(source)) != TWCC_SUCCESS)
return TWCC_BADCAP;
twCC = sane_option_get_str("source", current_source, buf_len);
if (twCC != TWCC_SUCCESS)
{
ERR("Unable to retrieve current paper source from sane, CAP_FEEDERENABLED unsupported\n");
return twCC;
}
if (strcmp(source, "Auto") == 0 || strcmp(source, "ADF") == 0)
enabled = TRUE;
else
enabled = FALSE;
val = find_value_pos(current_source, paper_sources, buf_len, buf_count);
if (val == buf_count)
{
ERR("Wrong current paper source value, CAP_FEEDERENABLED unsupported\n");
twCC = TWCC_BADVALUE;
return twCC;
}
enabled = val > 0;
switch (action)
{
@ -958,16 +999,16 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac
case MSG_SET:
twCC = msg_set(pCapability, &val);
if (twCC == TWCC_SUCCESS)
if ((twCC == TWCC_SUCCESS) && (val < buf_count))
{
strcpy(source, "ADF");
twCC = sane_option_set_str("source", source, NULL);
output = paper_sources + val * buf_len;
TRACE("Setting paper source to %lu: %s\n", val, output);
twCC = set_option_value("source", output);
if (twCC != TWCC_SUCCESS)
{
strcpy(source, "Auto");
twCC = sane_option_set_str("source", source, NULL);
}
ERR("Unable to set paper source to %lu: %s\n", val, output);
}
else
twCC = TWCC_BADVALUE;
break;
case MSG_GETDEFAULT:
@ -975,9 +1016,14 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac
break;
case MSG_RESET:
strcpy(source, "Auto");
if (sane_option_set_str("source", source, NULL) == TWCC_SUCCESS)
enabled = TRUE;
val = *(paper_sources + buf_len) ? 1 : 0; // set to Auto/ADF if it's supported
output = paper_sources + val * buf_len;
TRACE("Resetting paper source to %lu: %s\n", val, output);
twCC = set_option_value("source", output);
if (twCC != TWCC_SUCCESS)
ERR("Unable to reset paper source to %lu: %s\n", val, output);
else
enabled = val > 0;
/* .. fall through intentional .. */
case MSG_GETCURRENT:

View File

@ -115,30 +115,41 @@ TW_UINT16 sane_option_probe_resolution(const char *option_name, struct option_de
return sane_find_option(option_name, TYPE_INT, opt);
}
TW_UINT16 sane_option_probe_mode(TW_UINT16 *current, TW_UINT32 *choices, int *count)
static TW_UINT32 sane_categorize_value(const WCHAR* value, const WCHAR* const* filter[], char* categories, int buf_len)
{
TW_UINT32 i, j;
for(i=0; filter[i]; ++i)
{
if (!*categories)
{
for(j=0; filter[i][j]; ++j)
{
if (!wcscmp(value, filter[i][j]))
{
wcstombs(categories, value, buf_len);
return i;
}
}
}
categories += buf_len;
}
return 0;
}
TW_UINT16 sane_option_probe_str(const char* option_name, const WCHAR* const* filter[], char* opt_values, int buf_len)
{
WCHAR *p;
char buffer[256];
struct option_descriptor opt;
TW_UINT16 rc = sane_find_option("mode", TYPE_STRING, &opt);
TW_UINT16 rc = sane_find_option(option_name, TYPE_STRING, &opt);
if (rc != TWCC_SUCCESS) return rc;
if (opt.size > sizeof(buffer)) return TWCC_BADVALUE;
rc = sane_option_get_value( opt.optno, buffer );
if (rc != TWCC_SUCCESS) return rc;
if (opt.size > buf_len) return TWCC_BADVALUE;
if (!strcmp( buffer, "Lineart" )) *current = TWPT_BW;
else if (!strcmp( buffer, "Color" )) *current = TWPT_RGB;
else if (!strncmp( buffer, "Gray", 4 )) *current = TWPT_GRAY;
*count = 0;
if (opt.constraint_type == CONSTRAINT_STRING_LIST)
{
for (p = opt.constraint.strings; *p; p += lstrlenW(p) + 1)
{
if (!wcscmp( p, L"Lineart" )) choices[(*count)++] = TWPT_BW;
else if (!wcscmp( p, L"Color" )) choices[(*count)++] = TWPT_RGB;
else if (!wcsncmp( p, L"Gray", 4 )) choices[(*count)++] = TWPT_GRAY;
sane_categorize_value(p, filter, opt_values, buf_len);
}
}
return rc;

View File

@ -201,7 +201,7 @@ TW_UINT16 sane_option_set_int( const char *option_name, int val, BOOL *reload );
TW_UINT16 sane_option_get_str( const char *option_name, char *val, int len );
TW_UINT16 sane_option_set_str( const char *option_name, char *val, BOOL *reload );
TW_UINT16 sane_option_probe_resolution( const char *option_name, struct option_descriptor *opt );
TW_UINT16 sane_option_probe_mode(TW_UINT16 *current, TW_UINT32 *choices, int *count);
TW_UINT16 sane_option_probe_str( const char* option_name, const WCHAR* const* filter[], char* opt_vals, int buf_len );
TW_UINT16 sane_option_get_bool( const char *option_name, BOOL *val );
TW_UINT16 sane_option_set_bool( const char *option_name, BOOL val );
TW_UINT16 sane_option_get_scan_area( int *tlx, int *tly, int *brx, int *bry );

View File

@ -2777,6 +2777,7 @@ static void test_ScriptTextOut(HDC hdc)
hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0,
pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!psc, "Got unexpected psc %p.\n", psc);
/* Test Rect Rgn is acceptable. */
SetRect(&rect, 10, 10, 40, 20);

View File

@ -148,3 +148,10 @@ EVT_HANDLE WINAPI EvtCreateBookmark(const WCHAR *bookmark_xml)
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}
EVT_HANDLE WINAPI EvtCreateRenderContext(DWORD pathcount, const WCHAR **paths, DWORD flags)
{
FIXME("(%lu %p %#lx) stub!\n", pathcount, paths, flags);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}

View File

@ -3,7 +3,7 @@
@ stub EvtClearLog
@ stdcall EvtClose(ptr)
@ stdcall EvtCreateBookmark(wstr)
@ stub EvtCreateRenderContext
@ stdcall EvtCreateRenderContext(long ptr long)
@ stdcall EvtExportLog(ptr wstr wstr wstr long)
@ stub EvtFormatMessage
@ stdcall EvtGetChannelConfigProperty(ptr long long long ptr ptr)

View File

@ -44,9 +44,6 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
void* hwnd;
WineEventQueue* queue;
void* surface;
pthread_mutex_t* surface_mutex;
CGDirectDisplayID _lastDisplayID;
NSTimeInterval _lastDisplayTime;

View File

@ -365,6 +365,8 @@ - (id) initWithFrame:(NSRect)frame device:(id<MTLDevice>)device;
@interface WineContentView : WineBaseView <NSTextInputClient, NSViewLayerContentScaleDelegate>
{
CGImageRef colorImage;
NSMutableArray* glContexts;
NSMutableArray* pendingGlContexts;
BOOL _everHadGLContext;
@ -408,8 +410,6 @@ @interface WineWindow ()
@property (nonatomic) void* hwnd;
@property (retain, readwrite, nonatomic) WineEventQueue* queue;
@property (nonatomic) void* surface;
@property (nonatomic) BOOL shapeChangedSinceLastDraw;
@property (readonly, nonatomic) BOOL needsTransparency;
@ -501,6 +501,7 @@ - (void) dealloc
[markedText release];
[glContexts release];
[pendingGlContexts release];
CGImageRelease(colorImage);
[super dealloc];
}
@ -517,14 +518,14 @@ - (BOOL) wantsUpdateLayer
- (void) updateLayer
{
WineWindow* window = (WineWindow*)[self window];
CGImageRef image = NULL;
CGImageRef image;
CGRect imageRect;
CALayer* layer = [self layer];
if ([window contentView] != self)
return;
if (window.closing || !window.surface)
if (window.closing)
return;
imageRect = layer.bounds;
@ -532,8 +533,22 @@ - (void) updateLayer
imageRect.origin.y *= layer.contentsScale;
imageRect.size.width *= layer.contentsScale;
imageRect.size.height *= layer.contentsScale;
image = macdrv_get_surface_display_image(window.surface, &imageRect, FALSE, window.colorKeyed,
window.colorKeyRed, window.colorKeyGreen, window.colorKeyBlue);
image = CGImageCreateWithImageInRect(colorImage, imageRect);
if (window.colorKeyed)
{
CGImageRef maskedImage;
CGFloat components[] = { window.colorKeyRed - 0.5, window.colorKeyRed + 0.5,
window.colorKeyGreen - 0.5, window.colorKeyGreen + 0.5,
window.colorKeyBlue - 0.5, window.colorKeyBlue + 0.5 };
maskedImage = CGImageCreateWithMaskingColors(image, components);
if (maskedImage)
{
CGImageRelease(image);
image = maskedImage;
}
}
if (image)
{
@ -552,6 +567,12 @@ - (void) updateLayer
}
}
- (void) setColorImage:(CGImageRef)image
{
CGImageRelease(colorImage);
colorImage = CGImageRetain(image);
}
- (void) viewWillDraw
{
[super viewWillDraw];
@ -564,7 +585,7 @@ - (void) viewWillDraw
clearedGlSurface = TRUE;
}
context.needsUpdate = TRUE;
macdrv_update_opengl_context(context);
macdrv_update_opengl_context((macdrv_opengl_context)context);
}
[glContexts addObjectsFromArray:pendingGlContexts];
[pendingGlContexts removeAllObjects];
@ -998,7 +1019,6 @@ @implementation WineWindow
@synthesize disabled, noForeground, preventsAppActivation, floating, fullscreen, fakingClose, closing, latentParentWindow, hwnd, queue;
@synthesize drawnSinceShown;
@synthesize surface;
@synthesize shapeChangedSinceLastDraw;
@synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue;
@synthesize usePerPixelAlpha;
@ -2338,7 +2358,7 @@ - (void) grabDockIconSnapshotFromWindow:(WineWindow*)window force:(BOOL)force
return;
}
const void* windowID = (const void*)(CGWindowID)window.windowNumber;
const void* windowID = (const void*)(uintptr_t)(CGWindowID)window.windowNumber;
CFArrayRef windowIDs = CFArrayCreate(NULL, &windowID, 1, NULL);
CGImageRef windowImage = CGWindowListCreateImageFromArray(CGRectNull, windowIDs, kCGWindowImageBoundsIgnoreFraming);
CFRelease(windowIDs);
@ -3477,35 +3497,28 @@ void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent)
});
}
/***********************************************************************
* macdrv_set_window_surface
*/
void macdrv_set_window_surface(macdrv_window w, struct window_surface *window_surface)
{
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
window.surface = window_surface;
});
}
}
/***********************************************************************
* macdrv_window_needs_display
* macdrv_window_set_color_image
*
* Mark a window as needing display in a specified rect (in non-client
* Push a window surface color pixel update in a specified rect (in non-client
* area coordinates).
*/
void macdrv_window_needs_display(macdrv_window w, CGRect rect)
void macdrv_window_set_color_image(macdrv_window w, CGImageRef image, CGRect rect, CGRect dirty)
{
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
CGImageRetain(image);
OnMainThreadAsync(^{
[[window contentView] setNeedsDisplayInRect:NSRectFromCGRect(cgrect_mac_from_win(rect))];
WineContentView *view = [window contentView];
[view setColorImage:image];
[view setNeedsDisplayInRect:NSRectFromCGRect(cgrect_mac_from_win(dirty))];
CGImageRelease(image);
});
}
}

View File

@ -398,18 +398,39 @@ static const struct {
{ VK_VOLUME_UP | 0x100, "Volume Up" },
};
static BOOL char_matches_string(WCHAR wchar, UniChar *string, BOOL ignore_diacritics)
static const struct {
WCHAR wchar;
const char *name;
} dead_key_names[] = {
{ '^', "CIRCUMFLEX ACCENT" },
{ '`', "GRAVE ACCENT" },
{ 0x00B4, "ACUTE ACCENT" },
{ '~', "TILDE" },
{ 0x00A8, "DIAERESIS" },
{ 0x00B8, "CEDILLA" },
{ 0x02D8, "BREVE" },
{ 0x02D9, "DOT ABOVE" },
{ 0x00AF, "MACRON" },
{ 0x02DA, "RING ABOVE" },
{ 0x02DB, "OGONEK" },
{ 0x02DC, "SMALL TILDE" },
{ 0x02DD, "DOUBLE ACUTE ACCENT" },
};
static Boolean char_matches_string(WCHAR wchar, UniChar *string, CollatorRef collatorRef)
{
BOOL ret;
CFStringRef s1 = CFStringCreateWithCharactersNoCopy(NULL, (UniChar*)&wchar, 1, kCFAllocatorNull);
CFStringRef s2 = CFStringCreateWithCharactersNoCopy(NULL, string, wcslen(string), kCFAllocatorNull);
CFStringCompareFlags flags = kCFCompareCaseInsensitive | kCFCompareNonliteral | kCFCompareWidthInsensitive;
if (ignore_diacritics)
flags |= kCFCompareDiacriticInsensitive;
ret = (CFStringCompare(s1, s2, flags) == kCFCompareEqualTo);
CFRelease(s1);
CFRelease(s2);
return ret;
Boolean equivalent;
OSStatus status;
status = UCCompareText(collatorRef, (UniChar*)&wchar, 1, string, wcslen(string), &equivalent, NULL);
if (status != noErr)
{
WARN("Failed to compare %s to %s\n", debugstr_wn(&wchar, 1), debugstr_w(string));
return FALSE;
}
return equivalent;
}
@ -657,6 +678,9 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
int keyc;
WCHAR vkey;
const UCKeyboardLayout *uchr;
LocaleRef localeRef;
CollatorRef collatorRef, caseInsensitiveCollatorRef, diacriticInsensitiveCollatorRef;
UCCollateOptions collateOptions = 0;
const UInt32 modifier_combos[] = {
0,
shiftKey >> 8,
@ -686,6 +710,10 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
{ '`', VK_OEM_3 },
{ '[', VK_OEM_4 },
{ '~', VK_OEM_3 },
{ 0x00DF, VK_OEM_4 }, /* 0x00DF is ESZETT */
{ 0x00FC, VK_OEM_1 }, /* 0x00FC is German U Umlaut */
{ 0x00F6, VK_OEM_3 }, /* 0x00F6 is German O Umlaut */
{ 0x00E4, VK_OEM_7 }, /* 0x00B4 is German A Umlaut */
{ '?', VK_OEM_2 },
{ ']', VK_OEM_6 },
{ '/', VK_OEM_2 },
@ -708,6 +736,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
{ '^', VK_OEM_6 },
{ '*', VK_OEM_2 },
{ '{', VK_OEM_6 },
{ 0x00B4, VK_OEM_6 },
{ '~', VK_OEM_1 },
{ '?', VK_OEM_PLUS },
{ '?', VK_OEM_4 },
@ -717,6 +746,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
{ ']', VK_OEM_4 },
{ '\'', VK_OEM_3 },
{ 0x00A7, VK_OEM_7 },
{ '<', VK_OEM_102 },
};
int i;
@ -778,6 +808,13 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
uchr = (const UCKeyboardLayout*)CFDataGetBytePtr(thread_data->keyboard_layout_uchr);
LocaleRefFromLocaleString("POSIX", &localeRef);
UCCreateCollator(localeRef, 0, collateOptions, &collatorRef);
collateOptions |= kUCCollateComposeInsensitiveMask | kUCCollateWidthInsensitiveMask | kUCCollateCaseInsensitiveMask;
UCCreateCollator(localeRef, 0, collateOptions, &caseInsensitiveCollatorRef);
collateOptions |= kUCCollateDiacritInsensitiveMask;
UCCreateCollator(localeRef, 0, collateOptions, &diacriticInsensitiveCollatorRef);
/* Using the keyboard layout, build a map of key code + modifiers -> characters. */
memset(map, 0, sizeof(map));
for (keyc = 0; keyc < ARRAY_SIZE(map); keyc++)
@ -824,7 +861,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
if (thread_data->keyc2vkey[keyc] || !map[keyc][combo][0])
continue;
if (char_matches_string(vkey, map[keyc][combo], ignore_diacritics))
if (char_matches_string(vkey, map[keyc][combo], ignore_diacritics ? diacriticInsensitiveCollatorRef : caseInsensitiveCollatorRef))
{
thread_data->keyc2vkey[keyc] = vkey;
vkey_used[vkey] = 1;
@ -850,7 +887,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
if (thread_data->keyc2vkey[keyc] || !map[keyc][combo][0])
continue;
if (char_matches_string(vkey, map[keyc][combo], FALSE))
if (char_matches_string(vkey, map[keyc][combo], collatorRef))
{
thread_data->keyc2vkey[keyc] = vkey;
vkey_used[vkey] = 1;
@ -864,22 +901,22 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
/* Now try to match key codes for certain common punctuation characters to
the most common OEM vkeys (e.g. '.' to VK_OEM_PERIOD). */
for (i = 0; i < ARRAY_SIZE(symbol_vkeys); i++)
for (combo = 0; combo < ARRAY_SIZE(modifier_combos); combo++)
{
vkey = symbol_vkeys[i].vkey;
if (vkey_used[vkey])
continue;
for (combo = 0; combo < ARRAY_SIZE(modifier_combos); combo++)
for (i = 0; i < ARRAY_SIZE(symbol_vkeys); i++)
{
vkey = symbol_vkeys[i].vkey;
if (vkey_used[vkey])
continue;
for (keyc = 0; keyc < ARRAY_SIZE(map); keyc++)
{
if (!thread_data->keyc2scan[keyc]) continue; /* not a known Mac key code */
if (thread_data->keyc2vkey[keyc] || !map[keyc][combo][0])
continue;
if (char_matches_string(symbol_vkeys[i].wchar, map[keyc][combo], FALSE))
if (char_matches_string(symbol_vkeys[i].wchar, map[keyc][combo], collatorRef))
{
thread_data->keyc2vkey[keyc] = vkey;
vkey_used[vkey] = 1;
@ -888,9 +925,6 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
break;
}
}
if (vkey_used[vkey])
break;
}
}
@ -982,6 +1016,10 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
vkey_used[vkey] = 1;
TRACE("keyc 0x%04x -> vkey 0x%04x (spare vkey)\n", keyc, vkey);
}
UCDisposeCollator(&collatorRef);
UCDisposeCollator(&caseInsensitiveCollatorRef);
UCDisposeCollator(&diacriticInsensitiveCollatorRef);
}
@ -1310,7 +1348,6 @@ INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size)
{
if (thread_data->keyc2scan[keyc] == scan)
{
static const WCHAR dead[] = {' ','d','e','a','d',0};
const UCKeyboardLayout *uchr;
UInt32 deadKeyState = 0;
UniCharCount len;
@ -1372,10 +1409,21 @@ INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size)
if (status == noErr && deadKeyState)
{
lstrcpynW(buffer + len, dead, size - len);
len = wcslen(buffer);
for (i = 0; i < ARRAY_SIZE(dead_key_names); i++)
{
if (dead_key_names[i].wchar == buffer[0])
{
len = min(strlen(dead_key_names[i].name) + 1, size);
ascii_to_unicode(buffer, dead_key_names[i].name, len);
if (len) buffer[--len] = 0;
break;
}
}
}
if (status == noErr && len == 1 && buffer[0] >= 'a' && buffer[0] <= 'z')
buffer[0] += 'A' - 'a';
TRACE("lparam 0x%08x -> %s\n", (unsigned int)lparam, debugstr_w(buffer));
return len;
}
@ -1622,7 +1670,7 @@ INT macdrv_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
UInt32 modifierKeyState;
OptionBits options;
UInt32 deadKeyState, savedDeadKeyState;
UniCharCount len;
UniCharCount len = 0;
BOOL dead = FALSE;
TRACE_(key)("virtKey 0x%04x scanCode 0x%04x lpKeyState %p bufW %p bufW_size %d flags 0x%08x hkl %p\n",
@ -1758,7 +1806,7 @@ INT macdrv_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
&savedDeadKeyState, bufW_size, &len, bufW);
if (status != noErr)
{
ERR_(key)("Couldn't translate keycode 0x%04x, status %d\n", keyc, status);
ERR_(key)("Couldn't translate dead keycode 0x%04x, status %d\n", keyc, status);
goto done;
}
@ -1768,8 +1816,7 @@ INT macdrv_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
if (len > 0)
len = strip_apple_private_chars(bufW, len);
if (dead && len > 0) ret = -1;
else ret = len;
ret = dead ? -len : len;
/* Control-Return produces line feed instead of carriage return. */
if (ret > 0 && (lpKeyState[VK_CONTROL] & 0x80) && virtKey == VK_RETURN)
@ -1783,10 +1830,10 @@ INT macdrv_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
done:
/* Null-terminate the buffer, if there's room. MSDN clearly states that the
caller must not assume this is done, but some programs (e.g. Audiosurf) do. */
if (1 <= ret && ret < bufW_size)
bufW[ret] = 0;
if (len < bufW_size)
bufW[len] = 0;
TRACE_(key)("returning %d / %s\n", ret, debugstr_wn(bufW, abs(ret)));
TRACE_(key)("returning %d / %s\n", ret, debugstr_wn(bufW, len));
return ret;
}

View File

@ -552,10 +552,7 @@ extern void macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev,
extern void macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame);
extern void macdrv_get_cocoa_window_frame(macdrv_window w, CGRect* out_frame);
extern void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent);
extern void macdrv_set_window_surface(macdrv_window w, struct window_surface *window_surface);
extern CGImageRef macdrv_get_surface_display_image(struct window_surface *window_surface, CGRect *rect, int copy_data, int color_keyed,
CGFloat key_red, CGFloat key_green, CGFloat key_blue);
extern void macdrv_window_needs_display(macdrv_window w, CGRect rect);
extern void macdrv_window_set_color_image(macdrv_window w, CGImageRef image, CGRect rect, CGRect dirty);
extern void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count);
extern void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha);
extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat keyGreen,

View File

@ -53,23 +53,33 @@ static inline int get_dib_image_size(const BITMAPINFO *info)
* abs(info->bmiHeader.biHeight);
}
static inline void reset_bounds(RECT *bounds)
{
bounds->left = bounds->top = INT_MAX;
bounds->right = bounds->bottom = INT_MIN;
}
struct macdrv_window_surface
{
struct window_surface header;
macdrv_window window;
BOOL use_alpha;
CGDataProviderRef provider;
BITMAPINFO info; /* variable size, must be last */
};
static struct macdrv_window_surface *get_mac_surface(struct window_surface *surface);
static CGDataProviderRef data_provider_create(size_t size, void **bits)
{
CGDataProviderRef provider;
CFMutableDataRef data;
if (!(data = CFDataCreateMutable(kCFAllocatorDefault, size))) return NULL;
CFDataSetLength(data, size);
if ((provider = CGDataProviderCreateWithCFData(data)))
*bits = CFDataGetMutableBytePtr(data);
CFRelease(data);
return provider;
}
/***********************************************************************
* macdrv_surface_get_bitmap_info
*/
@ -95,8 +105,21 @@ static void macdrv_surface_set_clip(struct window_surface *window_surface, const
static BOOL macdrv_surface_flush(struct window_surface *window_surface, const RECT *rect, const RECT *dirty)
{
struct macdrv_window_surface *surface = get_mac_surface(window_surface);
macdrv_window_needs_display(surface->window, cgrect_from_rect(*dirty));
return FALSE; /* bounds are reset asynchronously, from macdrv_get_surface_display_image */
CGImageAlphaInfo alpha_info = (surface->use_alpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst);
BITMAPINFO *color_info = &surface->info;
CGColorSpaceRef colorspace;
CGImageRef image;
colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
image = CGImageCreate(color_info->bmiHeader.biWidth, abs(color_info->bmiHeader.biHeight), 8, 32,
color_info->bmiHeader.biSizeImage / abs(color_info->bmiHeader.biHeight), colorspace,
alpha_info | kCGBitmapByteOrder32Little, surface->provider, NULL, retina_on, kCGRenderingIntentDefault);
CGColorSpaceRelease(colorspace);
macdrv_window_set_color_image(surface->window, image, cgrect_from_rect(*rect), cgrect_from_rect(*dirty));
CGImageRelease(image);
return TRUE;
}
/***********************************************************************
@ -107,6 +130,7 @@ static void macdrv_surface_destroy(struct window_surface *window_surface)
struct macdrv_window_surface *surface = get_mac_surface(window_surface);
TRACE("freeing %p\n", surface);
CGDataProviderRelease(surface->provider);
free(surface);
}
@ -130,11 +154,16 @@ static struct macdrv_window_surface *get_mac_surface(struct window_surface *surf
static struct window_surface *create_surface(HWND hwnd, macdrv_window window, const RECT *rect,
struct window_surface *old_surface, BOOL use_alpha)
{
struct macdrv_window_surface *surface;
struct macdrv_window_surface *surface = NULL;
int width = rect->right - rect->left, height = rect->bottom - rect->top;
DWORD window_background;
D3DKMT_CREATEDCFROMMEMORY desc = {.Format = D3DDDIFMT_A8R8G8B8};
char buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
BITMAPINFO *info = (BITMAPINFO *)buffer;
CGDataProviderRef provider;
HBITMAP bitmap = 0;
UINT status;
void *bits;
memset(info, 0, sizeof(*info));
info->bmiHeader.biSize = sizeof(info->bmiHeader);
@ -145,14 +174,31 @@ static struct window_surface *create_surface(HWND hwnd, macdrv_window window, co
info->bmiHeader.biSizeImage = get_dib_image_size(info);
info->bmiHeader.biCompression = BI_RGB;
surface = calloc(1, FIELD_OFFSET(struct macdrv_window_surface, info.bmiColors[3]));
if (!surface) return NULL;
if (!window_surface_init(&surface->header, &macdrv_surface_funcs, hwnd, rect, info, 0)) goto failed;
if (!(provider = data_provider_create(info->bmiHeader.biSizeImage, &bits))) return NULL;
/* wrap the data in a HBITMAP so we can write to the surface pixels directly */
desc.Width = info->bmiHeader.biWidth;
desc.Height = abs(info->bmiHeader.biHeight);
desc.Pitch = info->bmiHeader.biSizeImage / abs(info->bmiHeader.biHeight);
desc.pMemory = bits;
desc.hDeviceDc = NtUserGetDCEx(hwnd, 0, DCX_CACHE | DCX_WINDOW);
if ((status = NtGdiDdDDICreateDCFromMemory(&desc)))
ERR("Failed to create HBITMAP, status %#x\n", status);
else
{
bitmap = desc.hBitmap;
NtGdiDeleteObjectApp(desc.hDc);
}
if (desc.hDeviceDc) NtUserReleaseDC(hwnd, desc.hDeviceDc);
if (!(surface = calloc(1, FIELD_OFFSET(struct macdrv_window_surface, info.bmiColors[3])))) goto failed;
if (!window_surface_init(&surface->header, &macdrv_surface_funcs, hwnd, rect, info, bitmap)) goto failed;
memcpy(&surface->info, info, offsetof(BITMAPINFO, bmiColors[3]));
surface->window = window;
if (old_surface) surface->header.bounds = old_surface->bounds;
surface->use_alpha = use_alpha;
surface->provider = provider;
window_background = macdrv_window_background_color();
memset_pattern4(surface->header.color_bits, &window_background, info->bmiHeader.biSizeImage);
@ -163,7 +209,9 @@ static struct window_surface *create_surface(HWND hwnd, macdrv_window window, co
return &surface->header;
failed:
window_surface_release(&surface->header);
if (surface) window_surface_release(&surface->header);
if (bitmap) NtGdiDeleteObjectApp(bitmap);
CGDataProviderRelease(provider);
return NULL;
}
@ -176,108 +224,6 @@ void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha
if (surface) surface->use_alpha = use_alpha;
}
/***********************************************************************
* create_surface_image
*
* Caller must hold the surface lock. On input, *rect is the requested
* image rect, relative to the window whole_rect, a.k.a. visible_rect.
* On output, it's been intersected with that part backed by the surface
* and is the actual size of the returned image. copy_data indicates if
* the caller will keep the returned image beyond the point where the
* surface bits can be guaranteed to remain valid and unchanged. If so,
* the bits are copied instead of merely referenced by the image.
*
* IMPORTANT: This function is called from non-Wine threads, so it
* must not use Win32 or Wine functions, including debug
* logging.
*/
CGImageRef macdrv_get_surface_display_image(struct window_surface *window_surface, CGRect *rect, int copy_data, int color_keyed,
CGFloat key_red, CGFloat key_green, CGFloat key_blue)
{
CGImageRef cgimage = NULL;
struct macdrv_window_surface *surface = get_mac_surface(window_surface);
RECT surface_rect = window_surface->rect;
int width, height;
pthread_mutex_lock(&window_surface->mutex);
if (IsRectEmpty(&window_surface->bounds)) goto done;
width = surface_rect.right - surface_rect.left;
height = surface_rect.bottom - surface_rect.top;
*rect = CGRectIntersection(cgrect_from_rect(surface_rect), *rect);
if (!CGRectIsEmpty(*rect))
{
CGRect visrect;
CGColorSpaceRef colorspace;
CGDataProviderRef provider;
int bytes_per_row, offset, size;
CGImageAlphaInfo alphaInfo;
visrect = CGRectOffset(*rect, -surface_rect.left, -surface_rect.top);
colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
bytes_per_row = get_dib_stride(width, 32);
offset = CGRectGetMinX(visrect) * 4 + CGRectGetMinY(visrect) * bytes_per_row;
size = min(CGRectGetHeight(visrect) * bytes_per_row,
surface->info.bmiHeader.biSizeImage - offset);
if (copy_data)
{
CFDataRef data = CFDataCreate(NULL, (UInt8 *)window_surface->color_bits + offset, size);
provider = CGDataProviderCreateWithCFData(data);
CFRelease(data);
}
else
provider = CGDataProviderCreateWithData(NULL, (UInt8 *)window_surface->color_bits + offset, size, NULL);
alphaInfo = surface->use_alpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst;
cgimage = CGImageCreate(CGRectGetWidth(visrect), CGRectGetHeight(visrect),
8, 32, bytes_per_row, colorspace,
alphaInfo | kCGBitmapByteOrder32Little,
provider, NULL, retina_on, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);
CGColorSpaceRelease(colorspace);
if (color_keyed)
{
CGImageRef maskedImage;
CGFloat components[] = { key_red - 0.5, key_red + 0.5,
key_green - 0.5, key_green + 0.5,
key_blue - 0.5, key_blue + 0.5 };
maskedImage = CGImageCreateWithMaskingColors(cgimage, components);
if (maskedImage)
{
CGImageRelease(cgimage);
cgimage = maskedImage;
}
}
}
done:
reset_bounds(&window_surface->bounds);
pthread_mutex_unlock(&window_surface->mutex);
return cgimage;
}
/***********************************************************************
* surface_clip_to_visible_rect
*
* Intersect the accumulated drawn region with a new visible rect,
* effectively discarding stale drawing in the surface slack area.
*/
static void surface_clip_to_visible_rect(struct window_surface *window_surface, const RECT *visible_rect)
{
struct macdrv_window_surface *surface = get_mac_surface(window_surface);
RECT rect = *visible_rect;
OffsetRect(&rect, -rect.left, -rect.top);
if (!surface) return;
window_surface_lock(window_surface);
intersect_rect(&window_surface->bounds, &window_surface->bounds, &rect);
window_surface_unlock(window_surface);
}
static inline RECT get_surface_rect(const RECT *visible_rect)
{
@ -314,7 +260,6 @@ BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_r
if (EqualRect(&data->surface->rect, &surface_rect))
{
/* existing surface is good enough */
surface_clip_to_visible_rect(data->surface, visible_rect);
window_surface_add_ref(data->surface);
*surface = data->surface;
goto done;
@ -352,7 +297,6 @@ BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF col
if (!surface || !EqualRect(&surface->rect, &rect))
{
data->surface = create_surface(data->hwnd, data->cocoa_window, &rect, NULL, TRUE);
macdrv_set_window_surface(data->cocoa_window, data->surface);
if (surface) window_surface_release(surface);
surface = data->surface;
if (data->unminimized_surface)

View File

@ -2011,7 +2011,6 @@ void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags,
}
else
{
macdrv_set_window_surface(data->cocoa_window, surface);
if (data->unminimized_surface)
{
window_surface_release(data->unminimized_surface);

View File

@ -144,6 +144,8 @@ typedef struct _EVT_VARIANT {
typedef DWORD (WINAPI *EVT_SUBSCRIBE_CALLBACK)(EVT_SUBSCRIBE_NOTIFY_ACTION Action,
PVOID UserContext, EVT_HANDLE Event);
EVT_HANDLE WINAPI EvtCreateBookmark(LPCWSTR);
EVT_HANDLE WINAPI EvtCreateRenderContext(DWORD,LPCWSTR*,DWORD);
BOOL WINAPI EvtClose(EVT_HANDLE);
BOOL WINAPI EvtExportLog(EVT_HANDLE session, const WCHAR *path, const WCHAR *query,
const WCHAR *file, DWORD flags);
@ -159,7 +161,7 @@ EVT_HANDLE WINAPI EvtSubscribe(EVT_HANDLE Session, HANDLE SignalEvent, LPCWSTR C
LPCWSTR Query, EVT_HANDLE Bookmark, PVOID context,
EVT_SUBSCRIBE_CALLBACK Callback, DWORD Flags);
EVT_HANDLE WINAPI EvtOpenChannelConfig(EVT_HANDLE Session, LPCWSTR ChannelPath, DWORD Flags);
BOOL WINAPI EvtSaveChannelConfig(EVT_HANDLE, DWORD);
BOOL WINAPI EvtSaveChannelConfig(EVT_HANDLE,DWORD);
#ifdef __cplusplus
} /* extern "C" */

View File

@ -16,7 +16,7 @@ UNIX_CFLAGS = -fPIE
preloader_EXTRADEFS = -fno-builtin
main_EXTRADEFS = -DDLLDIR=\"${libdir}/wine\" -DBIN_TO_DLLDIR=\"`${MAKEDEP} -R ${bindir} ${libdir}/wine`\"
main_EXTRADEFS = -DBINDIR=\"${bindir}\" -DLIBDIR=\"${libdir}\"
wine_OBJS = main.o
wine_DEPS = $(WINELOADER_DEPENDS)

View File

@ -125,6 +125,43 @@ static char *build_path( const char *dir, const char *name )
return ret;
}
/* build a path with the relative dir from 'from' to 'dest' appended to base */
static char *build_relative_path( const char *base, const char *from, const char *dest )
{
const char *start;
char *ret;
unsigned int dotdots = 0;
for (;;)
{
while (*from == '/') from++;
while (*dest == '/') dest++;
start = dest; /* save start of next path element */
if (!*from) break;
while (*from && *from != '/' && *from == *dest) { from++; dest++; }
if ((!*from || *from == '/') && (!*dest || *dest == '/')) continue;
do /* count remaining elements in 'from' */
{
dotdots++;
while (*from && *from != '/') from++;
while (*from == '/') from++;
}
while (*from);
break;
}
ret = malloc( strlen(base) + 3 * dotdots + strlen(start) + 2 );
strcpy( ret, base );
while (dotdots--) strcat( ret, "/.." );
if (!start[0]) return ret;
strcat( ret, "/" );
strcat( ret, start );
return ret;
}
static const char *get_self_exe( char *argv0 )
{
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
@ -187,11 +224,10 @@ static void *load_ntdll( char *argv0 )
if (self && ((path = realpath_dirname( self ))))
{
if ((p = remove_tail( path, "/loader" )))
{
handle = try_dlopen( p, "dlls/ntdll/ntdll.so" );
free( p );
}
else handle = try_dlopen( path, BIN_TO_DLLDIR "/" SO_DIR "ntdll.so" );
else if ((p = build_relative_path( path, BINDIR, LIBDIR )))
handle = try_dlopen( p, "wine/" SO_DIR "ntdll.so" );
free( p );
free( path );
}
@ -207,7 +243,7 @@ static void *load_ntdll( char *argv0 )
free( path );
}
if (!handle && !self) handle = try_dlopen( DLLDIR, SO_DIR "ntdll.so" );
if (!handle && !self) handle = try_dlopen( LIBDIR, "wine/" SO_DIR "ntdll.so" );
return handle;
}

View File

@ -5,7 +5,7 @@ msgstr ""
"Project-Id-Version: Wine\n"
"Report-Msgid-Bugs-To: https://bugs.winehq.org\n"
"POT-Creation-Date: N/A\n"
"PO-Revision-Date: 2024-04-03 22:59+0300\n"
"PO-Revision-Date: 2024-06-25 00:23+0300\n"
"Last-Translator: Aurimas Fišeras <aurimas@members.fsf.org>\n"
"Language-Team: Lithuanian <komp_lt@konf.lt>\n"
"Language: lt\n"
@ -14582,10 +14582,8 @@ msgstr ""
" šešioliktainis (0x34) arba aštuntainis (056).\n"
#: programs/cmd/cmd.rc:411
#, fuzzy
#| msgid "Syntax error\n"
msgid "Syntax error: unexpected %1\n"
msgstr "Sintaksės klaida\n"
msgstr "Sintaksės klaida: netikėtas %1\n"
#: programs/conhost/conhost.rc:54
msgid "Cursor size"

View File

@ -49,4 +49,4 @@ SOURCES = \
UNIX_LIBS = $(LDEXECFLAGS) $(RT_LIBS) $(INOTIFY_LIBS) $(PROCSTAT_LIBS)
unicode_EXTRADEFS = -DNLSDIR="\"${datadir}/wine/nls\"" -DBIN_TO_NLSDIR=\"`${MAKEDEP} -R ${bindir} ${datadir}/wine/nls`\"
unicode_EXTRADEFS = -DBINDIR="\"${bindir}\"" -DDATADIR="\"${datadir}\""

View File

@ -235,10 +235,46 @@ int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2]
return count;
}
/* build a path with the relative dir from 'from' to 'dest' appended to base */
static char *build_relative_path( const char *base, const char *from, const char *dest )
{
const char *start;
char *ret;
unsigned int dotdots = 0;
for (;;)
{
while (*from == '/') from++;
while (*dest == '/') dest++;
start = dest; /* save start of next path element */
if (!*from) break;
while (*from && *from != '/' && *from == *dest) { from++; dest++; }
if ((!*from || *from == '/') && (!*dest || *dest == '/')) continue;
do /* count remaining elements in 'from' */
{
dotdots++;
while (*from && *from != '/') from++;
while (*from == '/') from++;
}
while (*from);
break;
}
ret = malloc( strlen(base) + 3 * dotdots + strlen(start) + 2 );
strcpy( ret, base );
while (dotdots--) strcat( ret, "/.." );
if (!start[0]) return ret;
strcat( ret, "/" );
strcat( ret, start );
return ret;
}
static char *get_nls_dir(void)
{
char *p, *dir, *ret;
const char *nlsdir = BIN_TO_NLSDIR;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir = realpath( "/proc/self/exe", NULL );
@ -264,8 +300,12 @@ static char *get_nls_dir(void)
return NULL;
}
*(++p) = 0;
if (p > dir + 8 && !strcmp( p - 8, "/server/" )) nlsdir = "../nls"; /* inside build tree */
asprintf( &ret, "%s%s", dir, nlsdir );
if (p > dir + 8 && !strcmp( p - 8, "/server/" )) /* inside build tree */
{
strcpy( p - 8, "/nls" );
return dir;
}
ret = build_relative_path( dir, BINDIR, DATADIR "/wine/nls" );
free( dir );
return ret;
}
@ -273,7 +313,7 @@ static char *get_nls_dir(void)
/* load the case mapping table */
struct fd *load_intl_file(void)
{
static const char *nls_dirs[] = { NULL, NLSDIR, "/usr/local/share/wine/nls", "/usr/share/wine/nls" };
static const char *nls_dirs[] = { NULL, DATADIR "/wine/nls", "/usr/local/share/wine/nls", "/usr/share/wine/nls" };
static const WCHAR nt_pathW[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\','l','_','i','n','t','l','.','n','l','s',0};
static const struct unicode_str nt_name = { nt_pathW, sizeof(nt_pathW) };

View File

@ -3,8 +3,8 @@ PROGRAMS = \
make_xftmpl
SOURCES = \
makedep.c \
make_xftmpl.c \
makedep.c \
wineapploader.in
makedep_OBJS = makedep.o

View File

@ -41,7 +41,6 @@ my %modules16 =
my %ignored_source_files = (
"dlls/wineps.drv/afm2c.c" => 1,
"dlls/wineps.drv/mkagl.c" => 1,
"tools/makedep.c" => 1,
);
my (@makefiles, %makefiles);

View File

@ -326,6 +326,43 @@ static inline char *replace_extension( const char *name, const char *old_ext, co
return strmake( "%.*s%s", name_len, name, new_ext );
}
/* build a path with the relative dir from 'from' to 'dest' appended to base */
static inline char *build_relative_path( const char *base, const char *from, const char *dest )
{
const char *start;
char *ret;
unsigned int dotdots = 0;
for (;;)
{
while (*from == '/') from++;
while (*dest == '/') dest++;
start = dest; /* save start of next path element */
if (!*from) break;
while (*from && *from != '/' && *from == *dest) { from++; dest++; }
if ((!*from || *from == '/') && (!*dest || *dest == '/')) continue;
do /* count remaining elements in 'from' */
{
dotdots++;
while (*from && *from != '/') from++;
while (*from == '/') from++;
}
while (*from);
break;
}
ret = xmalloc( strlen(base) + 3 * dotdots + strlen(start) + 2 );
strcpy( ret, base );
while (dotdots--) strcat( ret, "/.." );
if (!start[0]) return ret;
strcat( ret, "/" );
strcat( ret, start );
return ret;
}
/* temp files management */
extern const char *temp_dir;
@ -651,7 +688,7 @@ static inline struct target init_argv0_target( const char *argv0 )
}
static inline char *get_argv0_dir( const char *argv0 )
static inline char *get_bindir( const char *argv0 )
{
#ifndef _WIN32
char *dir = NULL;
@ -673,6 +710,49 @@ static inline char *get_argv0_dir( const char *argv0 )
#endif
}
#ifdef LIBDIR
static inline const char *get_libdir( const char *bindir )
{
#ifdef BINDIR
if (bindir) return build_relative_path( bindir, BINDIR, LIBDIR );
#endif
return LIBDIR;
}
#endif
#ifdef DATADIR
static inline const char *get_datadir( const char *bindir )
{
#ifdef BINDIR
if (bindir) return build_relative_path( bindir, BINDIR, DATADIR );
#endif
return DATADIR;
}
#endif
#ifdef INCLUDEDIR
static inline const char *get_includedir( const char *bindir )
{
#ifdef BINDIR
if (bindir) return build_relative_path( bindir, BINDIR, INCLUDEDIR );
#endif
return INCLUDEDIR;
}
#endif
static inline const char *get_nlsdir( const char *bindir, const char *srcdir )
{
if (bindir && strendswith( bindir, srcdir )) return strmake( "%s/../../nls", bindir );
#ifdef DATADIR
else
{
const char *datadir = get_datadir( bindir );
if (datadir) return strmake( "%s/wine/nls", datadir );
}
#endif
return NULL;
}
/* output buffer management */

View File

@ -24,10 +24,6 @@ SOURCES = \
write_msft.c \
write_sltg.c
widl_EXTRADEFS = \
-DINCLUDEDIR="\"${includedir}\"" \
-DDLLDIR="\"${libdir}/wine\"" \
-DBIN_TO_INCLUDEDIR=\"`${MAKEDEP} -R ${bindir} ${includedir}`\" \
-DBIN_TO_DLLDIR=\"`${MAKEDEP} -R ${bindir} ${libdir}/wine`\"
widl_EXTRADEFS = -DINCLUDEDIR="\"${includedir}\"" -DBINDIR="\"${bindir}\"" -DLIBDIR="\"${libdir}\""
INSTALL_DEV = $(PROGRAMS)

View File

@ -112,28 +112,24 @@ static int is_float_type(const type_t *type)
expr_t *make_expr(enum expr_type type)
{
expr_t *e = xmalloc(sizeof(expr_t));
memset(e, 0, sizeof(*e));
e->type = type;
e->ref = NULL;
e->u.lval = 0;
e->is_const = FALSE;
e->cval = 0;
return e;
}
expr_t *make_exprl(enum expr_type type, int val)
expr_t *make_exprl(enum expr_type type, const struct integer *integer)
{
expr_t *e = xmalloc(sizeof(expr_t));
memset(e, 0, sizeof(*e));
e->type = type;
e->ref = NULL;
e->u.lval = val;
e->is_const = FALSE;
e->u.integer = *integer;
/* check for numeric constant */
if (type == EXPR_NUM || type == EXPR_HEXNUM || type == EXPR_TRUEFALSE)
if (type == EXPR_NUM || type == EXPR_TRUEFALSE)
{
/* make sure true/false value is valid */
assert(type != EXPR_TRUEFALSE || val == 0 || val == 1);
assert(type != EXPR_TRUEFALSE || integer->value == 0 || integer->value == 1);
e->is_const = TRUE;
e->cval = val;
e->cval = integer->value;
}
return e;
}
@ -252,10 +248,9 @@ expr_t *make_expr1(enum expr_type type, expr_t *expr)
{
expr_t *e;
e = xmalloc(sizeof(expr_t));
memset(e, 0, sizeof(*e));
e->type = type;
e->ref = expr;
e->u.lval = 0;
e->is_const = FALSE;
/* check for compile-time optimization */
if (expr->is_const)
{
@ -514,11 +509,10 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
{
case EXPR_VOID:
break;
case EXPR_HEXNUM:
case EXPR_NUM:
case EXPR_TRUEFALSE:
result.is_temporary = FALSE;
result.type = type_new_int(TYPE_BASIC_INT, 0);
result.type = type_new_int(e->u.integer.is_long ? TYPE_BASIC_LONG : TYPE_BASIC_INT, e->u.integer.is_unsigned);
break;
case EXPR_STRLIT:
result.is_temporary = TRUE;
@ -692,16 +686,20 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
case EXPR_VOID:
break;
case EXPR_NUM:
fprintf(h, "%u", e->u.lval);
break;
case EXPR_HEXNUM:
fprintf(h, "0x%x", e->u.lval);
if (e->u.integer.is_hex)
fprintf(h, "0x%x", e->u.integer.value);
else
fprintf(h, "%u", e->u.integer.value);
if (e->u.integer.is_unsigned)
fprintf(h, "u");
if (e->u.integer.is_long)
fprintf(h, "l");
break;
case EXPR_DOUBLE:
fprintf(h, "%#.15g", e->u.dval);
break;
case EXPR_TRUEFALSE:
if (e->u.lval == 0)
if (e->u.integer.value == 0)
fprintf(h, "FALSE");
else
fprintf(h, "TRUE");
@ -869,9 +867,8 @@ int compare_expr(const expr_t *a, const expr_t *b)
switch (a->type)
{
case EXPR_NUM:
case EXPR_HEXNUM:
case EXPR_TRUEFALSE:
return a->u.lval - b->u.lval;
return a->u.integer.value - b->u.integer.value;
case EXPR_DOUBLE:
return a->u.dval - b->u.dval;
case EXPR_IDENTIFIER:

View File

@ -26,7 +26,7 @@ struct expr_loc
};
extern expr_t *make_expr(enum expr_type type);
extern expr_t *make_exprl(enum expr_type type, int val);
extern expr_t *make_exprl(enum expr_type type, const struct integer *integer);
extern expr_t *make_exprd(enum expr_type type, double val);
extern expr_t *make_exprs(enum expr_type type, char *val);
extern expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr);

View File

@ -1583,7 +1583,7 @@ static void write_apicontract_guard_start(FILE *header, const expr_t *expr)
int ver;
if (!winrt_mode) return;
type = expr->u.tref.type;
ver = expr->ref->u.lval;
ver = expr->ref->u.integer.value;
name = format_apicontract_macro(type);
fprintf(header, "#if %s_VERSION >= %#x\n", name, ver);
free(name);
@ -1596,7 +1596,7 @@ static void write_apicontract_guard_end(FILE *header, const expr_t *expr)
int ver;
if (!winrt_mode) return;
type = expr->u.tref.type;
ver = expr->ref->u.lval;
ver = expr->ref->u.integer.value;
name = format_apicontract_macro(type);
fprintf(header, "#endif /* %s_VERSION >= %#x */\n", name, ver);
free(name);

View File

@ -154,10 +154,13 @@ static int token_str( int token, const char *str, YYSTYPE *yylval )
return token;
}
static int token_num( int token, const char *yytext, YYSTYPE *yylval )
static int token_num( const char *yytext, YYSTYPE *yylval, int is_hex )
{
yylval->num = xstrtoul( yytext, NULL, 0 );
return token;
yylval->integer.value = xstrtoul( yytext, NULL, 0 );
yylval->integer.is_hex = is_hex;
yylval->integer.is_long = !!strchr(yytext, 'l');
yylval->integer.is_unsigned = !!strchr(yytext, 'u');
return is_hex ? aHEXNUM : aNUM;
}
static int token_ident( const char *str, YYSTYPE *yylval )
@ -431,8 +434,8 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
[a-zA-Z_][0-9a-zA-Z_]* { return token_ident( yytext, yylval ); }
0[xX]{hd}+([lL][uU]?|[uU][lL]?)? { return token_num( aHEXNUM, yytext, yylval ); }
[0-9]+([lL][uU]?|[uU][lL]?)? { return token_num( aNUM, yytext, yylval ); }
0[xX]{hd}+[uU]?[lL]? { return token_num( yytext, yylval, TRUE ); }
[0-9]+[uU]?[lL]? { return token_num( yytext, yylval, FALSE ); }
L\"(\\.|[^"\\])*\" { return token_str( aWSTRING, yytext + 1, yylval ); }
\"(\\.|[^"\\])*\" { return token_str( aSTRING, yytext, yylval ); }

View File

@ -151,6 +151,7 @@ PARSER_LTYPE pop_import(void);
char *str;
struct uuid *uuid;
unsigned int num;
struct integer integer;
double dbl;
typelib_t *typelib;
struct _import_t *import;
@ -163,7 +164,7 @@ PARSER_LTYPE pop_import(void);
%token <str> aIDENTIFIER aPRAGMA
%token <str> aKNOWNTYPE
%token <num> aNUM aHEXNUM
%token <integer> aNUM aHEXNUM
%token <dbl> aDOUBLE
%token <str> aSTRING aWSTRING aSQSTRING
%token <str> tCDECL
@ -494,8 +495,8 @@ pragma_warning: tPRAGMA_WARNING '(' aIDENTIFIER ':' warnings ')'
;
warnings:
aNUM { $$ = append_warning(NULL, $1); }
| warnings aNUM { $$ = append_warning($1, $2); }
aNUM { $$ = append_warning(NULL, $1.value); }
| warnings aNUM { $$ = append_warning($1, $2.value); }
;
typedecl:
@ -591,17 +592,19 @@ marshaling_behavior:
;
contract_ver:
aNUM { $$ = MAKEVERSION(0, $1); }
| aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); }
aNUM { $$ = MAKEVERSION(0, $1.value); }
| aNUM '.' aNUM { $$ = MAKEVERSION($3.value, $1.value); }
;
contract_req
: decl_spec ',' contract_ver { if ($1->type->type_type != TYPE_APICONTRACT)
error_loc("type %s is not an apicontract\n", $1->type->name);
$$ = make_exprl(EXPR_NUM, $3);
$$ = make_exprt(EXPR_GTREQL, declare_var(NULL, $1, make_declarator(NULL), 0), $$);
}
;
: decl_spec ',' contract_ver {
struct integer integer = {.value = $3};
if ($1->type->type_type != TYPE_APICONTRACT)
error_loc("type %s is not an apicontract\n", $1->type->name);
$$ = make_exprl(EXPR_NUM, &integer);
$$ = make_exprt(EXPR_GTREQL, declare_var(NULL, $1, make_declarator(NULL), 0), $$);
}
;
static_attr
: decl_spec ',' contract_req { if ($1->type->type_type != TYPE_INTERFACE)
@ -793,21 +796,28 @@ enums
| enum_list
;
enum_list: enum { if (!$1->eval)
$1->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */);
enum_list: enum {
struct integer integer = {.value = 0};
if (!$1->eval)
$1->eval = make_exprl(EXPR_NUM, &integer);
$$ = append_var( NULL, $1 );
}
| enum_list ',' enum { if (!$3->eval)
}
| enum_list ',' enum {
if (!$3->eval)
{
var_t *last = LIST_ENTRY( list_tail($$), var_t, entry );
enum expr_type type = EXPR_NUM;
if (last->eval->type == EXPR_HEXNUM) type = EXPR_HEXNUM;
if (last->eval->cval + 1 < 0) type = EXPR_HEXNUM;
$3->eval = make_exprl(type, last->eval->cval + 1);
struct integer integer;
if (last->eval->type == EXPR_NUM)
integer.is_hex = last->eval->u.integer.is_hex;
integer.value = last->eval->cval + 1;
if (integer.value < 0)
integer.is_hex = TRUE;
$3->eval = make_exprl(EXPR_NUM, &integer);
}
$$ = append_var( $1, $3 );
}
;
}
;
enum_member: m_attributes ident { $$ = $2;
$$->attrs = check_enum_member_attrs($1);
@ -835,12 +845,15 @@ m_expr
| expr
;
expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
| aHEXNUM { $$ = make_exprl(EXPR_HEXNUM, $1); }
expr: aNUM { $$ = make_exprl(EXPR_NUM, &$1); }
| aHEXNUM { $$ = make_exprl(EXPR_NUM, &$1); }
| aDOUBLE { $$ = make_exprd(EXPR_DOUBLE, $1); }
| tFALSE { $$ = make_exprl(EXPR_TRUEFALSE, 0); }
| tNULL { $$ = make_exprl(EXPR_NUM, 0); }
| tTRUE { $$ = make_exprl(EXPR_TRUEFALSE, 1); }
| tFALSE { struct integer integer = {.value = 0};
$$ = make_exprl(EXPR_TRUEFALSE, &integer); }
| tNULL { struct integer integer = {.value = 0};
$$ = make_exprl(EXPR_NUM, &integer); }
| tTRUE { struct integer integer = {.value = 1};
$$ = make_exprl(EXPR_TRUEFALSE, &integer); }
| aSTRING { $$ = make_exprs(EXPR_STRLIT, $1); }
| aWSTRING { $$ = make_exprs(EXPR_WSTRLIT, $1); }
| aSQSTRING { $$ = make_exprs(EXPR_CHARCONST, $1); }
@ -1371,9 +1384,9 @@ uniondef: tUNION m_typename '{' ne_union_fields '}'
;
version:
aNUM { $$ = MAKEVERSION($1, 0); }
| aNUM '.' aNUM { $$ = MAKEVERSION($1, $3); }
| aHEXNUM { $$ = $1; }
aNUM { $$ = MAKEVERSION($1.value, 0); }
| aNUM '.' aNUM { $$ = MAKEVERSION($1.value, $3.value); }
| aHEXNUM { $$ = $1.value; }
;
acf_statements

View File

@ -134,8 +134,9 @@ struct strarray temp_files = { 0 };
const char *temp_dir = NULL;
const char *prefix_client = "";
const char *prefix_server = "";
static const char *bindir;
static const char *libdir;
static const char *includedir;
static const char *dlldir;
static struct strarray dlldirs;
static char *output_name;
static const char *sysroot = "";
@ -469,15 +470,6 @@ void write_id_data(const statement_list_t *stmts)
fclose(idfile);
}
static void init_argv0_dir( const char *argv0 )
{
char *dir = get_argv0_dir( argv0 );
if (!dir) return;
includedir = strmake( "%s/%s", dir, BIN_TO_INCLUDEDIR );
dlldir = strmake( "%s/%s", dir, BIN_TO_DLLDIR );
}
static void option_callback( int optc, char *optarg )
{
switch (optc)
@ -643,7 +635,7 @@ static void option_callback( int optc, char *optarg )
int open_typelib( const char *name )
{
static const char *default_dirs[] = { DLLDIR, "/usr/lib/wine", "/usr/local/lib/wine" };
static const char *default_dirs[] = { LIBDIR "/wine", "/usr/lib/wine", "/usr/local/lib/wine" };
struct target win_target = { target.cpu, PLATFORM_WINDOWS };
const char *pe_dir = get_arch_dir( win_target );
int fd;
@ -672,10 +664,10 @@ int open_typelib( const char *name )
if (stdinc)
{
if (dlldir)
if (libdir)
{
TRYOPEN( strmake( "%s%s/%s", dlldir, pe_dir, name ));
TRYOPEN( strmake( "%s/%s", dlldir, name ));
TRYOPEN( strmake( "%s/wine%s/%s", libdir, pe_dir, name ));
TRYOPEN( strmake( "%s/wine/%s", libdir, name ));
}
for (i = 0; i < ARRAY_SIZE(default_dirs); i++)
{
@ -694,7 +686,9 @@ int main(int argc,char *argv[])
struct strarray files;
init_signals( exit_on_signal );
init_argv0_dir( argv[0] );
bindir = get_bindir( argv[0] );
libdir = get_libdir( bindir );
includedir = get_includedir( bindir );
target = init_argv0_target( argv[0] );
now = time(NULL);

View File

@ -191,7 +191,6 @@ enum expr_type
{
EXPR_VOID,
EXPR_NUM,
EXPR_HEXNUM,
EXPR_DOUBLE,
EXPR_IDENTIFIER,
EXPR_NEG,
@ -349,11 +348,19 @@ struct _attr_t {
struct location where;
};
struct integer
{
int value;
int is_unsigned;
int is_long;
int is_hex;
};
struct _expr_t {
enum expr_type type;
const expr_t *ref;
union {
int lval;
struct integer integer;
double dval;
const char *sval;
const expr_t *ext;

View File

@ -1299,9 +1299,8 @@ static void set_custdata_attr(msft_typelib_t *typelib, attr_custdata_t *custdata
case EXPR_WSTRLIT:
set_custdata(typelib, &custdata->id, VT_BSTR, custdata->pval->u.sval, offset);
break;
case EXPR_HEXNUM:
case EXPR_NUM:
set_custdata(typelib, &custdata->id, VT_I4, &custdata->pval->u.lval, offset);
set_custdata(typelib, &custdata->id, VT_I4, &custdata->pval->u.integer.value, offset);
break;
default:
error("custom() attribute with unknown type\n");
@ -1395,7 +1394,7 @@ static int add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
break;
case ATTR_HELPCONTEXT:
extra_attr = max(extra_attr, 1);
help_context = expr->u.lval;
help_context = expr->u.integer.value;
break;
case ATTR_HELPSTRING:
extra_attr = max(extra_attr, 2);
@ -1403,7 +1402,7 @@ static int add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
break;
case ATTR_HELPSTRINGCONTEXT:
extra_attr = max(extra_attr, 6);
help_string_context = expr->u.lval;
help_string_context = expr->u.integer.value;
break;
case ATTR_HIDDEN:
funcflags |= 0x40; /* FUNCFLAG_FHIDDEN */

View File

@ -1060,7 +1060,7 @@ static int get_func_flags(const var_t *func, int *dispid, int *invokekind, int *
flags |= 0x10; /* FUNCFLAG_FDISPLAYBIND */
break;
case ATTR_HELPCONTEXT:
*helpcontext = expr->u.lval;
*helpcontext = expr->u.integer.value;
break;
case ATTR_HELPSTRING:
*helpstring = attr->u.pval;

View File

@ -9,9 +9,8 @@ winegcc_SYMLINKS = winecpp wineg++
winegcc_EXTRADEFS = \
-DINCLUDEDIR="\"${includedir}\"" \
-DBINDIR="\"${bindir}\"" \
-DLIBDIR="\"${libdir}\"" \
-DBIN_TO_INCLUDEDIR=\"`${MAKEDEP} -R ${bindir} ${includedir}`\" \
-DBIN_TO_LIBDIR=\"`${MAKEDEP} -R ${bindir} ${libdir}`\" \
-DCC="\"$(CC)\"" \
-DCPP="\"$(CPPBIN)\"" \
-DCXX="\"$(CXX)\"" \

View File

@ -611,13 +611,6 @@ static char *get_lib_dir( struct options *opts )
return strmake( "%s%s", root, LIBDIR );
}
static void init_argv0_dir( const char *argv0 )
{
if (!(bindir = get_argv0_dir( argv0 ))) return;
includedir = strmake( "%s/%s", bindir, BIN_TO_INCLUDEDIR );
libdir = strmake( "%s/%s", bindir, BIN_TO_LIBDIR );
}
static void compile(struct options* opts, const char* lang)
{
struct strarray comp_args = get_translator(opts);
@ -1489,7 +1482,9 @@ int main(int argc, char **argv)
char* str;
init_signals( exit_on_signal );
init_argv0_dir( argv[0] );
bindir = get_bindir( argv[0] );
libdir = get_libdir( bindir );
includedir = get_includedir( bindir );
/* setup tmp file removal at exit */
atexit(clean_temp_files);

View File

@ -11,8 +11,6 @@ SOURCES = \
wmc.man.in \
write.c
wmc_EXTRADEFS = \
-DNLSDIR="\"${datadir}/wine/nls\"" \
-DBIN_TO_NLSDIR=\"`${MAKEDEP} -R ${bindir} ${datadir}/wine/nls`\"
wmc_EXTRADEFS = -DBINDIR="\"${bindir}\"" -DDATADIR="\"${datadir}\""
INSTALL_DEV = $(PROGRAMS)

View File

@ -94,7 +94,8 @@ char *output_name = NULL; /* The name given by the -o option */
const char *input_name = NULL; /* The name given on the command-line */
char *header_name = NULL; /* The name given by the -H option */
const char *nlsdirs[3] = { NULL, NLSDIR, NULL };
static const char *bindir;
const char *nlsdirs[3] = { NULL, DATADIR "/wine/nls", NULL };
int line_number = 1; /* The current line */
int char_number = 1; /* The current char pos within the line */
@ -143,15 +144,6 @@ static void exit_on_signal( int sig )
exit(1); /* this will call the atexit functions */
}
static void init_argv0_dir( const char *argv0 )
{
char *dir = get_argv0_dir( argv0 );
if (!dir) return;
if (strendswith( dir, "/tools/wmc" )) nlsdirs[0] = strmake( "%s/../../nls", dir );
else nlsdirs[0] = strmake( "%s/%s", dir, BIN_TO_NLSDIR );
}
static void option_callback( int optc, char *optarg )
{
switch(optc)
@ -221,7 +213,8 @@ int main(int argc,char *argv[])
atexit( cleanup_files );
init_signals( exit_on_signal );
init_argv0_dir( argv[0] );
bindir = get_bindir( argv[0] );
nlsdirs[0] = get_nlsdir( bindir, "/tools/wmc" );
/* First rebuild the commandline to put in destination */
/* Could be done through env[], but not all OS-es support it */

View File

@ -14,10 +14,6 @@ SOURCES = \
wrc.c \
wrc.man.in
wrc_EXTRADEFS = \
-DNLSDIR="\"${datadir}/wine/nls\"" \
-DINCLUDEDIR="\"${includedir}\"" \
-DBIN_TO_NLSDIR=\"`${MAKEDEP} -R ${bindir} ${datadir}/wine/nls`\" \
-DBIN_TO_INCLUDEDIR=\"`${MAKEDEP} -R ${bindir} ${includedir}`\"
wrc_EXTRADEFS = -DBINDIR="\"${bindir}\"" -DDATADIR="\"${datadir}\"" -DINCLUDEDIR="\"${includedir}\""
INSTALL_DEV = $(PROGRAMS)

View File

@ -137,8 +137,9 @@ static int stdinc = 1;
static int po_mode;
static const char *po_dir;
static const char *sysroot = "";
static const char *bindir;
static const char *includedir;
const char *nlsdirs[3] = { NULL, NLSDIR, NULL };
const char *nlsdirs[3] = { NULL, DATADIR "/wine/nls", NULL };
int line_number = 1; /* The current line */
int char_number = 1; /* The current char pos within the line */
@ -282,16 +283,6 @@ static int load_file( const char *input_name, const char *output_name )
return ret;
}
static void init_argv0_dir( const char *argv0 )
{
char *dir = get_argv0_dir( argv0 );
if (!dir) return;
includedir = strmake( "%s/%s", dir, BIN_TO_INCLUDEDIR );
if (strendswith( dir, "/tools/wrc" )) nlsdirs[0] = strmake( "%s/../../nls", dir );
else nlsdirs[0] = strmake( "%s/%s", dir, BIN_TO_NLSDIR );
}
static void option_callback( int optc, char *optarg )
{
switch(optc)
@ -396,7 +387,9 @@ int main(int argc,char *argv[])
int i;
init_signals( exit_on_signal );
init_argv0_dir( argv[0] );
bindir = get_bindir( argv[0] );
includedir = get_includedir( bindir );
nlsdirs[0] = get_nlsdir( bindir, "/tools/wrc" );
/* Set the default defined stuff */
set_version_defines();