* make it more split upo (better in this case)

* get rid of more wranings
* get rid of useless code (how the hell it compiled AND ran with missing
symbols... beats me -  but it was working)


SVN revision: 5018
This commit is contained in:
Carsten Haitzler 2001-07-31 01:12:02 +00:00
parent e6570df917
commit 897f37f43d
20 changed files with 124 additions and 194 deletions

View File

@ -1,76 +1,5 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
struct _coords {
int xid;
int x;
int y;
};
typedef struct _coords coords;
int main(void)
{
struct sockaddr_un cli_sun;
int fd, opcode, retval, size;
char buf[100];
coords p;
if((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("socket() error");
exit(1);
}
bzero(&cli_sun, sizeof(cli_sun));
cli_sun.sun_family = AF_UNIX;
strncpy(cli_sun.sun_path, ".e/ecom", sizeof(cli_sun.sun_path));
if (connect(fd, (struct sockaddr*)&cli_sun, sizeof(cli_sun)) < 0)
{
fprintf(stderr, "EIPC Connect Error.\n"); exit(1);
}
/* move a window */
opcode = 1;
p.xid = 5;
p.x = 100;
p.y = 300;
if(write(fd, &opcode, sizeof(opcode)) == -1)
perror("Cannot write data");
size = sizeof(p);
if(write(fd, &size, sizeof(size)) == -1)
perror("Cannot write data");
if(write(fd, &p, sizeof(p)) == -1)
perror("Cannot write data");
read(fd, &size, sizeof(size));
read(fd, &retval, size);
printf("Window move successful? %d\n", retval);
/* get e version */
opcode = 0;
if(write(fd, &opcode, sizeof(opcode)) == -1)
perror("Cannot write data");
read(fd, &size, sizeof(size));
read(fd, &buf, size);
printf("Enlightenment Version: %s\n", buf);
printf("Closing socket.\n");
close(fd);
return(0);
}

View File

@ -3,6 +3,10 @@
#include "e.h"
typedef struct _E_Action E_Action;
typedef struct _E_Action_Proto E_Action_Proto;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
struct _E_Active_Action_Timer
{
void *object;
@ -37,6 +41,18 @@ struct _E_Action_Proto
};
/* action type macros */
#define ACT_MOUSE_IN 0
#define ACT_MOUSE_OUT 1
#define ACT_MOUSE_CLICK 2
#define ACT_MOUSE_DOUBLE 3
#define ACT_MOUSE_TRIPLE 4
#define ACT_MOUSE_UP 5
#define ACT_MOUSE_CLICKED 6
#define ACT_MOUSE_MOVE 7
#define ACT_KEY_DOWN 8
#define ACT_KEY_UP 9
void e_action_start(char *action, int act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry);

View File

@ -1,36 +1,5 @@
#include "background.h"
typedef struct _E_Background_Layer
{
int mode;
int type;
int inlined;
struct {
float x, y;
} scroll;
struct {
float x, y;
} pos;
struct {
float w, h;
struct {
int w, h;
} orig;
} size, fill;
char *color_class;
char *file;
double angle;
struct {
int r, g, b, a;
} fg, bg;
double x, y, w, h, fw, fh;
Evas_Object obj;
}
E_Background_Layer;
void
e_background_free(E_Background *bg)
{

View File

@ -3,6 +3,9 @@
#include "e.h"
typedef struct _E_Background E_Background;
typedef struct _E_Background_Layer E_Background_Layer;
struct _E_Background
{
OBJ_PROPERTIES;
@ -20,6 +23,37 @@ struct _E_Background
Evas_Object base_obj;
};
struct _E_Background_Layer
{
int mode;
int type;
int inlined;
struct {
float x, y;
} scroll;
struct {
float x, y;
} pos;
struct {
float w, h;
struct {
int w, h;
} orig;
} size, fill;
char *color_class;
char *file;
double angle;
struct {
int r, g, b, a;
} fg, bg;
double x, y, w, h, fw, fh;
Evas_Object obj;
};
void e_background_free(E_Background *bg);
E_Background *e_background_new(void);
E_Background *e_background_load(char *file);

View File

@ -3,6 +3,14 @@
#include "e.h"
#ifndef E_DESKTOPS_TYPEDEF
#define E_DESKTOPS_TYPEDEF
typedef struct _E_Desktop E_Desktop;
#endif
typedef struct _E_Grab E_Grab;
typedef struct _E_Border E_Border;
struct _E_Grab
{
int button;

View File

@ -3,6 +3,9 @@
#include "e.h"
typedef struct _E_Config_File E_Config_File;
typedef struct _E_Config_Element E_Config_Element;
/* something to check validity of config files where we get data from */
/* for now its just a 5 second timout so it will only invalidate */
/* if we havent looked for 5 seconds... BUT later when efsd is more solid */

View File

@ -2,6 +2,13 @@
#define E_DESKTOPS_H
#include "e.h"
#include "view.h"
#include "border.h"
#ifndef E_DESKTOPS_TYPEDEF
#define E_DESKTOPS_TYPEDEF
typedef struct _E_Desktop E_Desktop;
#endif
struct _E_Desktop
{

33
src/e.h
View File

@ -102,18 +102,6 @@ _e_obj->references = 1; \
_e_obj->e_obj_free = (void *) _e_obj_free_func; \
}
/* action type macros */
#define ACT_MOUSE_IN 0
#define ACT_MOUSE_OUT 1
#define ACT_MOUSE_CLICK 2
#define ACT_MOUSE_DOUBLE 3
#define ACT_MOUSE_TRIPLE 4
#define ACT_MOUSE_UP 5
#define ACT_MOUSE_CLICKED 6
#define ACT_MOUSE_MOVE 7
#define ACT_KEY_DOWN 8
#define ACT_KEY_UP 9
/* misc util macros */
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
((x < (xx + ww)) && \
@ -124,27 +112,10 @@ _e_obj->e_obj_free = (void *) _e_obj_free_func; \
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define UN(_blah) _blah = 0
/* data types */
typedef struct _E_Action E_Action;
typedef struct _E_Action_Proto E_Action_Proto;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
typedef struct _E_Background E_Background;
typedef struct _E_Border E_Border;
typedef struct _E_Build_Menu E_Build_Menu;
typedef struct _E_Config_File E_Config_File;
typedef struct _E_Config_Element E_Config_Element;
typedef struct _E_Desktop E_Desktop;
typedef struct _E_Entry E_Entry;
typedef struct _E_FS_Restarter E_FS_Restarter;
typedef struct _E_Grab E_Grab;
typedef struct _E_Icon E_Icon;
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
/* data type prototypes... not actually used */
typedef struct _E_Object E_Object;
typedef struct _E_Rect E_Rect;
typedef struct _E_View E_View;
/* actual fdata struct members */
/* actual data struct members */
struct _E_Object
{
OBJ_PROPERTIES;

View File

@ -1,5 +1,4 @@
#include "entry.h"
#include "background.h"
#include "config.h"
#include "util.h"
@ -100,6 +99,7 @@ e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
entry->select.start = -1;
e_entry_configure(entry);
}
UN(_o);
}
static void
@ -111,6 +111,10 @@ e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
entry = _data;
if (_b == entry->mouse_down) entry->mouse_down = 0;
e_entry_configure(entry);
UN(_e);
UN(_o);
UN(_x);
UN(_y);
}
static void
@ -188,6 +192,9 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
e_entry_configure(entry);
}
UN(_o);
UN(_b);
UN(_y);
}
static void
@ -278,7 +285,7 @@ e_entry_configure(E_Entry *entry)
{
double tx, ty, tw, th;
if (entry->cursor_pos < strlen(entry->buffer))
if (entry->cursor_pos < (int)strlen(entry->buffer))
{
evas_text_at(entry->evas, entry->text, entry->cursor_pos, &tx, &ty, &tw, &th);
}
@ -327,7 +334,7 @@ e_entry_configure(E_Entry *entry)
double x1, y1, x2, tw, th;
evas_text_at(entry->evas, entry->text, entry->select.start, &x1, &y1, NULL, NULL);
if (entry->select.start + entry->select.length <= strlen(entry->buffer))
if (entry->select.start + entry->select.length <= (int)strlen(entry->buffer))
evas_text_at(entry->evas, entry->text, entry->select.start + entry->select.length - 1, &x2, NULL, &tw, &th);
else
{
@ -398,7 +405,7 @@ e_entry_handle_keypress(E_Entry *entry, Ev_Key_Down *e)
else if (!strcmp(e->key, "Right"))
{
entry->cursor_pos++;
if (entry->cursor_pos > strlen(entry->buffer))
if (entry->cursor_pos > (int)strlen(entry->buffer))
entry->cursor_pos = strlen(entry->buffer);
}
else if (!strcmp(e->key, "Escape"))
@ -417,7 +424,7 @@ e_entry_handle_keypress(E_Entry *entry, Ev_Key_Down *e)
/* char *str2; */
if (entry->select.start >= 0) e_entry_clear_selection(entry);
else if (entry->cursor_pos < strlen(entry->buffer)) e_entry_delete_to_right(entry);
else if (entry->cursor_pos < (int)strlen(entry->buffer)) e_entry_delete_to_right(entry);
}
else if (!strcmp(e->key, "Insert"))
{
@ -474,7 +481,7 @@ e_entry_handle_keypress(E_Entry *entry, Ev_Key_Down *e)
else if ((strlen(type) == 1) && (type[0] == 0x06)) /* ctrl+f */
{
entry->cursor_pos++;
if (entry->cursor_pos > strlen(entry->buffer))
if (entry->cursor_pos > (int)strlen(entry->buffer))
entry->cursor_pos = strlen(entry->buffer);
}
else if ((strlen(type) == 1) && (type[0] == 0x02)) /* ctrl+b */
@ -657,6 +664,7 @@ e_entry_set_size(E_Entry *entry, int w, int h)
entry->min_size = w;
e_entry_configure(entry);
}
UN(h);
}
void
@ -683,7 +691,7 @@ e_entry_set_text(E_Entry *entry, const char *text)
IF_FREE(entry->buffer);
entry->buffer = strdup(text);
evas_set_text(entry->evas, entry->text, entry->buffer);
if (entry->cursor_pos > strlen(entry->buffer))
if (entry->cursor_pos > (int)strlen(entry->buffer))
entry->cursor_pos = strlen(entry->buffer);
e_entry_configure(entry);
if (entry->func_changed)
@ -762,7 +770,7 @@ e_entry_clear_selection(E_Entry *entry)
if (entry->select.start >= 0)
{
str2 = strdup(e_entry_get_text(entry));
if (entry->select.start + entry->select.length > strlen(entry->buffer))
if (entry->select.start + entry->select.length > (int)strlen(entry->buffer))
entry->select.length = strlen(entry->buffer) - entry->select.start;
strcpy(&(str2[entry->select.start]), &(entry->buffer[entry->select.start + entry->select.length]));
e_entry_set_text(entry, str2);
@ -806,7 +814,7 @@ e_entry_get_selection(E_Entry *entry)
int len;
len = entry->select.length;
if (entry->select.start + entry->select.length >= strlen(entry->buffer))
if (entry->select.start + entry->select.length >= (int)strlen(entry->buffer))
len = strlen(entry->buffer) - entry->select.start;
str2 = e_memdup(&(entry->buffer[entry->select.start]), len + 1);
str2[len] = 0;

View File

@ -3,6 +3,8 @@
#include "e.h"
typedef struct _E_Entry E_Entry;
struct _E_Entry
{
Evas evas;

View File

@ -100,6 +100,7 @@ _e_fs_restarter(int val, void *data)
if (gap > 10.0) gap = 10.0;
e_add_event_timer("e_fs_restarter", gap, _e_fs_restarter, val + 1, NULL);
}
UN(data);
}
E_FS_Restarter *

View File

@ -4,6 +4,8 @@
#include <libefsd.h>
#include "e.h"
typedef struct _E_FS_Restarter E_FS_Restarter;
struct _E_FS_Restarter
{
void (*func) (void *data);

View File

@ -1,5 +1,6 @@
#include "e.h"
#include "border.h"
#include "icccm.h"
/* Motif window hints */
#define MWM_HINTS_FUNCTIONS (1L << 0)

View File

@ -1,51 +1 @@
#include "ipc.h"
#include "config.h"
struct _coords {
int xid;
int x;
int y;
};
typedef struct _coords coords;
/* void e_ipc_init(void); */
static void e_ipc_get_version(int fd);
static void e_ipc_move_window(int fd);
void
e_ipc_init(void)
{
char buf[4096];
/* unix domain socket file path */
sprintf(buf, "%secom", e_config_user_dir());
/* init ecore ipc */
e_ev_ipc_init(buf);
/* add ipc services or functions clients can use */
e_add_ipc_service(0, e_ipc_get_version);
e_add_ipc_service(1, e_ipc_move_window);
}
static void
e_ipc_get_version(int fd)
{
e_ipc_send_data(fd, &VERSION, strlen(VERSION));
}
static void
e_ipc_move_window(int fd)
{
coords test;
int retval = 0;
/* get window id and coords to move to */
e_ipc_get_data(fd, &test);
/* move window here */
/* return failure or success */
e_ipc_send_data(fd, &retval, sizeof(retval));
}

View File

@ -121,7 +121,6 @@ main(int argc, char **argv)
e_menu_init();
e_view_init();
e_entry_init();
e_ipc_init();
e_keys_init();
setup();

View File

@ -3,6 +3,9 @@
#include "e.h"
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
struct _E_Menu
{
OBJ_PROPERTIES;

View File

@ -3,6 +3,8 @@
#include "e.h"
typedef struct _E_Build_Menu E_Build_Menu;
struct _E_Build_Menu
{
OBJ_PROPERTIES;
@ -20,4 +22,4 @@ void e_build_menu_free(E_Build_Menu *bm);
E_Build_Menu *e_build_menu_new_from_db(char *file);
E_Build_Menu *e_build_menu_new_from_gnome_apps(char *dir);
#endif;
#endif

View File

@ -4,6 +4,8 @@
#include "e.h"
#include "border.h"
typedef struct _E_Rect E_Rect;
struct _E_Rect
{
int x, y, w, h;

View File

@ -247,6 +247,8 @@ e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
e_view_selection_update(v);
}
UN(_e);
UN(_o);
}
static void
@ -336,6 +338,8 @@ e_bg_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
v->select.x = _x;
v->select.y = _y;
}
UN(_e);
UN(_o);
}
static void
@ -370,6 +374,9 @@ e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
e_view_selection_update(v);
}
UN(_e);
UN(_o);
UN(_b);
}
void
@ -577,6 +584,8 @@ e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
else if (_b == 3)
{
}
UN(_e);
UN(_o);
}
static void
@ -622,6 +631,10 @@ e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
ic->state.clicked = 0;
e_view_icon_update_state(ic);
UN(_e);
UN(_o);
UN(_x);
UN(_y);
}
static void
@ -865,6 +878,9 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
ic->view->drag.update = 1;
ic->view->changed = 1;
}
UN(_e);
UN(_o);
UN(_b);
}
static void
@ -1304,6 +1320,7 @@ e_view_filter_file(E_View *v, char *file)
{
if (file[0] == '.') return 0;
return 1;
UN(v);
}
void
@ -1505,6 +1522,7 @@ e_view_resort_timeout(int val, void *data)
v = data;
e_view_resort(v);
v->have_resort_queued = 0;
UN(val);
}
void

View File

@ -2,6 +2,11 @@
#define E_VIEW_H
#include "e.h"
#include "background.h"
#include "fs.h"
typedef struct _E_View E_View;
typedef struct _E_Icon E_Icon;
struct _E_View
{