forked from enlightenment/efl
More removal of \r
This commit is contained in:
parent
d0c0a21240
commit
61b8e2aefe
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,11 @@
|
||||||
#ifndef _ECORE_COCOA_PRIVATE_H
|
#ifndef _ECORE_COCOA_PRIVATE_H
|
||||||
#define _ECORE_COCOA_PRIVATE_H
|
#define _ECORE_COCOA_PRIVATE_H
|
||||||
|
|
||||||
struct _Ecore_Cocoa_Window
|
struct _Ecore_Cocoa_Window
|
||||||
{
|
{
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
unsigned int borderless : 1;
|
unsigned int borderless : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,306 +1,306 @@
|
||||||
/*
|
/*
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# undef WIN32_LEAN_AND_MEAN
|
# undef WIN32_LEAN_AND_MEAN
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
|
|
||||||
# include "ecore_file_private.h"
|
# include "ecore_file_private.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct _Ecore_File_Monitor_Win32 Ecore_File_Monitor_Win32;
|
typedef struct _Ecore_File_Monitor_Win32 Ecore_File_Monitor_Win32;
|
||||||
typedef struct _Ecore_File_Monitor_Win32_Data Ecore_File_Monitor_Win32_Data;
|
typedef struct _Ecore_File_Monitor_Win32_Data Ecore_File_Monitor_Win32_Data;
|
||||||
|
|
||||||
/* 4096 = 256 * sizeof(FILE_NOTIFY_INFORMATION) */
|
/* 4096 = 256 * sizeof(FILE_NOTIFY_INFORMATION) */
|
||||||
# define ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE 4096
|
# define ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE 4096
|
||||||
# define ECORE_FILE_MONITOR_WIN32(x) ((Ecore_File_Monitor_Win32 *)(x))
|
# define ECORE_FILE_MONITOR_WIN32(x) ((Ecore_File_Monitor_Win32 *)(x))
|
||||||
|
|
||||||
struct _Ecore_File_Monitor_Win32_Data
|
struct _Ecore_File_Monitor_Win32_Data
|
||||||
{
|
{
|
||||||
char buffer[ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE];
|
char buffer[ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE];
|
||||||
OVERLAPPED overlapped;
|
OVERLAPPED overlapped;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
HANDLE event;
|
HANDLE event;
|
||||||
Ecore_File_Monitor *monitor;
|
Ecore_File_Monitor *monitor;
|
||||||
Ecore_Win32_Handler *h;
|
Ecore_Win32_Handler *h;
|
||||||
DWORD buf_length;
|
DWORD buf_length;
|
||||||
int is_dir;
|
int is_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ecore_File_Monitor_Win32
|
struct _Ecore_File_Monitor_Win32
|
||||||
{
|
{
|
||||||
Ecore_File_Monitor monitor;
|
Ecore_File_Monitor monitor;
|
||||||
Ecore_File_Monitor_Win32_Data *file;
|
Ecore_File_Monitor_Win32_Data *file;
|
||||||
Ecore_File_Monitor_Win32_Data *dir;
|
Ecore_File_Monitor_Win32_Data *dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Ecore_File_Monitor *_monitors = NULL;
|
static Ecore_File_Monitor *_monitors = NULL;
|
||||||
|
|
||||||
static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh);
|
static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh);
|
||||||
|
|
||||||
|
|
||||||
static Ecore_File_Monitor_Win32_Data *
|
static Ecore_File_Monitor_Win32_Data *
|
||||||
_ecore_file_monitor_win32_data_new(Ecore_File_Monitor *monitor, int type)
|
_ecore_file_monitor_win32_data_new(Ecore_File_Monitor *monitor, int type)
|
||||||
{
|
{
|
||||||
Ecore_File_Monitor_Win32_Data *md;
|
Ecore_File_Monitor_Win32_Data *md;
|
||||||
DWORD filter;
|
DWORD filter;
|
||||||
|
|
||||||
md = (Ecore_File_Monitor_Win32_Data *)calloc(1, sizeof(Ecore_File_Monitor_Win32_Data));
|
md = (Ecore_File_Monitor_Win32_Data *)calloc(1, sizeof(Ecore_File_Monitor_Win32_Data));
|
||||||
if (!md) return NULL;
|
if (!md) return NULL;
|
||||||
|
|
||||||
md->handle = CreateFile(monitor->path,
|
md->handle = CreateFile(monitor->path,
|
||||||
FILE_LIST_DIRECTORY,
|
FILE_LIST_DIRECTORY,
|
||||||
FILE_SHARE_READ |
|
FILE_SHARE_READ |
|
||||||
FILE_SHARE_WRITE,
|
FILE_SHARE_WRITE,
|
||||||
NULL,
|
NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_FLAG_BACKUP_SEMANTICS |
|
FILE_FLAG_BACKUP_SEMANTICS |
|
||||||
FILE_FLAG_OVERLAPPED,
|
FILE_FLAG_OVERLAPPED,
|
||||||
NULL);
|
NULL);
|
||||||
if (md->handle == INVALID_HANDLE_VALUE)
|
if (md->handle == INVALID_HANDLE_VALUE)
|
||||||
goto free_md;
|
goto free_md;
|
||||||
|
|
||||||
md->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
md->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
if (!md->event)
|
if (!md->event)
|
||||||
goto close_handle;
|
goto close_handle;
|
||||||
|
|
||||||
ZeroMemory (&md->overlapped, sizeof(md->overlapped));
|
ZeroMemory (&md->overlapped, sizeof(md->overlapped));
|
||||||
md->overlapped.hEvent = md->event;
|
md->overlapped.hEvent = md->event;
|
||||||
|
|
||||||
filter = (type == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME;
|
filter = (type == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME;
|
||||||
filter |=
|
filter |=
|
||||||
FILE_NOTIFY_CHANGE_ATTRIBUTES |
|
FILE_NOTIFY_CHANGE_ATTRIBUTES |
|
||||||
FILE_NOTIFY_CHANGE_SIZE |
|
FILE_NOTIFY_CHANGE_SIZE |
|
||||||
FILE_NOTIFY_CHANGE_LAST_WRITE |
|
FILE_NOTIFY_CHANGE_LAST_WRITE |
|
||||||
FILE_NOTIFY_CHANGE_LAST_ACCESS |
|
FILE_NOTIFY_CHANGE_LAST_ACCESS |
|
||||||
FILE_NOTIFY_CHANGE_CREATION |
|
FILE_NOTIFY_CHANGE_CREATION |
|
||||||
FILE_NOTIFY_CHANGE_SECURITY;
|
FILE_NOTIFY_CHANGE_SECURITY;
|
||||||
|
|
||||||
if (!ReadDirectoryChangesW(md->handle,
|
if (!ReadDirectoryChangesW(md->handle,
|
||||||
md->buffer,
|
md->buffer,
|
||||||
ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE,
|
ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE,
|
||||||
FALSE,
|
FALSE,
|
||||||
filter,
|
filter,
|
||||||
&md->buf_length,
|
&md->buf_length,
|
||||||
&md->overlapped,
|
&md->overlapped,
|
||||||
NULL))
|
NULL))
|
||||||
goto close_event;
|
goto close_event;
|
||||||
|
|
||||||
md->h = ecore_main_win32_handler_add(md->event,
|
md->h = ecore_main_win32_handler_add(md->event,
|
||||||
_ecore_file_monitor_win32_cb,
|
_ecore_file_monitor_win32_cb,
|
||||||
md);
|
md);
|
||||||
if (!md->h)
|
if (!md->h)
|
||||||
goto close_event;
|
goto close_event;
|
||||||
|
|
||||||
md->monitor = monitor;
|
md->monitor = monitor;
|
||||||
md->is_dir = type;
|
md->is_dir = type;
|
||||||
|
|
||||||
return md;
|
return md;
|
||||||
|
|
||||||
close_event:
|
close_event:
|
||||||
CloseHandle(md->event);
|
CloseHandle(md->event);
|
||||||
close_handle:
|
close_handle:
|
||||||
CloseHandle(md->handle);
|
CloseHandle(md->handle);
|
||||||
free_md:
|
free_md:
|
||||||
free(md);
|
free(md);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_file_monitor_win32_data_free(Ecore_File_Monitor_Win32_Data *md)
|
_ecore_file_monitor_win32_data_free(Ecore_File_Monitor_Win32_Data *md)
|
||||||
{
|
{
|
||||||
if (!md) return;
|
if (!md) return;
|
||||||
|
|
||||||
CloseHandle(md->event);
|
CloseHandle(md->event);
|
||||||
CloseHandle (md->handle);
|
CloseHandle (md->handle);
|
||||||
free (md);
|
free (md);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh)
|
_ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh)
|
||||||
{
|
{
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
PFILE_NOTIFY_INFORMATION fni;
|
PFILE_NOTIFY_INFORMATION fni;
|
||||||
Ecore_File_Monitor_Win32_Data *md;
|
Ecore_File_Monitor_Win32_Data *md;
|
||||||
wchar_t *wname;
|
wchar_t *wname;
|
||||||
char *name;
|
char *name;
|
||||||
DWORD filter;
|
DWORD filter;
|
||||||
DWORD offset;
|
DWORD offset;
|
||||||
DWORD buf_length;
|
DWORD buf_length;
|
||||||
Ecore_File_Event event = ECORE_FILE_EVENT_NONE;
|
Ecore_File_Event event = ECORE_FILE_EVENT_NONE;
|
||||||
|
|
||||||
md = (Ecore_File_Monitor_Win32_Data *)data;
|
md = (Ecore_File_Monitor_Win32_Data *)data;
|
||||||
|
|
||||||
if (!GetOverlappedResult (md->handle, &md->overlapped, &buf_length, TRUE))
|
if (!GetOverlappedResult (md->handle, &md->overlapped, &buf_length, TRUE))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
fni = (PFILE_NOTIFY_INFORMATION)md->buffer;
|
fni = (PFILE_NOTIFY_INFORMATION)md->buffer;
|
||||||
do {
|
do {
|
||||||
if (!fni)
|
if (!fni)
|
||||||
break;
|
break;
|
||||||
offset = fni->NextEntryOffset;
|
offset = fni->NextEntryOffset;
|
||||||
|
|
||||||
wname = (wchar_t *)malloc(sizeof(wchar_t) * (fni->FileNameLength + 1));
|
wname = (wchar_t *)malloc(sizeof(wchar_t) * (fni->FileNameLength + 1));
|
||||||
if (!wname)
|
if (!wname)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy(wname, fni->FileName, fni->FileNameLength);
|
memcpy(wname, fni->FileName, fni->FileNameLength);
|
||||||
wname[fni->FileNameLength]='\0';
|
wname[fni->FileNameLength]='\0';
|
||||||
name = evil_wchar_to_char(wname);
|
name = evil_wchar_to_char(wname);
|
||||||
free(wname);
|
free(wname);
|
||||||
if (!name)
|
if (!name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_snprintf(filename, PATH_MAX, "%s\\%s", md->monitor->path, name);
|
_snprintf(filename, PATH_MAX, "%s\\%s", md->monitor->path, name);
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
switch (fni->Action)
|
switch (fni->Action)
|
||||||
{
|
{
|
||||||
case FILE_ACTION_ADDED:
|
case FILE_ACTION_ADDED:
|
||||||
if (md->is_dir)
|
if (md->is_dir)
|
||||||
event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
|
event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
|
||||||
else
|
else
|
||||||
event = ECORE_FILE_EVENT_CREATED_FILE;
|
event = ECORE_FILE_EVENT_CREATED_FILE;
|
||||||
break;
|
break;
|
||||||
case FILE_ACTION_REMOVED:
|
case FILE_ACTION_REMOVED:
|
||||||
if (md->is_dir)
|
if (md->is_dir)
|
||||||
event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
|
event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
|
||||||
else
|
else
|
||||||
event = ECORE_FILE_EVENT_DELETED_FILE;
|
event = ECORE_FILE_EVENT_DELETED_FILE;
|
||||||
break;
|
break;
|
||||||
case FILE_ACTION_MODIFIED:
|
case FILE_ACTION_MODIFIED:
|
||||||
if (!md->is_dir)
|
if (!md->is_dir)
|
||||||
event = ECORE_FILE_EVENT_MODIFIED;
|
event = ECORE_FILE_EVENT_MODIFIED;
|
||||||
break;
|
break;
|
||||||
case FILE_ACTION_RENAMED_OLD_NAME:
|
case FILE_ACTION_RENAMED_OLD_NAME:
|
||||||
if (md->is_dir)
|
if (md->is_dir)
|
||||||
event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
|
event = ECORE_FILE_EVENT_DELETED_DIRECTORY;
|
||||||
else
|
else
|
||||||
event = ECORE_FILE_EVENT_DELETED_FILE;
|
event = ECORE_FILE_EVENT_DELETED_FILE;
|
||||||
break;
|
break;
|
||||||
case FILE_ACTION_RENAMED_NEW_NAME:
|
case FILE_ACTION_RENAMED_NEW_NAME:
|
||||||
if (md->is_dir)
|
if (md->is_dir)
|
||||||
event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
|
event = ECORE_FILE_EVENT_CREATED_DIRECTORY;
|
||||||
else
|
else
|
||||||
event = ECORE_FILE_EVENT_CREATED_FILE;
|
event = ECORE_FILE_EVENT_CREATED_FILE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "unknown event\n");
|
fprintf(stderr, "unknown event\n");
|
||||||
event = ECORE_FILE_EVENT_NONE;
|
event = ECORE_FILE_EVENT_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (event != ECORE_FILE_EVENT_NONE)
|
if (event != ECORE_FILE_EVENT_NONE)
|
||||||
md->monitor->func(md->monitor->data, md->monitor, event, filename);
|
md->monitor->func(md->monitor->data, md->monitor, event, filename);
|
||||||
|
|
||||||
fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE)fni + offset);
|
fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE)fni + offset);
|
||||||
} while (offset);
|
} while (offset);
|
||||||
|
|
||||||
filter = (md->is_dir == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME;
|
filter = (md->is_dir == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME;
|
||||||
filter |=
|
filter |=
|
||||||
FILE_NOTIFY_CHANGE_ATTRIBUTES |
|
FILE_NOTIFY_CHANGE_ATTRIBUTES |
|
||||||
FILE_NOTIFY_CHANGE_SIZE |
|
FILE_NOTIFY_CHANGE_SIZE |
|
||||||
FILE_NOTIFY_CHANGE_LAST_WRITE |
|
FILE_NOTIFY_CHANGE_LAST_WRITE |
|
||||||
FILE_NOTIFY_CHANGE_LAST_ACCESS |
|
FILE_NOTIFY_CHANGE_LAST_ACCESS |
|
||||||
FILE_NOTIFY_CHANGE_CREATION |
|
FILE_NOTIFY_CHANGE_CREATION |
|
||||||
FILE_NOTIFY_CHANGE_SECURITY;
|
FILE_NOTIFY_CHANGE_SECURITY;
|
||||||
|
|
||||||
ReadDirectoryChangesW(md->handle,
|
ReadDirectoryChangesW(md->handle,
|
||||||
md->buffer,
|
md->buffer,
|
||||||
ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE,
|
ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE,
|
||||||
FALSE,
|
FALSE,
|
||||||
filter,
|
filter,
|
||||||
&md->buf_length,
|
&md->buf_length,
|
||||||
&md->overlapped,
|
&md->overlapped,
|
||||||
NULL);
|
NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ecore_file_monitor_backend_init(void)
|
ecore_file_monitor_backend_init(void)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ecore_file_monitor_backend_shutdown(void)
|
ecore_file_monitor_backend_shutdown(void)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ecore_File_Monitor *
|
Ecore_File_Monitor *
|
||||||
ecore_file_monitor_backend_add(const char *path,
|
ecore_file_monitor_backend_add(const char *path,
|
||||||
void (*func) (void *data, Ecore_File_Monitor *em,
|
void (*func) (void *data, Ecore_File_Monitor *em,
|
||||||
Ecore_File_Event event,
|
Ecore_File_Event event,
|
||||||
const char *path),
|
const char *path),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
Ecore_File_Monitor_Win32 *m;
|
Ecore_File_Monitor_Win32 *m;
|
||||||
Ecore_File_Monitor *em;
|
Ecore_File_Monitor *em;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (!path || (*path == '\0')) return NULL;
|
if (!path || (*path == '\0')) return NULL;
|
||||||
if (!ecore_file_exists(path) || !ecore_file_is_dir(path))
|
if (!ecore_file_exists(path) || !ecore_file_is_dir(path))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!func) return NULL;
|
if (!func) return NULL;
|
||||||
|
|
||||||
em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Win32));
|
em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Win32));
|
||||||
if (!em) return NULL;
|
if (!em) return NULL;
|
||||||
|
|
||||||
em->func = func;
|
em->func = func;
|
||||||
em->data = data;
|
em->data = data;
|
||||||
|
|
||||||
em->path = strdup(path);
|
em->path = strdup(path);
|
||||||
if (!em->path)
|
if (!em->path)
|
||||||
{
|
{
|
||||||
free(em);
|
free(em);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
len = strlen(em->path);
|
len = strlen(em->path);
|
||||||
if (em->path[len - 1] == '/' || em->path[len - 1] == '\\')
|
if (em->path[len - 1] == '/' || em->path[len - 1] == '\\')
|
||||||
em->path[len - 1] = '\0';
|
em->path[len - 1] = '\0';
|
||||||
|
|
||||||
m = ECORE_FILE_MONITOR_WIN32(em);
|
m = ECORE_FILE_MONITOR_WIN32(em);
|
||||||
|
|
||||||
m->file = _ecore_file_monitor_win32_data_new(em, 0);
|
m->file = _ecore_file_monitor_win32_data_new(em, 0);
|
||||||
if (!m->file)
|
if (!m->file)
|
||||||
{
|
{
|
||||||
free(em->path);
|
free(em->path);
|
||||||
free(em);
|
free(em);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->dir = _ecore_file_monitor_win32_data_new(em, 1);
|
m->dir = _ecore_file_monitor_win32_data_new(em, 1);
|
||||||
if (!m->dir)
|
if (!m->dir)
|
||||||
{
|
{
|
||||||
_ecore_file_monitor_win32_data_free(m->file);
|
_ecore_file_monitor_win32_data_free(m->file);
|
||||||
free(em->path);
|
free(em->path);
|
||||||
free(em);
|
free(em);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
|
_monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
|
||||||
|
|
||||||
return em;
|
return em;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
|
ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
|
||||||
{
|
{
|
||||||
Ecore_File_Monitor_Win32 *m;
|
Ecore_File_Monitor_Win32 *m;
|
||||||
|
|
||||||
if (!em)
|
if (!em)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m = ECORE_FILE_MONITOR_WIN32(em);
|
m = ECORE_FILE_MONITOR_WIN32(em);
|
||||||
_ecore_file_monitor_win32_data_free(m->dir);
|
_ecore_file_monitor_win32_data_free(m->dir);
|
||||||
_ecore_file_monitor_win32_data_free(m->file);
|
_ecore_file_monitor_win32_data_free(m->file);
|
||||||
free(em->path);
|
free(em->path);
|
||||||
free(em);
|
free(em);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4465,7 +4465,7 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS);
|
Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS);
|
||||||
int imagew, imageh, uvw, uvh;
|
int imagew, imageh, uvw, uvh;
|
||||||
void *pixels;
|
void *pixels;
|
||||||
Evas_Func *eng = obj->layer->evas->engine.func;
|
Evas_Func *eng = obj->layer->evas->engine.func;
|
||||||
int is_inside = 0;
|
int is_inside = 0;
|
||||||
|
|
||||||
/* the following code is similar to evas_object_image_render(), but doesn't
|
/* the following code is similar to evas_object_image_render(), but doesn't
|
||||||
|
@ -4539,7 +4539,7 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
void *im;
|
void *im;
|
||||||
DATA32 *data = NULL;
|
DATA32 *data = NULL;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -4547,8 +4547,8 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
(obj->layer->evas->engine.data.output, pixels, 0, &data, &err);
|
(obj->layer->evas->engine.data.output, pixels, 0, &data, &err);
|
||||||
if ((!im) || (!data) || (err))
|
if ((!im) || (!data) || (err))
|
||||||
{
|
{
|
||||||
ERR("Couldn't get image pixels %p: im=%p, data=%p, err=%d",
|
ERR("Couldn't get image pixels %p: im=%p, data=%p, err=%d",
|
||||||
pixels, im, data, err);
|
pixels, im, data, err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4596,13 +4596,13 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DATA8 alpha = 0;
|
DATA8 alpha = 0;
|
||||||
|
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
0, 0,
|
0, 0,
|
||||||
imagew, imageh,
|
imagew, imageh,
|
||||||
obj->cur.geometry.x + ix,
|
obj->cur.geometry.x + ix,
|
||||||
obj->cur.geometry.y + iy,
|
obj->cur.geometry.y + iy,
|
||||||
iw, ih))
|
iw, ih))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4663,9 +4663,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = bl; inh = bt;
|
inw = bl; inh = bt;
|
||||||
outx = ox; outy = oy;
|
outx = ox; outy = oy;
|
||||||
outw = bsl; outh = bst;
|
outw = bsl; outh = bst;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4679,9 +4679,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = imw - bl - br; inh = bt;
|
inw = imw - bl - br; inh = bt;
|
||||||
outx = ox + bsl; outy = oy;
|
outx = ox + bsl; outy = oy;
|
||||||
outw = iw - bsl - bsr; outh = bst;
|
outw = iw - bsl - bsr; outh = bst;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4694,9 +4694,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = br; inh = bt;
|
inw = br; inh = bt;
|
||||||
outx = ox + iw - bsr; outy = oy;
|
outx = ox + iw - bsr; outy = oy;
|
||||||
outw = bsr; outh = bst;
|
outw = bsr; outh = bst;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4704,14 +4704,14 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// .--
|
// .--
|
||||||
// #
|
// #
|
||||||
inx = 0; iny = bt;
|
inx = 0; iny = bt;
|
||||||
inw = bl; inh = imh - bt - bb;
|
inw = bl; inh = imh - bt - bb;
|
||||||
outx = ox; outy = oy + bst;
|
outx = ox; outy = oy + bst;
|
||||||
outw = bsl; outh = ih - bst - bsb;
|
outw = bsl; outh = ih - bst - bsb;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4726,9 +4726,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = imw - bl - br; inh = imh - bt - bb;
|
inw = imw - bl - br; inh = imh - bt - bb;
|
||||||
outx = ox + bsl; outy = oy + bst;
|
outx = ox + bsl; outy = oy + bst;
|
||||||
outw = iw - bsl - bsr; outh = ih - bst - bsb;
|
outw = iw - bsl - bsr; outh = ih - bst - bsb;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4742,9 +4742,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = br; inh = imh - bt - bb;
|
inw = br; inh = imh - bt - bb;
|
||||||
outx = ox + iw - bsr; outy = oy + bst;
|
outx = ox + iw - bsr; outy = oy + bst;
|
||||||
outw = bsr; outh = ih - bst - bsb;
|
outw = bsr; outh = ih - bst - bsb;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4757,9 +4757,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = bl; inh = bb;
|
inw = bl; inh = bb;
|
||||||
outx = ox; outy = oy + ih - bsb;
|
outx = ox; outy = oy + ih - bsb;
|
||||||
outw = bsl; outh = bsb;
|
outw = bsl; outh = bsb;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4772,9 +4772,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = imw - bl - br; inh = bb;
|
inw = imw - bl - br; inh = bb;
|
||||||
outx = ox + bsl; outy = oy + ih - bsb;
|
outx = ox + bsl; outy = oy + ih - bsb;
|
||||||
outw = iw - bsl - bsr; outh = bsb;
|
outw = iw - bsl - bsr; outh = bsb;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
@ -4787,9 +4787,9 @@ evas_object_image_is_inside(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
|
||||||
inw = br; inh = bb;
|
inw = br; inh = bb;
|
||||||
outx = ox + iw - bsr; outy = oy + ih - bsb;
|
outx = ox + iw - bsr; outy = oy + ih - bsb;
|
||||||
outw = bsr; outh = bsb;
|
outw = bsr; outh = bsb;
|
||||||
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
if (eng->pixel_alpha_get(pixels, px, py, &alpha,
|
||||||
inx, iny, inw, inh,
|
inx, iny, inw, inh,
|
||||||
outx, outy, outw, outh))
|
outx, outy, outw, outh))
|
||||||
{
|
{
|
||||||
is_inside = alpha > 0;
|
is_inside = alpha > 0;
|
||||||
dobreak_h = 1;
|
dobreak_h = 1;
|
||||||
|
|
|
@ -905,8 +905,8 @@ struct _Evas_Func
|
||||||
|
|
||||||
/* multiple font draws */
|
/* multiple font draws */
|
||||||
Eina_Bool (*multi_font_draw) (void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, Evas_Font_Array *texts, Eina_Bool do_async);
|
Eina_Bool (*multi_font_draw) (void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, Evas_Font_Array *texts, Eina_Bool do_async);
|
||||||
|
|
||||||
Eina_Bool (*pixel_alpha_get) (void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
|
Eina_Bool (*pixel_alpha_get) (void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Image_Load_Func
|
struct _Evas_Image_Load_Func
|
||||||
|
|
|
@ -1831,93 +1831,93 @@ eng_multi_font_draw(void *data EINA_UNUSED, void *context, void *surface, Evas_F
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h)
|
eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h)
|
||||||
{
|
{
|
||||||
RGBA_Image *im = image;
|
RGBA_Image *im = image;
|
||||||
int px, py, dx, dy, sx, sy, src_w, src_h;
|
int px, py, dx, dy, sx, sy, src_w, src_h;
|
||||||
double scale_w, scale_h;
|
double scale_w, scale_h;
|
||||||
|
|
||||||
if (!im) return EINA_FALSE;
|
if (!im) return EINA_FALSE;
|
||||||
|
|
||||||
if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) ||
|
if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) ||
|
||||||
(dst_region_y > y) || (y >= (dst_region_y + dst_region_h)))
|
(dst_region_y > y) || (y >= (dst_region_y + dst_region_h)))
|
||||||
{
|
{
|
||||||
*alpha = 0;
|
*alpha = 0;
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
src_w = im->cache_entry.w;
|
src_w = im->cache_entry.w;
|
||||||
src_h = im->cache_entry.h;
|
src_h = im->cache_entry.h;
|
||||||
if ((src_w == 0) || (src_h == 0))
|
if ((src_w == 0) || (src_h == 0))
|
||||||
{
|
{
|
||||||
*alpha = 0;
|
*alpha = 0;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob);
|
EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob);
|
||||||
EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob);
|
EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob);
|
||||||
EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob);
|
EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob);
|
||||||
EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob);
|
EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob);
|
||||||
|
|
||||||
scale_w = (double)dst_region_w / (double)src_region_w;
|
scale_w = (double)dst_region_w / (double)src_region_w;
|
||||||
scale_h = (double)dst_region_h / (double)src_region_h;
|
scale_h = (double)dst_region_h / (double)src_region_h;
|
||||||
|
|
||||||
/* point at destination */
|
/* point at destination */
|
||||||
dx = x - dst_region_x;
|
dx = x - dst_region_x;
|
||||||
dy = y - dst_region_y;
|
dy = y - dst_region_y;
|
||||||
|
|
||||||
/* point at source */
|
/* point at source */
|
||||||
sx = dx / scale_w;
|
sx = dx / scale_w;
|
||||||
sy = dy / scale_h;
|
sy = dy / scale_h;
|
||||||
|
|
||||||
/* pixel point (translated) */
|
/* pixel point (translated) */
|
||||||
px = src_region_x + sx;
|
px = src_region_x + sx;
|
||||||
py = src_region_y + sy;
|
py = src_region_y + sy;
|
||||||
EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob);
|
EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob);
|
||||||
EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob);
|
EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob);
|
||||||
|
|
||||||
switch (im->cache_entry.space)
|
switch (im->cache_entry.space)
|
||||||
{
|
{
|
||||||
case EVAS_COLORSPACE_ARGB8888:
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
{
|
{
|
||||||
DATA32 *pixel;
|
DATA32 *pixel;
|
||||||
|
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get())
|
||||||
evas_cache2_image_load_data(&im->cache_entry);
|
evas_cache2_image_load_data(&im->cache_entry);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
evas_cache_image_load_data(&im->cache_entry);
|
evas_cache_image_load_data(&im->cache_entry);
|
||||||
|
|
||||||
if (!im->cache_entry.flags.loaded)
|
if (!im->cache_entry.flags.loaded)
|
||||||
{
|
{
|
||||||
ERR("im %p has no pixels loaded yet", im);
|
ERR("im %p has no pixels loaded yet", im);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixel = im->image.data;
|
pixel = im->image.data;
|
||||||
pixel += ((py * src_w) + px);
|
pixel += ((py * src_w) + px);
|
||||||
*alpha = ((*pixel) >> 24) & 0xff;
|
*alpha = ((*pixel) >> 24) & 0xff;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Colorspace %d not supported.", im->cache_entry.space);
|
ERR("Colorspace %d not supported.", im->cache_entry.space);
|
||||||
*alpha = 0;
|
*alpha = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
||||||
error_oob:
|
error_oob:
|
||||||
ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d",
|
ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d",
|
||||||
src_region_x, src_region_y, src_region_w, src_region_h,
|
src_region_x, src_region_y, src_region_w, src_region_h,
|
||||||
dst_region_x, dst_region_y, dst_region_w, dst_region_h,
|
dst_region_x, dst_region_y, dst_region_w, dst_region_h,
|
||||||
src_w, src_h);
|
src_w, src_h);
|
||||||
*alpha = 0;
|
*alpha = 0;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eng_image_cache_flush(void *data EINA_UNUSED)
|
eng_image_cache_flush(void *data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -2652,7 +2652,7 @@ static Evas_Func func =
|
||||||
eng_image_animated_frame_set,
|
eng_image_animated_frame_set,
|
||||||
NULL,
|
NULL,
|
||||||
eng_multi_font_draw,
|
eng_multi_font_draw,
|
||||||
eng_pixel_alpha_get,
|
eng_pixel_alpha_get,
|
||||||
/* FUTURE software generic calls go here */
|
/* FUTURE software generic calls go here */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue