winequartz.drv: Second glance at Window support.

Alexandre Julliard julliard at winehq.org
Mon Nov 20 07:06:08 CST 2006


Pierre d'Herbemont <pdherbemont at free.fr> writes:

> +static inline void * BindCarbonFunctions(void)
> +{    
> +    void * HIToolBoxDLHandle = dlopen("/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox", RTLD_LAZY | RTLD_LOCAL);
> +    
> +    if (!HIToolBoxDLHandle) {
> +        fprintf(stderr, "%s impossible d'ouvrir HIToolBoxDLHandle\n", __FUNCTION__);
> +        return nil;
> +    }
> +#define LOAD_FUNCTION(f) \
> +    if((carbonPtr_##f = dlsym(HIToolBoxDLHandle, #f)) == NULL) \
> +    { \
> +        fprintf(stderr, "%s Can't find symbol %s\n", __FUNCTION__,  #f); \
> +        return nil;                                  \
> +    }
> +    LOAD_FUNCTION(ShowWindow)
> +    LOAD_FUNCTION(HideWindow)
> +#undef LOAD_FUNCTION
> +	return HIToolBoxDLHandle;
> +}

This stuff should go in a C file, not in a header. Also you should use
ERR instead of fprintf, and error messages should be in English <g>

> +struct quartzdrv_thread_data
> +{
> +	int		process_event_count;  /* recursion count for event processing */
> +};
> +
> +extern struct quartzdrv_thread_data *quartzdrv_init_thread_data(void);
> +extern DWORD thread_data_tls_index;
> +
> +inline static struct quartzdrv_thread_data *quartzdrv_thread_data(void)
> +{
> +    struct quartzdrv_thread_data *data = TlsGetValue( thread_data_tls_index );
> +    if (!data) data = quartzdrv_init_thread_data();
> +    return data;
> +}

This is not used, it would be better to wait until you actually need
per-thread data to add it.

> +/* ---------------------------------------------------------------------
> +   quartzdrv_main.c
> +*/
> +extern void wine_quartzdrv_lock(void);
> +extern void wine_quartzdrv_unlock(void);

Do you really need locking around Carbon calls, or is this just
imitating x11drv?  (either way there's no reason to export those).

> +/* ---------------------------------------------------------------------
> + *  get_quartzdrv_win_data_from_hwnd
> + */
> +struct quartzdrv_win_data *get_quartzdrv_win_data_from_hwnd(HWND hwnd)
> +{
> +    return (struct quartzdrv_win_data *)GetPropA(hwnd, wine_quartzdrv_win_data);
> +}

GetProp is not the best choice for associating data to a window as it
requires a server round trip. A process-local mechanism is preferable.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list