From 22aa9d2a5d66cb8d80098056f7075babf5e218d4 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 11 Dec 2000 20:08:38 +0000 Subject: [PATCH] Sorry guys.. I had to revert a bunch of changes.. that's life.. but READ the following (it's in the README now) ------------------------------------------------------------------------------- Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- The Rasterman - raster@valinux.com, raster@rasterman.com ******************************************************************************* **************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* ******************************************************************************* This is the source code for Enlightenment 0.17 - If you got this you got it from Enlightenment's CVS repository - or from someone who took it out of the CVS repository. The CVS repository is full of code *IN DEVELOPMENT* - that often means it's in the middle of being worked on and may install strange things in strange places, make a mess, and may not even be compatible with a final release. If you at all use this code, you are HEAVILY URGED, when it is finally released, to remove all traces of anything this CVS code base has installed on your system (it is COMPLETELY up to you to keep track of that - do NOT expect any help), and then install the full release on a cleaned system. Don't come asking "can I just keep using CVS" oonce things are released - thqat is the reason I pu this paragraph here - so you don't ask. The asnwer is the same as above - if there is a proper final release use that. CVS is really only for those havily hacking on the code. Now we have that warning over and done with. How to build and install from CVS? $ ./autogen.sh && make $ su Password: <- as root -> # make install You should be able to use the binary of enlightenment as a window manager. you might be advised for cleanliness to do $ ./autogen.sh --prefix=/usr/local/e-17 so it installs relative to the /usr/local/e-17 directory and keeps all the e-17 development code and data in that tree so it is easily removed when the time codes. NOTES: Read these carefully! Enlightenment does not check for previously running Window Managers right now - so you need to make sure no other WM is running - E will not do that for you. Enlightenment has no menus or keybindings or any way of launching applications right now - you'll have to figure out an alternative way of doing it. Enlightenment only handles a small subset of ICCCM and thus will have bugs - some applications will not behave correctly and may apear in odd spots or not resize or place themselves properly etc. Expect this - it's code being worked on. Just be happy it does as much as it already does. Enlightenment RELIES on lots of libraires that have been written. Ecore, Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and Evas change in CVS often - you will need the absolute latest of these if you wish Enlightenment 0.17 code to run properly or compile. If you update Enlightenment from CVS update these too to get any changes they have in their trees. If you plan on working on the code... STOP! don't rush in and work on it - even if you have CVS commit access - EXPECT me (Raster) to revert any changes you make if you do this - regardless of the changes and how much work you put into them. First read the code well and LEARN it. If you have questions about some of the more obscure hidden program flow - ASK - but don't go tampering with it - Enlightenment 0.17's code is much more complex and intricate than E 0.16 - but at the same time it's much cleaner and more object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with hard-coded stuff, just so, for now, it works. They will be virtualized and imporved over time. If you have plans - tell me about them first - discuss them before you go impliment them. I know I already have a lot of the components of E 0.17's code planned in my head - but I won't get to them for a while - and if people go impliment or hack bad stuff in, it means I have to spend lots of time fixing something that is bad in the first place, or we end up doing duplicate work. There *IS* a plan - believe it or not - but to be honest - it's more complex and large than I can just write down in a README, so talk about your ideas first. I'm going to be ruthless in keeping the code neat, clean and free of nasty hacks (except ones I put in as temporary stop-gap measures to make the thing work - since I know where those are and what I need to do to do it right). If you can't find me or I don't reply to your e-mail - don't get impatient - just wait. I currently have no network access at home, so I'm doing a chunk of code offline. I'll get to your mail and queries as time allows. If you have problems with the code or bugs to report, kindly forward them to /dev/null (the code is in now way or form ready for bug reports - I don't want crap filling my mailbox). I hope that clears things up for now. SVN revision: 3976 --- INSTALL | 2 +- Makefile.am | 2 +- README | 95 ++- acconfig.h | 1 + config.h.in | 1 + configure.in | 21 +- e.spec | 28 +- lib/Makefile.am | 20 + lib/e_hack.c | 206 ++++++ lib/e_hack.h | 12 + src/Makefile.am | 12 +- src/actions.c | 741 ++++++++++++++------- src/border.c | 1697 ++++++++++++++++++++++++----------------------- src/desktops.c | 21 +- src/e.h | 24 +- src/icccm.c | 113 +++- src/icccm.h | 46 -- src/main.c | 7 +- src/resist.c | 12 +- src/util.c | 9 + 20 files changed, 1912 insertions(+), 1158 deletions(-) create mode 100644 lib/Makefile.am create mode 100644 lib/e_hack.c create mode 100644 lib/e_hack.h delete mode 100644 src/icccm.h diff --git a/INSTALL b/INSTALL index e507f3c70..e55f642b7 100644 --- a/INSTALL +++ b/INSTALL @@ -11,4 +11,4 @@ Then to compile: To install (run this as root, or the user who handles installs): make install -NOTE: You MUST make install Etcher for it to run properly. +NOTE: You MUST make install Enlightenment for it to run properly. diff --git a/Makefile.am b/Makefile.am index c6b6c2afe..6826ca273 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = intl po src +SUBDIRS = intl po src lib MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \ config.h.in config.sub configure install-sh \ diff --git a/README b/README index 32dbee666..0f64e13f0 100644 --- a/README +++ b/README @@ -1,3 +1,96 @@ ------------------------------------------------------------------------------- - Enlightenment 0.17.0 PRE-RELEASE.... + Enlightenment 0.17.0 CVS Code.... ------------------------------------------------------------------------------- + The Rasterman - raster@valinux.com, raster@rasterman.com + +******************************************************************************* +**************** READ THIS! It is of the UTMOST IMPORTANCE! ******************* +******************************************************************************* + +This is the source code for Enlightenment 0.17 - If you got this you got it +from Enlightenment's CVS repository - or from someone who took it out of +the CVS repository. + +The CVS repository is full of code *IN DEVELOPMENT* - that often means it's +in the middle of being worked on and may install strange things in strange +places, make a mess, and may not even be compatible with a final release. If +you at all use this code, you are HEAVILY URGED, when it is finally released, +to remove all traces of anything this CVS code base has installed on your +system (it is COMPLETELY up to you to keep track of that - do NOT expect any +help), and then install the full release on a cleaned system. Don't come +asking "can I just keep using CVS" oonce things are released - thqat is the +reason I pu this paragraph here - so you don't ask. The asnwer is the same +as above - if there is a proper final release use that. CVS is really only +for those havily hacking on the code. + +Now we have that warning over and done with. How to build and install from +CVS? + +$ ./autogen.sh && make +$ su +Password: +<- as root -> +# make install + +You should be able to use the binary of enlightenment as a window manager. + +you might be advised for cleanliness to do +$ ./autogen.sh --prefix=/usr/local/e-17 + +so it installs relative to the /usr/local/e-17 directory and keeps all the +e-17 development code and data in that tree so it is easily removed when the +time codes. + + + +NOTES: Read these carefully! + +Enlightenment does not check for previously running Window Managers right +now - so you need to make sure no other WM is running - E will not do that +for you. + +Enlightenment has no menus or keybindings or any way of launching +applications right now - you'll have to figure out an alternative way of +doing it. + +Enlightenment only handles a small subset of ICCCM and thus will have bugs - +some applications will not behave correctly and may apear in odd spots or +not resize or place themselves properly etc. Expect this - it's code being +worked on. Just be happy it does as much as it already does. + +Enlightenment RELIES on lots of libraires that have been written. Ecore, +Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and +Evas change in CVS often - you will need the absolute latest of these if you +wish Enlightenment 0.17 code to run properly or compile. If you update +Enlightenment from CVS update these too to get any changes they have in +their trees. + +If you plan on working on the code... STOP! don't rush in and work on it - +even if you have CVS commit access - EXPECT me (Raster) to revert any changes +you make if you do this - regardless of the changes and how much work you +put into them. First read the code well and LEARN it. If you have questions +about some of the more obscure hidden program flow - ASK - but don't go +tampering with it - Enlightenment 0.17's code is much more complex and +intricate than E 0.16 - but at the same time it's much cleaner and more +object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with +hard-coded stuff, just so, for now, it works. They will be virtualized and +imporved over time. If you have plans - tell me about them first - discuss +them before you go impliment them. I know I already have a lot of the +components of E 0.17's code planned in my head - but I won't get to them for +a while - and if people go impliment or hack bad stuff in, it means I have to +spend lots of time fixing something that is bad in the first place, or we +end up doing duplicate work. There *IS* a plan - believe it or not - but to +be honest - it's more complex and large than I can just write down in a +README, so talk about your ideas first. I'm going to be ruthless in keeping +the code neat, clean and free of nasty hacks (except ones I put in as +temporary stop-gap measures to make the thing work - since I know where +those are and what I need to do to do it right). If you can't find me or I +don't reply to your e-mail - don't get impatient - just wait. I currently +have no network access at home, so I'm doing a chunk of code offline. I'll +get to your mail and queries as time allows. + +If you have problems with the code or bugs to report, kindly forward them to +/dev/null (the code is in now way or form ready for bug reports - I don't +want crap filling my mailbox). + +I hope that clears things up for now. diff --git a/acconfig.h b/acconfig.h index 10880cb7d..ae5c7e803 100644 --- a/acconfig.h +++ b/acconfig.h @@ -8,3 +8,4 @@ #undef PACKAGE_DATA_DIR #undef PACKAGE_SOURCE_DIR #undef PACKAGE_BIN_DIR +#undef PACKAGE_LIB_DIR diff --git a/config.h.in b/config.h.in index 8ed210ff4..0b335e410 100644 --- a/config.h.in +++ b/config.h.in @@ -53,6 +53,7 @@ #undef PACKAGE_DATA_DIR #undef PACKAGE_SOURCE_DIR #undef PACKAGE_BIN_DIR +#undef PACKAGE_LIB_DIR /* Define if you have the __argz_count function. */ #undef HAVE___ARGZ_COUNT diff --git a/configure.in b/configure.in index b093970dc..1c1e3c888 100644 --- a/configure.in +++ b/configure.in @@ -8,6 +8,9 @@ AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC AC_HEADER_STDC +AC_C_CONST +AM_ENABLE_SHARED +AM_PROG_LIBTOOL AM_WITH_DMALLOC @@ -36,12 +39,23 @@ fi dnl Set PACKAGE_BIN_DIR in config.h. if test "x${datadir}" = 'x${prefix}/bin'; then if test "x${prefix}" = "xNONE"; then - AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${ac_default_prefix}/bin/${PACKAGE}") + AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${ac_default_prefix}/bin") else - AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${prefix}/bin/${PACKAGE}") + AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${prefix}/bin") fi else - AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${bindir}/${PACKAGE}") + AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, "${bindir}") +fi + +dnl Set PACKAGE_LIB_DIR in config.h. +if test "x${datadir}" = 'x${prefix}/lib'; then + if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, "${ac_default_prefix}/lib") + else + AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, "${prefix}/lib") + fi +else + AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, "${libdir}") fi dnl Set PACKAGE_SOURCE_DIR in config.h. @@ -79,6 +93,7 @@ AC_SUBST(ecore_libs) AC_OUTPUT([ Makefile src/Makefile +lib/Makefile intl/Makefile po/Makefile.in ]) diff --git a/e.spec b/e.spec index 7b168f1f6..263a2f2e2 100644 --- a/e.spec +++ b/e.spec @@ -1,30 +1,28 @@ # Note that this is NOT a relocatable package -%define ver 1.0 +%define ver 0.17.0 %define rel 1 %define prefix /usr/local -Summary: Enlightenment DR0.17's new "bit" editor -Name: etcher +Summary: Enlightenment DR0.17 CVS +Name: enlightenment Version: %ver Release: %rel Copyright: BSD Group: X11/Libraries -Source: ftp://ftp.enlightenment.org/pub/enlightenment/etcher-%{ver}.tar.gz -BuildRoot: /var/tmp/etcher-root -Packager: Term +Source: ftp://ftp.enlightenment.org/pub/enlightenment/enlightenment-%{ver}.tar.gz +BuildRoot: /var/tmp/enlightenment-root +Packager: The Rasterman URL: http://www.enlightenment.org/ -Requires: evas >= 0.0.1 +Requires: evas >= 0.0.2 Requires: edb >= 1.0.0 Requires: imlib2 >= 1.0.0 +Requires: ebits >= 0.0.0 +Requires: ecore >= 0.0.1 Docdir: %{prefix}/doc %description -Etcher is a new application devised to assist would-be theme developers in -designin "bits", that is, window borders, icons, whatever, for -Enlightenment. Since Enlightenment DR0.17 uses drag-and-drop instead of -texual configuration files, this application will become instrumental for -themeing under the new Enlightenment version. +Errrrrrr - E17. You go figure. %prep %setup @@ -54,13 +52,13 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc README COPYING ChangeLog -%attr(755,root,root) %{prefix}/bin/etcher -%{prefix}/share/etcher/* +%attr(755,root,root) %{prefix}/bin/enlightenment +%{prefix}/share/enlightenment/* %doc AUTHORS %doc COPYING %doc README %changelog -* Mon Aug 28 2000 Lyle Kempler +* The Rasterman - Created spec file diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 000000000..f576e93e7 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,20 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = 1.4 foreign + +# A list of all the files in the current directory which can be regenerated +MAINTAINERCLEANFILES = Makefile.in + +LDFLAGS = -L/usr/X11R6/lib -L/usr/local/lib +INCLUDES = -I/usr/X11R6/include -I/usr/local/include \ + $(X_CFLAGS) -I$(includedir) + +lib_LTLIBRARIES = libehack.la +include_HEADERS = +libehack_la_SOURCES = \ +e_hack.c \ +e_hack.h + +libehack_la_LIBADD = -lX11 -ldl $(LDFLAGS) +libehack_la_DEPENDENCIES = $(top_builddir)/config.h +libehack_la_LDFLAGS = -version-info 0:1:0 diff --git a/lib/e_hack.c b/lib/e_hack.c new file mode 100644 index 000000000..341fb9ee9 --- /dev/null +++ b/lib/e_hack.c @@ -0,0 +1,206 @@ +#include "config.h" +#include "e_hack.h" + +/* prototypes */ +static void __e_hack_set_properties(Display *display, Window window); + +/* dlopened xlib so we can find the symbols in the real xlib to call them */ +static void *lib_xlib = NULL; + +/* the function that actually sets the properties on toplevel window */ +static void +__e_hack_set_properties(Display *display, Window window) +{ + static Atom a_launch_id = 0; + static Atom a_launch_path = 0; + static Atom a_user_id = 0; + static Atom a_process_id = 0; + static Atom a_p_process_id = 0; + static Atom a_machine_name = 0; + static Atom a_user_name = 0; + char *env = NULL; + + if (!a_launch_id) a_launch_id = XInternAtom(display, "_E_HACK_LAUNCH_ID", False); + if (!a_launch_path) a_launch_path = XInternAtom(display, "_E_HACK_LAUNCH_PATH", False); + if (!a_user_id) a_user_id = XInternAtom(display, "_E_HACK_USER_ID", False); + if (!a_process_id) a_process_id = XInternAtom(display, "_E_HACK_PROCESS_ID", False); + if (!a_p_process_id) a_p_process_id = XInternAtom(display, "_E_HACK_PARENT_PROCESS_ID", False); + if (!a_machine_name) a_machine_name = XInternAtom(display, "_E_HACK_MACHINE_NAME", False); + if (!a_user_name) a_user_name = XInternAtom(display, "_E_HACK_USER_NAME", False); + + if ((env = getenv("E_HACK_LAUNCH_ID"))) + XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, env, strlen(env)); + if ((env = getenv("E_HACK_LAUNCH_PATH"))) + XChangeProperty(display, window, a_launch_path, XA_STRING, 8, PropModeReplace, env, strlen(env)); + { + uid_t uid; + pid_t pid, ppid; + struct utsname ubuf; + char buf[4096]; + + uid = getuid(); + pid = getpid(); + ppid = getppid(); + + snprintf(buf, sizeof(buf), "%i", uid); + XChangeProperty(display, window, a_user_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + snprintf(buf, sizeof(buf), "%i", pid); + XChangeProperty(display, window, a_process_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + snprintf(buf, sizeof(buf), "%i", ppid); + XChangeProperty(display, window, a_p_process_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + if (!uname(&ubuf)) + { + snprintf(buf, sizeof(buf), "%s", ubuf.nodename); + XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + } + else + XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, " ", 1); + } + if ((env = getenv("USER"))) + XChangeProperty(display, window, a_user_name, XA_STRING, 8, PropModeReplace, env, strlen(env)); +} + +/* XCreateWindow intercept hack */ +Window +XCreateWindow( + Display *display, + Window parent, + int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, + int depth, + unsigned int class, + Visual *visual, + unsigned long valuemask, + XSetWindowAttributes *attributes + ) +{ + static Window (*func) + ( + Display *display, + Window parent, + int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, + int depth, + unsigned int class, + Visual *visual, + unsigned long valuemask, + XSetWindowAttributes *attributes + ) = NULL; + int i; + + /* find the real Xlib and the real X function */ + if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); + if (!func) func = dlsym (lib_xlib, "XCreateWindow"); + + /* multihead screen handling loop */ + for (i = 0; i < ScreenCount(display); i++) + { + /* if the window is created as a toplevel window */ + if (parent == RootWindow(display, i)) + { + Window window; + + /* create it */ + window = (*func) (display, parent, x, y, width, height, + border_width, depth, class, visual, valuemask, + attributes); + /* set properties */ + __e_hack_set_properties(display, window); + /* return it */ + return window; + } + } + /* normal child window - create as usual */ + return (*func) (display, parent, x, y, width, height, border_width, depth, + class, visual, valuemask, attributes); +} + +/* XCreateSimpleWindow intercept hack */ +Window +XCreateSimpleWindow( + Display *display, + Window parent, + int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, + unsigned long border, + unsigned long background + ) +{ + static Window (*func) + ( + Display *display, + Window parent, + int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, + unsigned long border, + unsigned long background + ) = NULL; + int i; + + /* find the real Xlib and the real X function */ + if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); + if (!func) func = dlsym (lib_xlib, "XCreateSimpleWindow"); + + /* multihead screen handling loop */ + for (i = 0; i < ScreenCount(display); i++) + { + /* if the window is created as a toplevel window */ + if (parent == RootWindow(display, i)) + { + Window window; + + /* create it */ + window = (*func) (display, parent, x, y, width, height, + border_width, border, background); + /* set properties */ + __e_hack_set_properties(display, window); + /* return it */ + return window; + } + } + /* normal child window - create as usual */ + return (*func) (display, parent, x, y, width, height, + border_width, border, background); +} + +/* XReparentWindow intercept hack */ +int +XReparentWindow( + Display *display, + Window window, + Window parent, + int x, int y + ) +{ + static int (*func) + ( + Display *display, + Window window, + Window parent, + int x, int y + ) = NULL; + int i; + + /* find the real Xlib and the real X function */ + if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); + if (!func) func = dlsym (lib_xlib, "XReparentWindow"); + + /* multihead screen handling loop */ + for (i = 0; i < ScreenCount(display); i++) + { + /* if the window is created as a toplevel window */ + if (parent == RootWindow(display, i)) + { + /* set properties */ + __e_hack_set_properties(display, window); + /* reparent it */ + return (*func) (display, window, parent, x, y); + } + } + /* normal child window reparenting - reparent as usual */ + return (*func) (display, window, parent, x, y); +} diff --git a/lib/e_hack.h b/lib/e_hack.h new file mode 100644 index 000000000..a2948c95d --- /dev/null +++ b/lib/e_hack.h @@ -0,0 +1,12 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/Makefile.am b/src/Makefile.am index f249dc7ce..bc6b6a0c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,21 +1,21 @@ ## Process this file with automake to produce Makefile.in INCLUDES = \ - -I$(top_srcdir)/intl \ - @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ + -I$(top_srcdir)/intl \ + @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ -bin_PROGRAMS = e +bin_PROGRAMS = enlightenment -e_SOURCES = \ +enlightenment_SOURCES = \ actions.c \ border.c \ desktops.c \ +exec.c \ icccm.c \ -icccm.h \ main.c \ resist.c \ util.c \ e.h -e_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ -lecore -lm $(INTLLIBS) +enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ -lm $(INTLLIBS) diff --git a/src/actions.c b/src/actions.c index 11d0b3e1e..383033cce 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1,6 +1,8 @@ #include "e.h" -/* static prototypes */ +static Evas_List action_protos = NULL; +static Evas_List current_actions = NULL; + static void _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o); static void _e_action_free(E_Action *a); @@ -8,12 +10,9 @@ static void e_act_move_start (void *o, E_Action *a, void *data, int x, int y, in static void e_act_move_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry); static void e_act_move_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy); -static void e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, - int rx, int ry); -static void e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, - int rx, int ry); -static void e_act_resize_go (void *o, E_Action *a, void *data, int x, int y, - int rx, int ry, int dx, int dy); +static void e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry); +static void e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry); +static void e_act_resize_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy); static void e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry); static void e_act_resize_h_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry); @@ -55,10 +54,6 @@ static void e_act_snap_start (void *o, E_Action *a, void *data, int x, int y, in static void e_act_zoom_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry); -/* static globals */ -static Evas_List action_protos = NULL; -static Evas_List current_actions = NULL; - static void _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o) { @@ -79,76 +74,76 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo if (!e_db_int_get(db, "/actions/count", &num)) goto error; for (i = 0; i < num; i++) { - char buf[4096]; - Evas_List l; - a = NULL; - - a = NULL; - sprintf(buf, "/actions/%i/name", i); - a_name = e_db_str_get(db, buf); - sprintf(buf, "/actions/%i/action", i); - a_action = e_db_str_get(db, buf); - sprintf(buf, "/actions/%i/params", i); - a_params = e_db_str_get(db, buf); - sprintf(buf, "/actions/%i/event", i); - e_db_int_get(db, buf, &a_event); - sprintf(buf, "/actions/%i/button", i); - e_db_int_get(db, buf, &a_button); - sprintf(buf, "/actions/%i/key", i); - a_key = e_db_str_get(db, buf); - sprintf(buf, "/actions/%i/modifiers", i); - e_db_int_get(db, buf, &a_modifiers); - - if (act != a_event) goto next; - if (!((a_name) && - (action) && - (!strcmp(a_name, action)))) goto next; - if ((act >= ACT_MOUSE_CLICK) && - (act <= ACT_MOUSE_CLICKED) && - (!((a_button == -1) || - (a_button == button)))) goto next; - if ((act >= ACT_KEY_DOWN) && - (act <= ACT_KEY_UP) && - (!((a_key) && (key) && - (!strcmp(a_key, key))))) goto next; - if ((act >= ACT_MOUSE_CLICK) && - (act <= ACT_KEY_UP) && - (!((a_modifiers == -1) || - (a_modifiers == (int)mods)))) goto next; - for (l = action_protos; l; l = l->next) - { - E_Action_Proto *ap; - - ap = l->data; - if (!strcmp(ap->action, a_action)) - { - - a = NEW(E_Action, 1); - ZERO(a, E_Action, 1); - - OBJ_INIT(a, _e_action_free); - - a->name = a_name; - a->action = a_action; - a->params = a_params; - a->event = a_event; - a->button = a_button; - a->key = a_key; - a->modifiers = a_modifiers; - a->action_proto = ap; - a->object = o; - a->started = 0; - current_actions = evas_list_append(current_actions, a); - } - } - next: - if (!a) - { - IF_FREE(a_name); - IF_FREE(a_action); - IF_FREE(a_params); - IF_FREE(a_key); - } + char buf[4096]; + Evas_List l; + a = NULL; + + a = NULL; + sprintf(buf, "/actions/%i/name", i); + a_name = e_db_str_get(db, buf); + sprintf(buf, "/actions/%i/action", i); + a_action = e_db_str_get(db, buf); + sprintf(buf, "/actions/%i/params", i); + a_params = e_db_str_get(db, buf); + sprintf(buf, "/actions/%i/event", i); + e_db_int_get(db, buf, &a_event); + sprintf(buf, "/actions/%i/button", i); + e_db_int_get(db, buf, &a_button); + sprintf(buf, "/actions/%i/key", i); + a_key = e_db_str_get(db, buf); + sprintf(buf, "/actions/%i/modifiers", i); + e_db_int_get(db, buf, &a_modifiers); + + if (act != a_event) goto next; + if (!((a_name) && + (action) && + (!strcmp(a_name, action)))) goto next; + if ((act >= ACT_MOUSE_CLICK) && + (act <= ACT_MOUSE_CLICKED) && + (!((a_button == -1) || + (a_button == button)))) goto next; + if ((act >= ACT_KEY_DOWN) && + (act <= ACT_KEY_UP) && + (!((a_key) && (key) && + (!strcmp(a_key, key))))) goto next; + if ((act >= ACT_MOUSE_CLICK) && + (act <= ACT_KEY_UP) && + (!((a_modifiers == -1) || + (a_modifiers == (int)mods)))) goto next; + for (l = action_protos; l; l = l->next) + { + E_Action_Proto *ap; + + ap = l->data; + if (!strcmp(ap->action, a_action)) + { + + a = NEW(E_Action, 1); + ZERO(a, E_Action, 1); + + OBJ_INIT(a, _e_action_free); + + a->name = a_name; + a->action = a_action; + a->params = a_params; + a->event = a_event; + a->button = a_button; + a->key = a_key; + a->modifiers = a_modifiers; + a->action_proto = ap; + a->object = o; + a->started = 0; + current_actions = evas_list_append(current_actions, a); + } + } + next: + if (!a) + { + IF_FREE(a_name); + IF_FREE(a_action); + IF_FREE(a_params); + IF_FREE(a_key); + } } error: e_db_close(db); @@ -173,32 +168,32 @@ e_action_start(char *action, int act, int button, char *key, Ev_Key_Modifiers mo again: for (l = current_actions; l; l = l->next) { - E_Action *a; - - a = l->data; - if (!a->started) - { - if (a->action_proto->func_stop) - a->started = 1; - if (a->action_proto->func_start) - { - E_Object *obj; - - if (a->object) - { - obj = a->object; - if (a->started) - OBJ_REF(obj); - } - a->action_proto->func_start(a->object, a, data, x, y, rx, ry); - } - } - if (!a->started) - { - current_actions = evas_list_remove(current_actions, a); - OBJ_DO_FREE(a); - goto again; - } + E_Action *a; + + a = l->data; + if (!a->started) + { + if (a->action_proto->func_stop) + a->started = 1; + if (a->action_proto->func_start) + { + E_Object *obj; + + if (a->object) + { + obj = a->object; + if (a->started) + OBJ_REF(obj); + } + a->action_proto->func_start(a->object, a, data, x, y, rx, ry); + } + } + if (!a->started) + { + current_actions = evas_list_remove(current_actions, a); + OBJ_DO_FREE(a); + goto again; + } } } @@ -210,59 +205,63 @@ e_action_stop(char *action, int act, int button, char *key, Ev_Key_Modifiers mod again: for (l = current_actions; l; l = l->next) { - E_Action *a; - - a = l->data; - if ((a->started) && (a->action_proto->func_stop)) - { - int ok = 0; - - if ((a->event == ACT_MOUSE_IN) && - (act == ACT_MOUSE_OUT)) - ok = 1; - if ((a->event == ACT_MOUSE_OUT) && - (act == ACT_MOUSE_IN)) - ok = 1; - if ((a->event >= ACT_MOUSE_CLICK) && - (a->event <= ACT_MOUSE_TRIPLE) && - (act >= ACT_MOUSE_UP) && - (act <= ACT_MOUSE_CLICKED) && - (a->button == button)) - ok = 1; - if ((a->event == ACT_MOUSE_MOVE) && - ((act == ACT_MOUSE_OUT) || - (act == ACT_MOUSE_IN) || - ((act >= ACT_MOUSE_CLICK) && - (act <= ACT_MOUSE_TRIPLE)) || - (act >= ACT_MOUSE_UP))) - ok = 1; - if ((a->event == ACT_KEY_DOWN) && - (act == ACT_KEY_UP) && - (key) && (a->key) && (!strcmp(key, a->key))) - ok = 1; - if ((a->event == ACT_KEY_UP) && - (act == ACT_KEY_DOWN)) - ok = 1; - if (ok) - { - E_Object *obj; - - if (a->object) - { - obj = a->object; - OBJ_UNREF(obj); - } - a->action_proto->func_stop(a->object, a, data, x, y, rx, ry); - a->started = 0; - } - } - if (!a->started) - { - current_actions = evas_list_remove(current_actions, a); - OBJ_DO_FREE(a); - goto again; - } + E_Action *a; + + a = l->data; + if ((a->started) && (a->action_proto->func_stop)) + { + int ok = 0; + + if ((a->event == ACT_MOUSE_IN) && + (act == ACT_MOUSE_OUT)) + ok = 1; + if ((a->event == ACT_MOUSE_OUT) && + (act == ACT_MOUSE_IN)) + ok = 1; + if ((a->event >= ACT_MOUSE_CLICK) && + (a->event <= ACT_MOUSE_TRIPLE) && + (act >= ACT_MOUSE_UP) && + (act <= ACT_MOUSE_CLICKED) && + (a->button == button)) + ok = 1; + if ((a->event == ACT_MOUSE_MOVE) && + ((act == ACT_MOUSE_OUT) || + (act == ACT_MOUSE_IN) || + ((act >= ACT_MOUSE_CLICK) && + (act <= ACT_MOUSE_TRIPLE)) || + (act >= ACT_MOUSE_UP))) + ok = 1; + if ((a->event == ACT_KEY_DOWN) && + (act == ACT_KEY_UP) && + (key) && (a->key) && (!strcmp(key, a->key))) + ok = 1; + if ((a->event == ACT_KEY_UP) && + (act == ACT_KEY_DOWN)) + ok = 1; + if (ok) + { + E_Object *obj; + + if (a->object) + { + obj = a->object; + OBJ_UNREF(obj); + } + a->action_proto->func_stop(a->object, a, data, x, y, rx, ry); + a->started = 0; + } + } + if (!a->started) + { + current_actions = evas_list_remove(current_actions, a); + OBJ_DO_FREE(a); + goto again; + } } + return; + UN(action); + UN(mods); + UN(o); } void @@ -272,12 +271,19 @@ e_action_go(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, for (l = current_actions; l; l = l->next) { - E_Action *a; - - a = l->data; - if ((a->started) && (a->action_proto->func_go)) - a->action_proto->func_go(a->object, a, data, x, y, rx, ry, dx, dy); + E_Action *a; + + a = l->data; + if ((a->started) && (a->action_proto->func_go)) + a->action_proto->func_go(a->object, a, data, x, y, rx, ry, dx, dy); } + return; + UN(action); + UN(act); + UN(button); + UN(key); + UN(mods); + UN(o); } void @@ -288,33 +294,33 @@ e_action_stop_by_object(void *o, void *data, int x, int y, int rx, int ry) again: for (l = current_actions; l; l = l->next) { - E_Action *a; - - a = l->data; - if ((a->started) && (o == a->object)) - { - E_Object *obj; - - if (a->object) - { - obj = a->object; - OBJ_UNREF(obj); - } - if (a->action_proto->func_stop) - a->action_proto->func_stop(a->object, a, data, x, y, rx, ry); - a->started = 0; - current_actions = evas_list_remove(current_actions, a); - OBJ_DO_FREE(a); - goto again; - } + E_Action *a; + + a = l->data; + if ((a->started) && (o == a->object)) + { + E_Object *obj; + + if (a->object) + { + obj = a->object; + OBJ_UNREF(obj); + } + if (a->action_proto->func_stop) + a->action_proto->func_stop(a->object, a, data, x, y, rx, ry); + a->started = 0; + current_actions = evas_list_remove(current_actions, a); + OBJ_DO_FREE(a); + goto again; + } } } void e_action_add_proto(char *action, - void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry), - void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry), - void (*func_go) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)) + void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry), + void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry), + void (*func_go) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)) { E_Action_Proto *ap; @@ -372,6 +378,13 @@ e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry b->current.requested.dy = 0; b->previous.requested.dx = 0; b->previous.requested.dy = 0; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } static void @@ -389,6 +402,13 @@ e_act_move_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry b->previous.requested.dx = 0; b->previous.requested.dy = 0; e_border_adjust_limits(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } static void @@ -403,6 +423,13 @@ e_act_move_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry if (dy != 0) b->current.requested.dy = dy; b->changed = 1; e_border_adjust_limits(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -417,30 +444,35 @@ e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int /* 2 | 3 */ if (x > (b->current.w / 2)) { - if (y > (b->current.h / 2)) - { - b->mode.resize = 3; - SET_BORDER_GRAVITY(b, NorthWestGravity); - } - else - { - b->mode.resize = 1; - SET_BORDER_GRAVITY(b, SouthWestGravity); - } + if (y > (b->current.h / 2)) + { + b->mode.resize = 3; + SET_BORDER_GRAVITY(b, NorthWestGravity); + } + else + { + b->mode.resize = 1; + SET_BORDER_GRAVITY(b, SouthWestGravity); + } } else { - if (y > (b->current.h / 2)) - { - b->mode.resize = 2; - SET_BORDER_GRAVITY(b, NorthEastGravity); - } - else - { - b->mode.resize = 0; - SET_BORDER_GRAVITY(b, SouthEastGravity); - } + if (y > (b->current.h / 2)) + { + b->mode.resize = 2; + SET_BORDER_GRAVITY(b, NorthEastGravity); + } + else + { + b->mode.resize = 0; + SET_BORDER_GRAVITY(b, SouthEastGravity); + } } + return; + UN(a); + UN(data); + UN(rx); + UN(ry); } static void @@ -456,6 +488,13 @@ e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int b->mode.resize = 0; b->changed = 1; e_border_adjust_limits(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } static void @@ -466,30 +505,37 @@ e_act_resize_go (void *o, E_Action *a, void *data, int x, int y, int rx, int b = o; if (b->mode.resize == 0) { - b->current.requested.w -= dx; - b->current.requested.h -= dy; - b->current.requested.x += dx; - b->current.requested.y += dy; + b->current.requested.w -= dx; + b->current.requested.h -= dy; + b->current.requested.x += dx; + b->current.requested.y += dy; } else if (b->mode.resize == 1) { - b->current.requested.w += dx; - b->current.requested.h -= dy; - b->current.requested.y += dy; + b->current.requested.w += dx; + b->current.requested.h -= dy; + b->current.requested.y += dy; } else if (b->mode.resize == 2) { - b->current.requested.w -= dx; - b->current.requested.h += dy; - b->current.requested.x += dx; + b->current.requested.w -= dx; + b->current.requested.h += dy; + b->current.requested.x += dx; } else if (b->mode.resize == 3) { - b->current.requested.w += dx; - b->current.requested.h += dy; + b->current.requested.w += dx; + b->current.requested.h += dy; } b->changed = 1; e_border_adjust_limits(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -502,14 +548,20 @@ e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, in /* 4 | 5 */ if (x > (b->current.w / 2)) { - b->mode.resize = 5; - SET_BORDER_GRAVITY(b, NorthWestGravity); + b->mode.resize = 5; + SET_BORDER_GRAVITY(b, NorthWestGravity); } else { - b->mode.resize = 4; - SET_BORDER_GRAVITY(b, NorthEastGravity); + b->mode.resize = 4; + SET_BORDER_GRAVITY(b, NorthEastGravity); } + return; + UN(a); + UN(data); + UN(y); + UN(rx); + UN(ry); } static void @@ -525,6 +577,13 @@ e_act_resize_h_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in b->mode.resize = 0; b->changed = 1; e_border_adjust_limits(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } static void @@ -535,15 +594,23 @@ e_act_resize_h_go (void *o, E_Action *a, void *data, int x, int y, int rx, in b = o; if (b->mode.resize == 4) { - b->current.requested.w -= dx; - b->current.requested.x += dx; + b->current.requested.w -= dx; + b->current.requested.x += dx; } else if (b->mode.resize == 5) { - b->current.requested.w += dx; + b->current.requested.w += dx; } b->changed = 1; e_border_adjust_limits(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); + UN(dy); } @@ -558,14 +625,20 @@ e_act_resize_v_start (void *o, E_Action *a, void *data, int x, int y, int rx, in /* 7 */ if (y > (b->current.h / 2)) { - b->mode.resize = 7; - SET_BORDER_GRAVITY(b, NorthWestGravity); + b->mode.resize = 7; + SET_BORDER_GRAVITY(b, NorthWestGravity); } else { - b->mode.resize = 6; - SET_BORDER_GRAVITY(b, SouthWestGravity); + b->mode.resize = 6; + SET_BORDER_GRAVITY(b, SouthWestGravity); } + return; + UN(a); + UN(data); + UN(x); + UN(rx); + UN(ry); } static void @@ -581,6 +654,13 @@ e_act_resize_v_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in b->mode.resize = 0; e_border_adjust_limits(b); b->changed = 1; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } static void @@ -591,15 +671,23 @@ e_act_resize_v_go (void *o, E_Action *a, void *data, int x, int y, int rx, in b = o; if (b->mode.resize == 6) { - b->current.requested.h -= dy; - b->current.requested.y += dy; + b->current.requested.h -= dy; + b->current.requested.y += dy; } else if (b->mode.resize == 7) { - b->current.requested.h += dy; + b->current.requested.h += dy; } e_border_adjust_limits(b); b->changed = 1; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); + UN(dx); } @@ -610,6 +698,13 @@ e_act_close_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r b = o; if (b->win.client) e_icccm_delete(b->win.client); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -620,8 +715,82 @@ e_act_kill_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry b = o; if (b->win.client) e_window_kill_client(b->win.client); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } +static void e_act_cb_shade(int val, void *data); +static void +e_act_cb_shade(int val, void *data) +{ + E_Border *b; + static double t = 0.0; + double dif; + int si; + int pl, pr, pt, pb; + int pix_per_sec = 200; + + b = data; + if (b->client.shaded >= 0) + { + t = e_get_time(); + b->client.shaded = -1; + } + + dif = e_get_time() - t; + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + + si = val - (int)(dif * (double)pix_per_sec); + + if (si <= (pt + pb)) si = pt + pb; + b->current.requested.h = si; + b->changed = 1; + e_border_adjust_limits(b); + if (si != (pt + pb)) + e_add_event_timer("e_act_cb_shade()", 0.02, e_act_cb_shade, val, data); + else + b->client.shaded = 1; +} + +static void e_act_cb_unshade(int val, void *data); +static void +e_act_cb_unshade(int val, void *data) +{ + E_Border *b; + static double t = 0.0; + double dif; + int si; + int pl, pr, pt, pb; + int pix_per_sec = 200; + + b = data; + if (b->client.shaded >= 0) + { + t = e_get_time(); + b->client.shaded = -1; + } + + dif = e_get_time() - t; + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + + si = val - (int)(dif * (double)pix_per_sec); + + if (si <= (pt + pb)) si = pt + pb; + b->current.requested.h = si; + b->changed = 1; + e_border_adjust_limits(b); + if (si != (pt + pb)) + e_add_event_timer("e_act_cb_shade()", 0.02, e_act_cb_shade, val, data); + else + b->client.shaded = 1; +} static void e_act_shade_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry) @@ -629,6 +798,19 @@ e_act_shade_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r E_Border *b; b = o; + /* in the process of being shaded - abort */ + if (b->client.shaded < 0) return; + if (b->client.shaded == 0) + e_act_cb_shade(b->client.h, b); + else + e_act_cb_unshade(b->client.h, b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -639,6 +821,13 @@ e_act_raise_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r b = o; e_border_raise(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -649,6 +838,13 @@ e_act_lower_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r b = o; e_border_lower(b); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -658,6 +854,13 @@ e_act_raise_lower_start (void *o, E_Action *a, void *data, int x, int y, int rx, E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -667,6 +870,13 @@ e_act_exec_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -676,6 +886,13 @@ e_act_menu_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -686,6 +903,13 @@ e_act_exit_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry b = o; exit(0); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -695,6 +919,14 @@ e_act_restart_start (void *o, E_Action *a, void *data, int x, int y, int rx, int E_Border *b; b = o; + e_exec_restart(); + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -704,6 +936,16 @@ e_act_stick_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r E_Border *b; b = o; + if (b->client.sticky) b->client.sticky = 0; + else b->client.sticky = 1; + b->changed = 1; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -713,6 +955,13 @@ e_act_sound_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -722,6 +971,13 @@ e_act_iconify_start (void *o, E_Action *a, void *data, int x, int y, int rx, int E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -731,6 +987,13 @@ e_act_max_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry) E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -740,6 +1003,13 @@ e_act_snap_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } @@ -749,5 +1019,12 @@ e_act_zoom_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry E_Border *b; b = o; + return; + UN(a); + UN(data); + UN(x); + UN(y); + UN(rx); + UN(ry); } diff --git a/src/border.c b/src/border.c index 6a7a3f6a2..318fd095a 100644 --- a/src/border.c +++ b/src/border.c @@ -1,6 +1,20 @@ #include "e.h" -/* static prototypes */ +/* Window border rendering, querying, setting & modification code */ + +/* globals local to window borders */ +static Evas_List evases = NULL; +static Evas_List borders = NULL; + +static int mouse_x, mouse_y, mouse_win_x, mouse_win_y; +static int mouse_buttons = 0; + +static int border_mouse_x = 0; +static int border_mouse_y = 0; +static int border_mouse_buttons = 0; + +static Eevent *current_ev = NULL; + static void e_idle(void *data); static void e_map_request(Eevent * ev); static void e_configure_request(Eevent * ev); @@ -20,8 +34,7 @@ static void e_mouse_out(Eevent * ev); static void e_window_expose(Eevent * ev); static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); -static void e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int - x, int y, int ox, int oy, int ow, int oh); +static void e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); static void e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); static void e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); static void e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); @@ -36,21 +49,6 @@ static void e_cb_border_visibility(E_Border *b); static void e_border_poll(int val, void *data); -/* Window border rendering, querying, setting & modification code */ - -/* globals local to window borders */ -static Evas_List evases = NULL; -static Evas_List borders = NULL; - -static int mouse_x, mouse_y, mouse_win_x, mouse_win_y; -static int mouse_buttons = 0; - -static int border_mouse_x = 0; -static int border_mouse_y = 0; -static int border_mouse_buttons = 0; - -static Eevent *current_ev = NULL; - /* what to dowhen we're idle */ static void e_idle(void *data) @@ -59,19 +57,21 @@ e_idle(void *data) for (l = borders; l; l = l->next) { - E_Border *b; - - b = l->data; - e_border_update(b); + E_Border *b; + + b = l->data; + e_border_update(b); } for (l = evases; l; l = l->next) { - Evas evas; - - evas = l->data; - evas_render(evas); + Evas evas; + + evas = l->data; + evas_render(evas); } e_db_runtime_flush(); + return; + UN(data); } /* */ @@ -83,14 +83,13 @@ e_map_request(Eevent * ev) current_ev = ev; e = ev->event; { - E_Border *b; - - printf("map request %x\n", (int) e->win); - b = e_border_find_by_window(e->win); - if (!b) - { - b = e_border_adopt(e->win, 0); - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (!b) + { + b = e_border_adopt(e->win, 0); + } } current_ev = NULL; } @@ -104,70 +103,65 @@ e_configure_request(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - int pl, pr, pt, pb; + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + int pl, pr, pt, pb; - pl = pr = pt = pb = 0; - if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); - if (e->mask & EV_VALUE_X) - { - printf("request move to %i %i\n", e->x, e->y); - } - if (e->mask & EV_VALUE_X) - b->current.requested.x = e->x; - if (e->mask & EV_VALUE_Y) - b->current.requested.y = e->y; - if (e->mask & EV_VALUE_W) - b->current.requested.w = e->w + pl + pr; - if (e->mask & EV_VALUE_H) - b->current.requested.h = e->h + pt + pb; - if ((e->mask & EV_VALUE_SIBLING) && (e->mask & EV_VALUE_STACKING)) - { - E_Border *b_rel; - - b_rel = e_border_find_by_window(e->stack_win); - if (b_rel) - { - if (e->detail == EV_STACK_ABOVE) e_border_raise_above(b, b_rel); - else if (e->detail == EV_STACK_BELOW) e_border_lower_below(b, b_rel); - /* FIXME: need to handle & fix - * EV_STACK_TOP_IF - * EV_STACK_BOTTOM_IF - * EV_STACK_OPPOSITE - */ - else if (e->detail == EV_STACK_TOP_IF) e_border_raise(b); - else if (e->detail == EV_STACK_BOTTOM_IF) e_border_lower(b); - } - } - else if (e->mask & EV_VALUE_STACKING) - { - if (e->detail == EV_STACK_ABOVE) e_border_raise(b); - else if (e->detail == EV_STACK_BELOW) e_border_lower(b); - /* FIXME: need to handle & fix - * EV_STACK_TOP_IF - * EV_STACK_BOTTOM_IF - * EV_STACK_OPPOSITE - */ - else if (e->detail == EV_STACK_TOP_IF) e_border_raise(b); - else if (e->detail == EV_STACK_BOTTOM_IF) e_border_lower(b); - } - b->changed = 1; - e_border_adjust_limits(b); - } - else - { - if ((e->mask & EV_VALUE_X) && (e->mask & EV_VALUE_W)) - e_window_move_resize(e->win, e->x, e->y, e->w, e->h); - else if ((e->mask & EV_VALUE_W)) - e_window_resize(e->win, e->w, e->h); - else if ((e->mask & EV_VALUE_X)) - e_window_move(e->win, e->x, e->y); - } + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + if (e->mask & EV_VALUE_X) + b->current.requested.x = e->x; + if (e->mask & EV_VALUE_Y) + b->current.requested.y = e->y; + if (e->mask & EV_VALUE_W) + b->current.requested.w = e->w + pl + pr; + if (e->mask & EV_VALUE_H) + b->current.requested.h = e->h + pt + pb; + if ((e->mask & EV_VALUE_SIBLING) && (e->mask & EV_VALUE_STACKING)) + { + E_Border *b_rel; + + b_rel = e_border_find_by_window(e->stack_win); + if (b_rel) + { + if (e->detail == EV_STACK_ABOVE) e_border_raise_above(b, b_rel); + else if (e->detail == EV_STACK_BELOW) e_border_lower_below(b, b_rel); + /* FIXME: need to handle & fix + * EV_STACK_TOP_IF + * EV_STACK_BOTTOM_IF + * EV_STACK_OPPOSITE + */ + else if (e->detail == EV_STACK_TOP_IF) e_border_raise(b); + else if (e->detail == EV_STACK_BOTTOM_IF) e_border_lower(b); + } + } + else if (e->mask & EV_VALUE_STACKING) + { + if (e->detail == EV_STACK_ABOVE) e_border_raise(b); + else if (e->detail == EV_STACK_BELOW) e_border_lower(b); + /* FIXME: need to handle & fix + * EV_STACK_TOP_IF + * EV_STACK_BOTTOM_IF + * EV_STACK_OPPOSITE + */ + else if (e->detail == EV_STACK_TOP_IF) e_border_raise(b); + else if (e->detail == EV_STACK_BOTTOM_IF) e_border_lower(b); + } + b->changed = 1; + e_border_adjust_limits(b); + } + else + { + if ((e->mask & EV_VALUE_X) && (e->mask & EV_VALUE_W)) + e_window_move_resize(e->win, e->x, e->y, e->w, e->h); + else if ((e->mask & EV_VALUE_W)) + e_window_resize(e->win, e->w, e->h); + else if ((e->mask & EV_VALUE_X)) + e_window_move(e->win, e->x, e->y); + } } current_ev = NULL; } @@ -181,17 +175,31 @@ e_property(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + e_icccm_handle_property_change(e->atom, b); + } } current_ev = NULL; } +/* */ +static void +e_client_message(Eevent * ev) +{ + Ev_Message *e; + + current_ev = ev; + e = ev->event; + + e_icccm_handle_client_message(e); + + current_ev = NULL; +} + /* */ static void e_unmap(Eevent * ev) @@ -201,31 +209,29 @@ e_unmap(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - if (b->win.client == e->win) - { - if (b->ignore_unmap > 0) b->ignore_unmap--; - else - { - printf("unmap %x\n",(int) e->win); - e_action_stop_by_object(b, NULL, - mouse_win_x, mouse_win_y, - border_mouse_x, border_mouse_y); - OBJ_UNREF(b); - OBJ_IF_FREE(b) - { - e_window_reparent(e->win, 0, 0, 0); - e_icccm_release(e->win); - OBJ_FREE(b); - } - } - } - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + if (b->win.client == e->win) + { + if (b->ignore_unmap > 0) b->ignore_unmap--; + else + { + e_action_stop_by_object(b, NULL, + mouse_win_x, mouse_win_y, + border_mouse_x, border_mouse_y); + OBJ_UNREF(b); + OBJ_IF_FREE(b) + { + e_window_reparent(e->win, 0, 0, 0); + e_icccm_release(e->win); + OBJ_FREE(b); + } + } + } + } } current_ev = NULL; } @@ -239,27 +245,25 @@ e_destroy(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - printf("destroy %x\n", (int) e->win); - if (b->win.client == e->win) - { - e_action_stop_by_object(b, NULL, - mouse_win_x, mouse_win_y, - border_mouse_x, border_mouse_y); - OBJ_UNREF(b); - OBJ_IF_FREE(b) - { - e_window_reparent(e->win, 0, 0, 0); - e_icccm_release(e->win); - OBJ_FREE(b); - } - } - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + if (b->win.client == e->win) + { + e_action_stop_by_object(b, NULL, + mouse_win_x, mouse_win_y, + border_mouse_x, border_mouse_y); + OBJ_UNREF(b); + OBJ_IF_FREE(b) + { + e_window_reparent(e->win, 0, 0, 0); + e_icccm_release(e->win); + OBJ_FREE(b); + } + } + } } current_ev = NULL; } @@ -273,15 +277,14 @@ e_circulate_request(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - if (e->lower) e_border_lower(b); - else e_border_raise(b); - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + if (e->lower) e_border_lower(b); + else e_border_raise(b); + } } current_ev = NULL; } @@ -296,26 +299,25 @@ e_reparent(Eevent * ev) e = ev->event; #if 0 { - Evas_List l; - E_Border *b; + E_Border *b; - b = e_border_find_by_window(e->win); - if ((b) && (e->parent_from == b->win.container)) - { - if (b) - { - e_action_stop_by_object(b, NULL, - mouse_win_x, mouse_win_y, - border_mouse_x, border_mouse_y); - OBJ_UNREF(b); - OBJ_IF_FREE(b) - { - e_window_reparent(e->win, 0, 0, 0); - e_icccm_release(e->win); - OBJ_FREE(b); - } - } - } + b = e_border_find_by_window(e->win); + if ((b) && (e->parent_from == b->win.container)) + { + if (b) + { + e_action_stop_by_object(b, NULL, + mouse_win_x, mouse_win_y, + border_mouse_x, border_mouse_y); + OBJ_UNREF(b); + OBJ_IF_FREE(b) + { + e_window_reparent(e->win, 0, 0, 0); + e_icccm_release(e->win); + OBJ_FREE(b); + } + } + } } #endif current_ev = NULL; @@ -330,13 +332,12 @@ e_shape(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + } } current_ev = NULL; } @@ -350,15 +351,14 @@ e_focus_in(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - b->current.selected = 1; - b->changed = 1; - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + b->current.selected = 1; + b->changed = 1; + } } current_ev = NULL; } @@ -372,40 +372,39 @@ e_focus_out(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - char *settings_db = PACKAGE_DATA_DIR"/data/settings.db"; - E_DB_File *db; - int focus_mode; - char buf[4096]; + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + char *settings_db = PACKAGE_DATA_DIR"/data/settings.db"; + E_DB_File *db; + int focus_mode; + char buf[4096]; - b->current.selected = 0; - /* settings - click to focus would affect grabs */ - db = e_db_open_read(settings_db); - sprintf(buf, "/focus/mode"); - if ((db) && (e_db_int_get(db, buf, &focus_mode)) && (!b->current.selected)) - { - if (focus_mode == 2) /* click to focus */ - { - E_Grab *g; - - g = NEW(E_Grab, 1); - ZERO(g, E_Grab, 1); - g->button = 0; - g->mods = 0; - g->any_mod = 1; - g->remove_after = 1; - b->grabs = evas_list_append(b->grabs, g); - e_button_grab(b->win.main, 0, XEV_BUTTON | XEV_MOUSE_MOVE, EV_KEY_MODIFIER_NONE, 1); - e_db_close(db); - } - } - b->changed = 1; - } + b->current.selected = 0; + /* settings - click to focus would affect grabs */ + db = e_db_open_read(settings_db); + sprintf(buf, "/focus/mode"); + if ((db) && (e_db_int_get(db, buf, &focus_mode)) && (!b->current.selected)) + { + if (focus_mode == 2) /* click to focus */ + { + E_Grab *g; + + g = NEW(E_Grab, 1); + ZERO(g, E_Grab, 1); + g->button = 0; + g->mods = 0; + g->any_mod = 1; + g->remove_after = 1; + b->grabs = evas_list_append(b->grabs, g); + e_button_grab(b->win.main, 0, XEV_BUTTON | XEV_MOUSE_MOVE, EV_KEY_MODIFIER_NONE, 1); + e_db_close(db); + } + } + b->changed = 1; + } } current_ev = NULL; } @@ -419,13 +418,12 @@ e_colormap(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; + E_Border *b; - b = e_border_find_by_window(e->win); - if (b) - { - } + b = e_border_find_by_window(e->win); + if (b) + { + } } current_ev = NULL; } @@ -439,49 +437,48 @@ e_mouse_down(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - mouse_win_x = e->x; - mouse_win_y = e->y; - mouse_x = e->rx; - mouse_y = e->ry; - mouse_buttons |= (1 << e->button); - b = e_border_find_by_window(e->win); - if (b) - { - if (e->win == b->win.main) e_cb_border_mouse_down(b, ev); - else - { - Evas evas; - int x, y; - - evas = b->evas.l; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_down(evas, x, y, e->button); - evas = b->evas.r; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_down(evas, x, y, e->button); - evas = b->evas.t; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_down(evas, x, y, e->button); - evas = b->evas.b; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_down(evas, x, y, e->button); - } - } + E_Border *b; + + mouse_win_x = e->x; + mouse_win_y = e->y; + mouse_x = e->rx; + mouse_y = e->ry; + mouse_buttons |= (1 << e->button); + b = e_border_find_by_window(e->win); + if (b) + { + if (e->win == b->win.main) e_cb_border_mouse_down(b, ev); + else + { + Evas evas; + int x, y; + + evas = b->evas.l; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_down(evas, x, y, e->button); + evas = b->evas.r; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_down(evas, x, y, e->button); + evas = b->evas.t; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_down(evas, x, y, e->button); + evas = b->evas.b; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_down(evas, x, y, e->button); + } + } } current_ev = NULL; } @@ -495,49 +492,48 @@ e_mouse_up(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - mouse_win_x = e->x; - mouse_win_y = e->y; - mouse_x = e->rx; - mouse_y = e->ry; - mouse_buttons &= ~(1 << e->button); - b = e_border_find_by_window(e->win); - if (b) - { - if (e->win == b->win.main) e_cb_border_mouse_up(b, ev); - else - { - Evas evas; - int x, y; - - evas = b->evas.l; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_up(evas, x, y, e->button); - evas = b->evas.r; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_up(evas, x, y, e->button); - evas = b->evas.t; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_up(evas, x, y, e->button); - evas = b->evas.b; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_button_up(evas, x, y, e->button); - } - } + E_Border *b; + + mouse_win_x = e->x; + mouse_win_y = e->y; + mouse_x = e->rx; + mouse_y = e->ry; + mouse_buttons &= ~(1 << e->button); + b = e_border_find_by_window(e->win); + if (b) + { + if (e->win == b->win.main) e_cb_border_mouse_up(b, ev); + else + { + Evas evas; + int x, y; + + evas = b->evas.l; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_up(evas, x, y, e->button); + evas = b->evas.r; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_up(evas, x, y, e->button); + evas = b->evas.t; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_up(evas, x, y, e->button); + evas = b->evas.b; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_button_up(evas, x, y, e->button); + } + } } current_ev = NULL; } @@ -551,48 +547,47 @@ e_mouse_move(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - E_Border *b; - - mouse_win_x = e->x; - mouse_win_y = e->y; - mouse_x = e->rx; - mouse_y = e->ry; - b = e_border_find_by_window(e->win); - if (b) - { - if (e->win == b->win.main) e_cb_border_mouse_move(b, ev); - else - { - Evas evas; - int x, y; - - evas = b->evas.l; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas = b->evas.r; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas = b->evas.t; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas = b->evas.b; - e_window_get_root_relative_location(evas_get_window(evas), - &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - } - } + E_Border *b; + + mouse_win_x = e->x; + mouse_win_y = e->y; + mouse_x = e->rx; + mouse_y = e->ry; + b = e_border_find_by_window(e->win); + if (b) + { + if (e->win == b->win.main) e_cb_border_mouse_move(b, ev); + else + { + Evas evas; + int x, y; + + evas = b->evas.l; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas = b->evas.r; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas = b->evas.t; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas = b->evas.b; + e_window_get_root_relative_location(evas_get_window(evas), + &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + } + } } current_ev = NULL; } @@ -606,46 +601,46 @@ e_mouse_in(Eevent * ev) current_ev = ev; e = ev->event; { - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - if (e->win == b->win.main) e_cb_border_mouse_in(b, ev); - if (e->win == b->win.input) - { - int x, y; - Evas evas; - - evas = b->evas.l; - e_window_get_root_relative_location(evas_get_window(evas), &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas_event_enter(evas); - - evas = b->evas.r; - e_window_get_root_relative_location(evas_get_window(evas), &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas_event_enter(evas); - - evas = b->evas.t; - e_window_get_root_relative_location(evas_get_window(evas), &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas_event_enter(evas); - - evas = b->evas.b; - e_window_get_root_relative_location(evas_get_window(evas), &x, &y); - x = e->rx - x; - y = e->ry - y; - evas_event_move(evas, x, y); - evas_event_enter(evas); - } - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + if (e->win == b->win.main) e_cb_border_mouse_in(b, ev); + if (e->win == b->win.input) + { + int x, y; + Evas evas; + + evas = b->evas.l; + e_window_get_root_relative_location(evas_get_window(evas), &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas_event_enter(evas); + + evas = b->evas.r; + e_window_get_root_relative_location(evas_get_window(evas), &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas_event_enter(evas); + + evas = b->evas.t; + e_window_get_root_relative_location(evas_get_window(evas), &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas_event_enter(evas); + + evas = b->evas.b; + e_window_get_root_relative_location(evas_get_window(evas), &x, &y); + x = e->rx - x; + y = e->ry - y; + evas_event_move(evas, x, y); + evas_event_enter(evas); + } + } } current_ev = NULL; } @@ -659,20 +654,20 @@ e_mouse_out(Eevent * ev) current_ev = ev; e = ev->event; { - E_Border *b; - - b = e_border_find_by_window(e->win); - if (b) - { - if (e->win == b->win.main) e_cb_border_mouse_out(b, ev); - if (e->win == b->win.input) - { - evas_event_leave(b->evas.l); - evas_event_leave(b->evas.r); - evas_event_leave(b->evas.t); - evas_event_leave(b->evas.b); - } - } + E_Border *b; + + b = e_border_find_by_window(e->win); + if (b) + { + if (e->win == b->win.main) e_cb_border_mouse_out(b, ev); + if (e->win == b->win.input) + { + evas_event_leave(b->evas.l); + evas_event_leave(b->evas.r); + evas_event_leave(b->evas.t); + evas_event_leave(b->evas.b); + } + } } current_ev = NULL; current_ev = NULL; @@ -687,16 +682,16 @@ e_window_expose(Eevent * ev) current_ev = ev; e = ev->event; { - Evas_List l; - - for (l = evases; l; l = l->next) - { - Evas evas; + Evas_List l; + + for (l = evases; l; l = l->next) + { + Evas evas; - evas = l->data; - if (evas_get_window(evas) == e->win) - evas_update_rect(evas, e->x, e->y, e->w, e->h); - } + evas = l->data; + if (evas_get_window(evas) == e->win) + evas_update_rect(evas, e->x, e->y, e->w, e->h); + } } current_ev = NULL; } @@ -715,6 +710,13 @@ e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int if (!current_ev) return; e_action_stop(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y); e_action_start(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y); + return; + UN(o); + UN(bt); + UN(ox); + UN(oy); + UN(ow); + UN(oh); } static void @@ -729,6 +731,13 @@ e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, in if (!current_ev) return; e_action_stop(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y); e_action_start(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y); + return; + UN(o); + UN(bt); + UN(ox); + UN(oy); + UN(ow); + UN(oh); } static void @@ -742,16 +751,22 @@ e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, i border_mouse_buttons = mouse_buttons; if (!current_ev) return; { - int act; - Ev_Key_Modifiers mods; - - mods = ((Ev_Mouse_Down *)(current_ev->event))->mods; - act = ACT_MOUSE_CLICK; - if (((Ev_Mouse_Down *)(current_ev->event))->double_click) act = ACT_MOUSE_DOUBLE; - else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click) act = ACT_MOUSE_TRIPLE; - e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); - e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + int act; + Ev_Key_Modifiers mods; + + mods = ((Ev_Mouse_Down *)(current_ev->event))->mods; + act = ACT_MOUSE_CLICK; + if (((Ev_Mouse_Down *)(current_ev->event))->double_click) act = ACT_MOUSE_DOUBLE; + else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click) act = ACT_MOUSE_TRIPLE; + e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); } + return; + UN(o); + UN(ox); + UN(oy); + UN(ow); + UN(oh); } static void @@ -765,16 +780,18 @@ e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int border_mouse_buttons = mouse_buttons; if (!current_ev) return; { - int act; - Ev_Key_Modifiers mods; - - mods = ((Ev_Mouse_Up *)(current_ev->event))->mods; - act = ACT_MOUSE_UP; - if ((x >= ox) && (x < (ox + ow)) && (y >= oy) && (y < (oy + oh))) - act = ACT_MOUSE_CLICKED; - e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); - e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + int act; + Ev_Key_Modifiers mods; + + mods = ((Ev_Mouse_Up *)(current_ev->event))->mods; + act = ACT_MOUSE_UP; + if ((x >= ox) && (x < (ox + ow)) && (y >= oy) && (y < (oy + oh))) + act = ACT_MOUSE_CLICKED; + e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); } + return; + UN(o); } static void @@ -790,19 +807,25 @@ e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, i border_mouse_y = mouse_y; if (!current_ev) return; e_action_go(class, ACT_MOUSE_MOVE, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y, dx, dy); + return; + UN(o); + UN(bt); + UN(ox); + UN(oy); + UN(ow); + UN(oh); } /* callbacks for certain things */ static void e_cb_border_mouse_in(E_Border *b, Eevent *e) { - E_Action *a; int x, y; char *class = "Window_Grab"; if (border_mouse_buttons) return; /* pointer focus stuff */ - e_focus_to_window(b->win.client); + if (b->client.takes_focus) e_focus_to_window(b->win.client); border_mouse_x = mouse_x; border_mouse_y = mouse_y; @@ -817,7 +840,6 @@ e_cb_border_mouse_in(E_Border *b, Eevent *e) static void e_cb_border_mouse_out(E_Border *b, Eevent *e) { - E_Action *a; int x, y; char *class = "Window_Grab"; @@ -825,18 +847,21 @@ e_cb_border_mouse_out(E_Border *b, Eevent *e) /* pointer focus stuff */ e_focus_to_window(0); + x = mouse_x; + y = mouse_y; border_mouse_x = mouse_x; border_mouse_y = mouse_y; border_mouse_buttons = mouse_buttons; if (!current_ev) return; e_action_stop(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y); e_action_start(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y); + return; + UN(e); } static void e_cb_border_mouse_down(E_Border *b, Eevent *e) { - E_Action *a; int x, y, bt; char *class = "Window_Grab"; @@ -850,41 +875,41 @@ e_cb_border_mouse_down(E_Border *b, Eevent *e) y = ((Ev_Mouse_Down *)(e->event))->y; bt = ((Ev_Mouse_Down *)(e->event))->button; { - Evas_List l; - - again: - for (l = b->grabs; l; l = l->next) - { - E_Grab *g; - - g = l->data; - /* find a grab that triggered this */ - if ((((Ev_Mouse_Down *)(e->event))->button == g->button) && - ((g->any_mod) || - (((Ev_Mouse_Down *)(e->event))->mods == g->mods))) - { - if (g->allow) - e_pointer_replay(((Ev_Mouse_Down *)(e->event))->time); - if (g->remove_after) - { - e_button_ungrab(b->win.main, g->button, g->mods, g->any_mod); - free(g); - b->grabs = evas_list_remove(b->grabs, g); - goto again; - } - } - } + Evas_List l; + + again: + for (l = b->grabs; l; l = l->next) + { + E_Grab *g; + + g = l->data; + /* find a grab that triggered this */ + if ((((Ev_Mouse_Down *)(e->event))->button == g->button) && + ((g->any_mod) || + (((Ev_Mouse_Down *)(e->event))->mods == g->mods))) + { + if (g->allow) + e_pointer_replay(((Ev_Mouse_Down *)(e->event))->time); + if (g->remove_after) + { + e_button_ungrab(b->win.main, g->button, g->mods, g->any_mod); + free(g); + b->grabs = evas_list_remove(b->grabs, g); + goto again; + } + } + } } { - int act; - Ev_Key_Modifiers mods; - - mods = ((Ev_Mouse_Down *)(current_ev->event))->mods; - act = ACT_MOUSE_CLICK; - if (((Ev_Mouse_Down *)(current_ev->event))->double_click) act = ACT_MOUSE_DOUBLE; - else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click) act = ACT_MOUSE_TRIPLE; - e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); - e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + int act; + Ev_Key_Modifiers mods; + + mods = ((Ev_Mouse_Down *)(current_ev->event))->mods; + act = ACT_MOUSE_CLICK; + if (((Ev_Mouse_Down *)(current_ev->event))->double_click) act = ACT_MOUSE_DOUBLE; + else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click) act = ACT_MOUSE_TRIPLE; + e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); } /* * e_pointer_ungrab(((Ev_Mouse_Up *)(e->event))->time); @@ -895,7 +920,6 @@ e_cb_border_mouse_down(E_Border *b, Eevent *e) static void e_cb_border_mouse_up(E_Border *b, Eevent *e) { - E_Action *a; int x, y, bt; char *class = "Window_Grab"; @@ -908,13 +932,13 @@ e_cb_border_mouse_up(E_Border *b, Eevent *e) y = ((Ev_Mouse_Up *)(e->event))->y; bt = ((Ev_Mouse_Up *)(e->event))->button; { - int act; - Ev_Key_Modifiers mods; - - mods = ((Ev_Mouse_Up *)(current_ev->event))->mods; - act = ACT_MOUSE_UP; - e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); - e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + int act; + Ev_Key_Modifiers mods; + + mods = ((Ev_Mouse_Up *)(current_ev->event))->mods; + act = ACT_MOUSE_UP; + e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); + e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y); } } @@ -938,16 +962,22 @@ e_cb_border_mouse_move(E_Border *b, Eevent *e) static void e_cb_border_move_resize(E_Border *b) { + return; + UN(b); } static void e_cb_border_visibility(E_Border *b) { + return; + UN(b); } static void e_border_poll(int val, void *data) { e_add_event_timer("e_border_poll()", 1.00, e_border_poll, val + 1, NULL); + return; + UN(data); } /* border creation, deletion, modification and general queries */ @@ -972,17 +1002,16 @@ e_border_adopt(Window win, int use_client_pos) { E_Border *b; - printf("adopt %x\n", (int) win); /* create the struct */ b = e_border_new(); /* set the right event on the client */ e_window_set_events(win, - XEV_VISIBILITY | - ResizeRedirectMask | - XEV_CONFIGURE | - XEV_FOCUS | - XEV_PROPERTY | - XEV_COLORMAP); + XEV_VISIBILITY | + ResizeRedirectMask | + XEV_CONFIGURE | + XEV_FOCUS | + XEV_PROPERTY | + XEV_COLORMAP); /* parent of the client window listens for these */ e_window_set_events(b->win.container, XEV_CHILD_CHANGE | XEV_CHILD_REDIRECT); /* add to save set & border of 0 */ @@ -994,30 +1023,31 @@ e_border_adopt(Window win, int use_client_pos) e_icccm_get_size_info(win, b); e_icccm_get_mwm_hints(win, b); e_icccm_get_layer(win, b); - printf("%i\n", b->client.layer); + /* we have now placed the bugger */ + b->placed = 1; /* desk area */ e_icccm_set_desk_area(win, 0, 0); e_icccm_set_desk(win, e_desktops_get_current()); if (use_client_pos) { - int x, y; - - e_window_get_geometry(win, &x, &y, NULL, NULL); - b->current.requested.x = x; - b->current.requested.y = y; + int x, y; + + e_window_get_geometry(win, &x, &y, NULL, NULL); + b->current.requested.x = x; + b->current.requested.y = y; } /* reparent the window finally */ e_window_reparent(win, b->win.container, 0, 0); /* figure what border to use */ e_border_apply_border(b); { - int pl, pr, pt, pb; + int pl, pr, pt, pb; - pl = pr = pt = pb = 0; - if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb); - b->current.requested.x += pl; - b->current.requested.y += pt; - b->changed = 1; + pl = pr = pt = pb = 0; + if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb); + b->current.requested.x += pl; + b->current.requested.y += pt; + b->changed = 1; } /* show the client */ e_icccm_state_mapped(win); @@ -1058,6 +1088,7 @@ e_border_new(void) b->client.border = 1; b->client.handles = 1; b->client.titlebar = 1; + b->client.takes_focus = 1; desk = e_desktops_get(e_desktops_get_current()); e_desktops_add_border(desk, b); @@ -1069,43 +1100,43 @@ e_border_new(void) e_window_show(b->win.container); b->evas.l = evas_new_all(e_display_get(), - b->win.main, - 0, 0, 1, 1, - RENDER_METHOD_ALPHA_SOFTWARE, - max_colors, - font_cache, - image_cache, - font_dir); + b->win.main, + 0, 0, 1, 1, + RENDER_METHOD_ALPHA_SOFTWARE, + max_colors, + font_cache, + image_cache, + font_dir); b->win.l = evas_get_window(b->evas.l); e_add_child(b->win.main, b->win.l); b->evas.r = evas_new_all(e_display_get(), - b->win.main, - 0, 0, 1, 1, - RENDER_METHOD_ALPHA_SOFTWARE, - max_colors, - font_cache, - image_cache, - font_dir); + b->win.main, + 0, 0, 1, 1, + RENDER_METHOD_ALPHA_SOFTWARE, + max_colors, + font_cache, + image_cache, + font_dir); b->win.r = evas_get_window(b->evas.r); e_add_child(b->win.main, b->win.r); b->evas.t = evas_new_all(e_display_get(), - b->win.main, - 0, 0, 1, 1, - RENDER_METHOD_ALPHA_SOFTWARE, - max_colors, - font_cache, - image_cache, - font_dir); + b->win.main, + 0, 0, 1, 1, + RENDER_METHOD_ALPHA_SOFTWARE, + max_colors, + font_cache, + image_cache, + font_dir); b->win.t = evas_get_window(b->evas.t); e_add_child(b->win.main, b->win.t); b->evas.b = evas_new_all(e_display_get(), - b->win.main, - 0, 0, 1, 1, - RENDER_METHOD_ALPHA_SOFTWARE, - max_colors, - font_cache, - image_cache, - font_dir); + b->win.main, + 0, 0, 1, 1, + RENDER_METHOD_ALPHA_SOFTWARE, + max_colors, + font_cache, + image_cache, + font_dir); b->win.b = evas_get_window(b->evas.b); e_add_child(b->win.main, b->win.b); @@ -1159,11 +1190,11 @@ e_border_free(E_Border *b) if (b->grabs) { - for (l = b->grabs; l; l = l->next) - { - FREE(l->data); - } - evas_list_free(b->grabs); + for (l = b->grabs; l; l = l->next) + { + FREE(l->data); + } + evas_list_free(b->grabs); } free(b); @@ -1176,16 +1207,16 @@ e_border_remove_mouse_grabs(E_Border *b) if (b->grabs) { - for (l = b->grabs; l; l = l->next) - { - E_Grab *g; - - g = l->data; - e_button_ungrab(b->win.main, g->button, g->mods, g->any_mod); - FREE(g); - } - evas_list_free(b->grabs); - b->grabs = NULL; + for (l = b->grabs; l; l = l->next) + { + E_Grab *g; + + g = l->data; + e_button_ungrab(b->win.main, g->button, g->mods, g->any_mod); + FREE(g); + } + evas_list_free(b->grabs); + b->grabs = NULL; } } @@ -1203,64 +1234,64 @@ e_border_attach_mouse_grabs(E_Border *b) sprintf(buf, "/focus/mode"); if ((db) && (e_db_int_get(db, buf, &focus_mode)) && (!b->current.selected)) { - if (focus_mode == 2) /* click to focus */ - { - E_Grab *g; - - g = NEW(E_Grab, 1); - ZERO(g, E_Grab, 1); - g->button = 0; - g->mods = 0; - g->any_mod = 1; - g->remove_after = 1; - b->grabs = evas_list_append(b->grabs, g); - e_button_grab(b->win.main, 0, XEV_BUTTON | XEV_MOUSE_MOVE, EV_KEY_MODIFIER_NONE, 1); - e_db_close(db); - } + if (focus_mode == 2) /* click to focus */ + { + E_Grab *g; + + g = NEW(E_Grab, 1); + ZERO(g, E_Grab, 1); + g->button = 0; + g->mods = 0; + g->any_mod = 1; + g->remove_after = 1; + b->grabs = evas_list_append(b->grabs, g); + e_button_grab(b->win.main, 0, XEV_BUTTON | XEV_MOUSE_MOVE, EV_KEY_MODIFIER_NONE, 1); + e_db_close(db); + } } /* other grabs - liek alt+left to move */ db = e_db_open_read(grabs_db); if (db) { - int i, num; - - sprintf(buf, "/grabs/count"); - if (!e_db_int_get(db, buf, &num)) - { - e_db_close(db); - return; - } - for (i = 0; i < num; i++) - { - int button, any_mod, mod; - Ev_Key_Modifiers mods; + int i, num; + + sprintf(buf, "/grabs/count"); + if (!e_db_int_get(db, buf, &num)) + { + e_db_close(db); + return; + } + for (i = 0; i < num; i++) + { + int button, any_mod, mod; + Ev_Key_Modifiers mods; - button = -1; - mods = EV_KEY_MODIFIER_NONE; - any_mod = 0; - sprintf(buf, "/grabs/%i/button", i); - if (!e_db_int_get(db, buf, &button)) continue; - sprintf(buf, "/grabs/%i/modifiers", i); - if (!e_db_int_get(db, buf, &mod)) continue; - if (mod == -1) any_mod = 1; - mods = (Ev_Key_Modifiers)mod; - - if (button >= 0) - { - E_Grab *g; - - g = NEW(E_Grab, 1); - ZERO(g, E_Grab, 1); - g->button = button; - g->mods = mods; - g->any_mod = any_mod; - g->remove_after = 0; - b->grabs = evas_list_append(b->grabs, g); - e_button_grab(b->win.main, button, XEV_BUTTON | XEV_MOUSE_MOVE, mods, 0); - } - } - e_db_close(db); + button = -1; + mods = EV_KEY_MODIFIER_NONE; + any_mod = 0; + sprintf(buf, "/grabs/%i/button", i); + if (!e_db_int_get(db, buf, &button)) continue; + sprintf(buf, "/grabs/%i/modifiers", i); + if (!e_db_int_get(db, buf, &mod)) continue; + if (mod == -1) any_mod = 1; + mods = (Ev_Key_Modifiers)mod; + + if (button >= 0) + { + E_Grab *g; + + g = NEW(E_Grab, 1); + ZERO(g, E_Grab, 1); + g->button = button; + g->mods = mods; + g->any_mod = any_mod; + g->remove_after = 0; + b->grabs = evas_list_append(b->grabs, g); + e_button_grab(b->win.main, button, XEV_BUTTON | XEV_MOUSE_MOVE, mods, 0); + } + } + e_db_close(db); } } @@ -1298,18 +1329,18 @@ e_border_redo_grabs(void) mod_date_grabs = mod; if (!changed) { - mod = e_file_modified_time(settings_db); - if (mod != mod_date_settings) changed = 1; - mod_date_settings = mod; + mod = e_file_modified_time(settings_db); + if (mod != mod_date_settings) changed = 1; + mod_date_settings = mod; } if (!changed) return; for (l = borders; l; l = l->next) { - E_Border *b; - - b = l->data; - e_border_remove_mouse_grabs(b); - e_border_attach_mouse_grabs(b); + E_Border *b; + + b = l->data; + e_border_remove_mouse_grabs(b); + e_border_attach_mouse_grabs(b); } } @@ -1320,19 +1351,19 @@ e_border_find_by_window(Window win) for (l = borders; l; l = l->next) { - E_Border *b; - - b = l->data; - - if ((win == b->win.main) || - (win == b->win.client) || - (win == b->win.container) || - (win == b->win.input) || - (win == b->win.l) || - (win == b->win.r) || - (win == b->win.t) || - (win == b->win.b)) - return b; + E_Border *b; + + b = l->data; + + if ((win == b->win.main) || + (win == b->win.client) || + (win == b->win.container) || + (win == b->win.input) || + (win == b->win.l) || + (win == b->win.r) || + (win == b->win.t) || + (win == b->win.b)) + return b; } return NULL; } @@ -1368,40 +1399,40 @@ e_border_set_bits(E_Border *b, char *file) if (b->bits.t) { - ebits_add_to_evas(b->bits.l, b->evas.l); - ebits_move(b->bits.l, 0, 0); - ebits_show(b->bits.l); + ebits_add_to_evas(b->bits.l, b->evas.l); + ebits_move(b->bits.l, 0, 0); + ebits_show(b->bits.l); - ebits_add_to_evas(b->bits.r, b->evas.r); - ebits_move(b->bits.r, 0, 0); - ebits_show(b->bits.r); + ebits_add_to_evas(b->bits.r, b->evas.r); + ebits_move(b->bits.r, 0, 0); + ebits_show(b->bits.r); - ebits_add_to_evas(b->bits.t, b->evas.t); - ebits_move(b->bits.t, 0, 0); - ebits_show(b->bits.t); + ebits_add_to_evas(b->bits.t, b->evas.t); + ebits_move(b->bits.t, 0, 0); + ebits_show(b->bits.t); - ebits_add_to_evas(b->bits.b, b->evas.b); - ebits_move(b->bits.b, 0, 0); - ebits_show(b->bits.b); - - e_border_set_color_class(b, "Title BG", 100, 200, 255, 255); + ebits_add_to_evas(b->bits.b, b->evas.b); + ebits_move(b->bits.b, 0, 0); + ebits_show(b->bits.b); + + e_border_set_color_class(b, "Title BG", 100, 200, 255, 255); -#define HOOK_CB(_class) \ +#define HOOK_CB(_class) \ ebits_set_bit_callback(b->bits.t, _class, CALLBACK_MOUSE_IN, e_cb_mouse_in, b); \ ebits_set_bit_callback(b->bits.t, _class, CALLBACK_MOUSE_OUT, e_cb_mouse_out, b); \ ebits_set_bit_callback(b->bits.t, _class, CALLBACK_MOUSE_DOWN, e_cb_mouse_down, b); \ ebits_set_bit_callback(b->bits.t, _class, CALLBACK_MOUSE_UP, e_cb_mouse_up, b); \ ebits_set_bit_callback(b->bits.t, _class, CALLBACK_MOUSE_MOVE, e_cb_mouse_move, b); - HOOK_CB("Title_Bar"); - HOOK_CB("Resize"); - HOOK_CB("Resize_Horizontal"); - HOOK_CB("Resize_Vertical"); - HOOK_CB("Close"); - HOOK_CB("Iconify"); - HOOK_CB("Max_Size"); - HOOK_CB("Menu"); - - e_border_adjust_limits(b); + HOOK_CB("Title_Bar"); + HOOK_CB("Resize"); + HOOK_CB("Resize_Horizontal"); + HOOK_CB("Resize_Vertical"); + HOOK_CB("Close"); + HOOK_CB("Iconify"); + HOOK_CB("Max_Size"); + HOOK_CB("Menu"); + + e_border_adjust_limits(b); } } @@ -1423,7 +1454,7 @@ e_border_adjust_limits(E_Border *b) else { b->current.x = b->current.requested.x; - b->current.y = b->current.requested.y; + b->current.y = b->current.requested.y; } b->current.w = b->current.requested.w; @@ -1432,7 +1463,7 @@ e_border_adjust_limits(E_Border *b) pl = pr = pt = pb = 0; if (b->current.w < 1) b->current.w = 1; if (b->current.h < 1) b->current.h = 1; - + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); if (b->current.w < (pl + pr + 1)) b->current.w = pl + pr + 1; @@ -1442,11 +1473,11 @@ e_border_adjust_limits(E_Border *b) h = b->current.h - pt - pb; mx = my = 1; - if (b->bits.t) ebits_get_min_size(b->bits.t, &mx, &my); + if (b->bits.t) ebits_get_min_size(b->bits.t, &mx, &my); if (b->current.w < mx) b->current.w = mx; if (b->current.h < my) b->current.h = my; mx = my = 999999; - if (b->bits.t) ebits_get_max_size(b->bits.t, &mx, &my); + if (b->bits.t) ebits_get_max_size(b->bits.t, &mx, &my); if (b->current.w > mx) b->current.w = mx; if (b->current.h > my) b->current.h = my; @@ -1456,42 +1487,42 @@ e_border_adjust_limits(E_Border *b) if (h > b->client.max.h) h = b->client.max.h; if ((w > 0) && (h > 0)) { - w -= b->client.base.w; - h -= b->client.base.h; - if ((w > 0) && (h > 0)) - { - int i, j; - double aspect; - - aspect = ((double)w) / ((double)h); - if ((b->mode.resize == 4) || (b->mode.resize == 5)) - { - if (aspect < b->client.min.aspect) - h = (int)((double)w / b->client.min.aspect); - if (aspect > b->client.max.aspect) - h = (int)((double)w / b->client.max.aspect); - } - else if ((b->mode.resize == 6) || (b->mode.resize == 7)) - { - if (aspect < b->client.min.aspect) - w = (int)((double)h * b->client.min.aspect); - if (aspect > b->client.max.aspect) - w = (int)((double)h * b->client.max.aspect); - } - else - { - if (aspect < b->client.min.aspect) - w = (int)((double)h * b->client.min.aspect); - if (aspect > b->client.max.aspect) - h = (int)((double)w / b->client.max.aspect); - } - i = w / b->client.step.w; - j = h / b->client.step.h; - w = i * b->client.step.w; - h = j * b->client.step.h; - } - w += b->client.base.w; - h += b->client.base.h; + w -= b->client.base.w; + h -= b->client.base.h; + if ((w > 0) && (h > 0)) + { + int i, j; + double aspect; + + aspect = ((double)w) / ((double)h); + if ((b->mode.resize == 4) || (b->mode.resize == 5)) + { + if (aspect < b->client.min.aspect) + h = (int)((double)w / b->client.min.aspect); + if (aspect > b->client.max.aspect) + h = (int)((double)w / b->client.max.aspect); + } + else if ((b->mode.resize == 6) || (b->mode.resize == 7)) + { + if (aspect < b->client.min.aspect) + w = (int)((double)h * b->client.min.aspect); + if (aspect > b->client.max.aspect) + w = (int)((double)h * b->client.max.aspect); + } + else + { + if (aspect < b->client.min.aspect) + w = (int)((double)h * b->client.min.aspect); + if (aspect > b->client.max.aspect) + h = (int)((double)w / b->client.max.aspect); + } + i = w / b->client.step.w; + j = h / b->client.step.h; + w = i * b->client.step.w; + h = j * b->client.step.h; + } + w += b->client.base.w; + h += b->client.base.h; } b->current.w = w + pl + pr; b->current.h = h + pt + pb; @@ -1501,16 +1532,16 @@ e_border_adjust_limits(E_Border *b) } else if ((b->mode.resize == 0) || (b->mode.resize == 4)) { - b->current.x += (b->current.requested.w - b->current.w); - b->current.y += (b->current.requested.h - b->current.h); + b->current.x += (b->current.requested.w - b->current.w); + b->current.y += (b->current.requested.h - b->current.h); } else if ((b->mode.resize == 1) || (b->mode.resize == 6)) { - b->current.y += (b->current.requested.h - b->current.h); + b->current.y += (b->current.requested.h - b->current.h); } else if ((b->mode.resize == 2)) { - b->current.x += (b->current.requested.w - b->current.w); + b->current.x += (b->current.requested.w - b->current.w); } } @@ -1536,8 +1567,8 @@ e_border_update(E_Border *b) shape_changed = 1; if (b->bits.new) { - e_window_gravity_set(b->win.container, StaticGravity); - border_changed = 1; + e_window_gravity_set(b->win.container, StaticGravity); + border_changed = 1; } if ((border_changed) && (b->has_shape)) shape_changed = 1; @@ -1548,81 +1579,101 @@ e_border_update(E_Border *b) if (state_changed) { - e_border_apply_border(b); - if (!border_changed) - { - e_window_gravity_set(b->win.container, StaticGravity); - border_changed = 1; - size_changed = 1; - } + e_border_apply_border(b); + if (!border_changed) + { + e_window_gravity_set(b->win.container, StaticGravity); + border_changed = 1; + size_changed = 1; + } } if ((location_changed) && (!size_changed)) { - int pl, pr, pt, pb; - - e_window_move(b->win.main, b->current.x, b->current.y); - pl = pr = pt = pb = 0; - if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); - e_icccm_move_resize(b->win.client, - b->current.x + pl, b->current.y + pt, - b->current.w - pl - pr, b->current.h - pt - pb); - e_cb_border_move_resize(b); + int pl, pr, pt, pb; + + e_window_move(b->win.main, b->current.x, b->current.y); + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + e_icccm_move_resize(b->win.client, + b->current.x + pl, b->current.y + pt, + b->current.w - pl - pr, b->current.h - pt - pb); + e_cb_border_move_resize(b); } else if (size_changed) { - int pl, pr, pt, pb, x, y, w, h; - int smaller; - - smaller = 0; - if ((b->current.w < b->previous.w) || (b->current.h < b->previous.h)) - smaller = 1; - pl = pr = pt = pb = 0; - if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); - e_window_resize(b->win.client, b->current.w - pl - pr, b->current.h - pt - pb); - e_window_move_resize(b->win.input, - 0, 0, b->current.w, b->current.h); - e_window_move_resize(b->win.main, - b->current.x, b->current.y, - b->current.w, b->current.h); - e_window_move_resize(b->win.container, pl, pt, - b->current.w - pl - pr, b->current.h - pt -pb); - x = 0, y = pt, w = pl, h = (b->current.h - pt - pb); - e_window_move_resize(b->win.l, x, y, w, h); - evas_set_output_size(b->evas.l, w, h); - evas_set_output_viewport(b->evas.l, x, y, w, h); - - x = 0, y = 0, w = b->current.w, h = pt; - e_window_move_resize(b->win.t, x, y, w, h); - evas_set_output_size(b->evas.t, w, h); - evas_set_output_viewport(b->evas.t, x, y, w, h); - - x = b->current.w - pr, y = pt, w = pr, h = (b->current.h - pt - pb); - e_window_move_resize(b->win.r, x, y, w, h); - evas_set_output_size(b->evas.r, w, h); - evas_set_output_viewport(b->evas.r, x, y, w, h); - - x = 0, y = b->current.h - pb, w = b->current.w, h = pb; - e_window_move_resize(b->win.b, x, y, w, h); - evas_set_output_size(b->evas.b, w, h); - evas_set_output_viewport(b->evas.b, x, y, w, h); - - if (b->bits.l) ebits_resize(b->bits.l, b->current.w, b->current.h); - if (b->bits.r) ebits_resize(b->bits.r, b->current.w, b->current.h); - if (b->bits.t) ebits_resize(b->bits.t, b->current.w, b->current.h); - if (b->bits.b) ebits_resize(b->bits.b, b->current.w, b->current.h); - - e_icccm_move_resize(b->win.client, - b->current.x + pl, b->current.y + pt, - b->current.w - pl - pr, b->current.h - pt - pb); - e_cb_border_move_resize(b); + int pl, pr, pt, pb, x, y, w, h; + int smaller; + + smaller = 0; + if ((b->current.w < b->previous.w) || (b->current.h < b->previous.h)) + smaller = 1; + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + e_window_resize(b->win.client, b->current.w - pl - pr, b->current.h - pt - pb); + e_window_move_resize(b->win.input, + 0, 0, b->current.w, b->current.h); + e_window_move_resize(b->win.main, + b->current.x, b->current.y, + b->current.w, b->current.h); + e_window_move_resize(b->win.container, pl, pt, + b->current.w - pl - pr, b->current.h - pt -pb); + x = 0, y = pt, w = pl, h = (b->current.h - pt - pb); + if ((w <1) && (h < 1)) e_window_hide(b->win.l); + else + { + e_window_show(b->win.l); + e_window_move_resize(b->win.l, x, y, w, h); + evas_set_output_size(b->evas.l, w, h); + evas_set_output_viewport(b->evas.l, x, y, w, h); + } + + x = 0, y = 0, w = b->current.w, h = pt; + if ((w <1) && (h < 1)) e_window_hide(b->win.t); + else + { + e_window_show(b->win.t); + e_window_move_resize(b->win.t, x, y, w, h); + evas_set_output_size(b->evas.t, w, h); + evas_set_output_viewport(b->evas.t, x, y, w, h); + } + + x = b->current.w - pr, y = pt, w = pr, h = (b->current.h - pt - pb); + if ((w <1) && (h < 1)) e_window_hide(b->win.r); + else + { + e_window_show(b->win.r); + e_window_move_resize(b->win.r, x, y, w, h); + evas_set_output_size(b->evas.r, w, h); + evas_set_output_viewport(b->evas.r, x, y, w, h); + } + + x = 0, y = b->current.h - pb, w = b->current.w, h = pb; + if ((w <1) && (h < 1)) e_window_hide(b->win.b); + else + { + e_window_show(b->win.b); + e_window_move_resize(b->win.b, x, y, w, h); + evas_set_output_size(b->evas.b, w, h); + evas_set_output_viewport(b->evas.b, x, y, w, h); + } + + if (b->bits.l) ebits_resize(b->bits.l, b->current.w, b->current.h); + if (b->bits.r) ebits_resize(b->bits.r, b->current.w, b->current.h); + if (b->bits.t) ebits_resize(b->bits.t, b->current.w, b->current.h); + if (b->bits.b) ebits_resize(b->bits.b, b->current.w, b->current.h); + + e_icccm_move_resize(b->win.client, + b->current.x + pl, b->current.y + pt, + b->current.w - pl - pr, b->current.h - pt - pb); + e_cb_border_move_resize(b); } if (visibility_changed) { - if (b->current.visible) - e_window_show(b->win.main); - else - e_window_hide(b->win.main); - e_cb_border_visibility(b); + if (b->current.visible) + e_window_show(b->win.main); + else + e_window_hide(b->win.main); + e_cb_border_visibility(b); } if (border_changed) @@ -1635,8 +1686,6 @@ e_border_update(E_Border *b) void e_border_set_layer(E_Border *b, int layer) { - Evas_List l; - E_Border *rel = NULL; int dl; if (b->client.layer == layer) return; @@ -1654,30 +1703,30 @@ e_border_raise(E_Border *b) if (!b->desk->windows) { - b->desk->windows = evas_list_append(b->desk->windows, b); - b->desk->changed = 1; - e_window_raise(b->win.main); - return; + b->desk->windows = evas_list_append(b->desk->windows, b); + b->desk->changed = 1; + e_window_raise(b->win.main); + return; } for (l = b->desk->windows; l; l = l->next) { - rel = l->data; - if (rel->client.layer > b->client.layer) - { - b->desk->windows = evas_list_remove(b->desk->windows, b); - b->desk->windows = evas_list_prepend_relative(b->desk->windows, b, rel); - b->desk->changed = 1; - e_window_stack_below(b->win.main, rel->win.main); - return; - } - if ((!l->next) && (l->data != b)) - { - b->desk->windows = evas_list_remove(b->desk->windows, b); - b->desk->windows = evas_list_append(b->desk->windows, b); - b->desk->changed = 1; - e_window_raise(b->win.main); - return; - } + rel = l->data; + if (rel->client.layer > b->client.layer) + { + b->desk->windows = evas_list_remove(b->desk->windows, b); + b->desk->windows = evas_list_prepend_relative(b->desk->windows, b, rel); + b->desk->changed = 1; + e_window_stack_below(b->win.main, rel->win.main); + return; + } + if ((!l->next) && (l->data != b)) + { + b->desk->windows = evas_list_remove(b->desk->windows, b); + b->desk->windows = evas_list_append(b->desk->windows, b); + b->desk->changed = 1; + e_window_raise(b->win.main); + return; + } } } @@ -1689,23 +1738,23 @@ e_border_lower(E_Border *b) if (!b->desk->windows) { - b->desk->windows = evas_list_append(b->desk->windows, b); - b->desk->changed = 1; - e_window_raise(b->win.main); - return; + b->desk->windows = evas_list_append(b->desk->windows, b); + b->desk->changed = 1; + e_window_raise(b->win.main); + return; } for (l = b->desk->windows; l; l = l->next) { - rel = l->data; - if (rel->client.layer == b->client.layer) - { - if (b == rel) return; - b->desk->windows = evas_list_remove(b->desk->windows, b); - b->desk->windows = evas_list_prepend_relative(b->desk->windows, b, rel); - b->desk->changed = 1; - e_window_stack_below(b->win.main, rel->win.main); - return; - } + rel = l->data; + if (rel->client.layer == b->client.layer) + { + if (b == rel) return; + b->desk->windows = evas_list_remove(b->desk->windows, b); + b->desk->windows = evas_list_prepend_relative(b->desk->windows, b, rel); + b->desk->changed = 1; + e_window_stack_below(b->win.main, rel->win.main); + return; + } } } @@ -1714,10 +1763,10 @@ e_border_raise_above(E_Border *b, E_Border *above) { if (!b->desk->windows) { - b->desk->windows = evas_list_append(b->desk->windows, b); - b->desk->changed = 1; - e_window_raise(b->win.main); - return; + b->desk->windows = evas_list_append(b->desk->windows, b); + b->desk->changed = 1; + e_window_raise(b->win.main); + return; } if (!evas_list_find(b->desk->windows, above)) return; if (b->client.layer < above->client.layer) b->client.layer = above->client.layer; @@ -1732,9 +1781,9 @@ e_border_lower_below(E_Border *b, E_Border *below) { if (!b->desk->windows) { - b->desk->windows = evas_list_append(b->desk->windows, b); - b->desk->changed = 1; - return; + b->desk->windows = evas_list_append(b->desk->windows, b); + b->desk->changed = 1; + return; } if (!evas_list_find(b->desk->windows, below)) return; if (b->client.layer > below->client.layer) b->client.layer = below->client.layer; @@ -1778,28 +1827,26 @@ e_border_adopt_children(Window win) wins = e_window_get_children(win, &num); if (wins) { - for (i = 0; i < num; i++) - { - if (e_window_is_manageable(wins[i])) - { - E_Border *b; - - printf("manage %x\n", (int) wins[i]); - b = e_border_adopt(wins[i], 1); - { - int pl, pr, pt, pb; - - pl = pr = pt = pb = 0; - if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb); - b->current.requested.x -= pl; - b->current.requested.y -= pt; - printf("back %i %i\n", pl, pt); - b->changed = 1; - e_border_adjust_limits(b); - } - b->ignore_unmap = 2; - } - } - free(wins); + for (i = 0; i < num; i++) + { + if (e_window_is_manageable(wins[i])) + { + E_Border *b; + + b = e_border_adopt(wins[i], 1); + { + int pl, pr, pt, pb; + + pl = pr = pt = pb = 0; + if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb); + b->current.requested.x -= pl; + b->current.requested.y -= pt; + b->changed = 1; + e_border_adjust_limits(b); + } + b->ignore_unmap = 2; + } + } + free(wins); } } diff --git a/src/desktops.c b/src/desktops.c index dc2a67de3..8c2f0a61b 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -25,6 +25,8 @@ e_idle(void *data) e_desktops_update(desk); } e_db_runtime_flush(); + return; + UN(data); } /* handling mouse down events */ @@ -54,6 +56,8 @@ e_mouse_down(Eevent * ev) x = e->rx - x; y = e->ry - y; evas_event_button_down(evas, x, y, e->button); + if (e->button == 3) + e_exec_restart(); return; } } @@ -341,7 +345,22 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy) void e_desktops_free(E_Desktop *desk) { + while (desk->windows) + { + E_Border *b; + + b = desk->windows->data; + e_action_stop_by_object(b, NULL, 0, 0, 0, 0); + OBJ_UNREF(b); + OBJ_IF_FREE(b) + { + e_window_reparent(b->win.client, 0, 0, 0); + e_icccm_release(b->win.client); + OBJ_FREE(b); + } + } e_window_destroy(desk->win.main); + if (desk->evas.pmap) e_pixmap_free(desk->evas.pmap); IF_FREE(desk->name); IF_FREE(desk->dir); FREE(desk); @@ -443,6 +462,7 @@ e_desktops_delete(E_Desktop *d) void e_desktops_show(E_Desktop *d) { + e_desktops_update(d); e_window_show(d->win.main); } @@ -491,7 +511,6 @@ e_desktops_update(E_Desktop *desk) { Imlib_Updates u; - printf("rendered desktop\n"); for (u = up; u; u = imlib_updates_get_next(u)) { int x, y, w, h; diff --git a/src/e.h b/src/e.h index b0506bedb..27ba8e298 100644 --- a/src/e.h +++ b/src/e.h @@ -1,6 +1,3 @@ -#ifndef __E_H_ -#define __E_H_ - #include "../config.h" #include #include @@ -20,6 +17,9 @@ #include #include #include +#ifdef WITH_DMALLOC +#include +#endif #define E_PROF 1 #ifdef E_PROF @@ -100,6 +100,7 @@ _e_obj->e_obj_free = (void *) _e_obj_free_func; \ #define SPANS_COMMON(x1, w1, x2, w2) \ (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) +#define UN(_blah) _blah = 0 #define ACT_MOUSE_IN 0 #define ACT_MOUSE_OUT 1 @@ -178,16 +179,19 @@ struct _E_Border char *class; char *command; Window group; + int takes_focus; int sticky; Colormap colormap; int fixed; int arrange_ignore; int shaded; int hidden; + int iconified; int borderless; int titlebar; int border; int handles; + int w, h; } client; struct { @@ -199,6 +203,8 @@ struct _E_Border int ignore_unmap; + int placed; + Evas_List grabs; E_Desktop *desk; @@ -299,7 +305,8 @@ void e_border_lower(E_Border *b); void e_border_raise_above(E_Border *b, E_Border *above); void e_border_lower_below(E_Border *b, E_Border *below); void e_border_init(void); - +void e_border_adopt_children(Window win); + void e_icccm_move_resize(Window win, int x, int y, int w, int h); void e_icccm_delete(Window win); void e_icccm_state_mapped(Window win); @@ -314,6 +321,8 @@ void e_icccm_set_frame_size(Window win, int l, int r, int t, int b); void e_icccm_set_desk_area(Window win, int ax, int ay); void e_icccm_set_desk_area_size(Window win, int ax, int ay); void e_icccm_set_desk(Window win, int d); +void e_icccm_handle_property_change(Atom a, E_Border *b); +void e_icccm_handle_client_message(Ev_Message *e); void e_icccm_advertise_e_compat(void); void e_icccm_advertise_mwm_compat(void); void e_icccm_advertise_gnome_compat(void); @@ -338,6 +347,11 @@ void e_desktops_update(E_Desktop *desk); void e_resist_border(E_Border *b); time_t e_file_modified_time(char *file); +void e_set_env(char *variable, char *content); -#endif +void e_exec_set_args(int argc, char **argv); +void e_exec_restart(void); +pid_t e_exec_run(char *exe); +pid_t e_exec_run_in_dir(char *exe, char *dir); +pid_t e_run_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, char *launch_path); diff --git a/src/icccm.c b/src/icccm.c index c845b8f3c..95dd183d9 100644 --- a/src/icccm.c +++ b/src/icccm.c @@ -1,5 +1,46 @@ #include "e.h" -#include "icccm.h" + +/* Motif window hints */ +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) + +/* bit definitions for MwmHints.functions */ +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) + +/* bit definitions for MwmHints.decorations */ +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) + +/* bit definitions for MwmHints.inputMode */ +#define MWM_INPUT_MODELESS 0 +#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 +#define MWM_INPUT_SYSTEM_MODAL 2 +#define MWM_INPUT_FULL_APPLICATION_MODAL 3 + +#define PROP_MWM_HINTS_ELEMENTS 5 + +/* Motif window hints */ +typedef struct _mwmhints +{ + int flags; + int functions; + int decorations; + int inputMode; + int status; +} +MWMHints; void e_icccm_move_resize(Window win, int x, int y, int w, int h) @@ -105,8 +146,6 @@ e_icccm_get_size_info(Window win, E_Border *b) x = 0; y = 0; w = 0; h = 0; e_window_get_geometry(win, &x, &y, &w, &h); - printf("window at %i %i\n", x, y); - grav = NorthWestGravity; mask = 0; min_w = 0; @@ -121,14 +160,27 @@ e_icccm_get_size_info(Window win, E_Border *b) base_h = 0; if (e_window_get_wm_size_hints(win, &hint, &mask)) { - if (hint.flags & PWinGravity) grav = hint.win_gravity; - if ((hint.flags & USPosition) || ((hint.flags & PPosition))) + if (!b->placed) { + if (hint.flags & PWinGravity) grav = hint.win_gravity; + if ((hint.flags & USPosition) || ((hint.flags & PPosition))) + { + } + else + { + /* get x,y location of client */ + x = rand()%640; + y = rand()%480; + } } else { - x = rand()%640; - y = rand()%480; + int pl, pr, pt, pb; + + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + x = b->current.x + pl; + y = b->current.y + pt; } if (hint.flags & PMinSize) { @@ -171,15 +223,27 @@ e_icccm_get_size_info(Window win, E_Border *b) } else { - /* get x,y location of client */ - x = rand()%640; - y = rand()%480; + if (!b->placed) + { + /* get x,y location of client */ + x = rand()%640; + y = rand()%480; + } + else + { + int pl, pr, pt, pb; + + pl = pr = pt = pb = 0; + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); + x = b->current.x + pl; + y = b->current.y + pt; + } } { int pl, pr, pt, pb; pl = pr = pt = pb = 0; - if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb); + if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); b->current.requested.x = x - pl; b->current.requested.y = y - pt; b->current.requested.w = w + pl + pr; @@ -210,7 +274,7 @@ e_icccm_get_mwm_hints(Window win, E_Border *b) mwmhints = e_window_property_get(win, a_motif_wm_hints, a_motif_wm_hints, &size); if (mwmhints) { - int i, num; + int num; num = size / sizeof(int); if (num < PROP_MWM_HINTS_ELEMENTS) @@ -249,7 +313,7 @@ e_icccm_get_layer(Window win, E_Border *b) props = e_window_property_get(win, a_win_layer, XA_CARDINAL, &size); if (props) { - int i, num; + int num; num = size / sizeof(int); if (num > 0) b->client.layer = props[0]; @@ -306,6 +370,23 @@ e_icccm_set_desk(Window win, int d) e_window_property_set(win, a_win_workspace, XA_CARDINAL, 32, props, 1); } +void +e_icccm_handle_property_change(Atom a, E_Border *b) +{ + static Atom a_wm_normal_hints = 0; + + E_ATOM(a_wm_normal_hints, "WM_NORMAL_HINTS"); + + if (a == a_wm_normal_hints) e_icccm_get_size_info(b->win.client, b); +} + +void +e_icccm_handle_client_message(Ev_Message *e) +{ + return; + UN(e); +} + void e_icccm_advertise_e_compat(void) { @@ -335,14 +416,14 @@ e_icccm_advertise_gnome_compat(void) Window win; E_ATOM(a_win_protocols, "_WIN_PROTOCOLS"); - E_ATOM(a_win_protocols, "_WIN_LAYER"); + E_ATOM(a_win_layer, "_WIN_LAYER"); props[0] = a_win_protocols; e_window_property_set(0, a_win_protocols, XA_ATOM, 32, props, 1); E_ATOM(a_win_wm_name, "_WIN_WM_NAME"); - e_window_property_set(win, a_win_wm_name, XA_STRING, 8, "Enlightenment", strlen("Enlightenment")); + e_window_property_set(0, a_win_wm_name, XA_STRING, 8, "Enlightenment", strlen("Enlightenment")); E_ATOM(a_win_wm_version, "_WIN_WM_VERSION"); - e_window_property_set(win, a_win_wm_version, XA_STRING, 8, "0.17.0", strlen("0.17.0")); + e_window_property_set(0, a_win_wm_version, XA_STRING, 8, "0.17.0", strlen("0.17.0")); E_ATOM(a_win_supporting_wm_check, "_WIN_SUPPORTING_WM_CHECK"); win = e_window_override_new(0, 0, 0, 7, 7); diff --git a/src/icccm.h b/src/icccm.h deleted file mode 100644 index bdd6fb752..000000000 --- a/src/icccm.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __ICCCM_H_ -#define __ICCCM_H_ - -/* Motif window hints */ -#define MWM_HINTS_FUNCTIONS (1L << 0) -#define MWM_HINTS_DECORATIONS (1L << 1) -#define MWM_HINTS_INPUT_MODE (1L << 2) -#define MWM_HINTS_STATUS (1L << 3) - -/* bit definitions for MwmHints.functions */ -#define MWM_FUNC_ALL (1L << 0) -#define MWM_FUNC_RESIZE (1L << 1) -#define MWM_FUNC_MOVE (1L << 2) -#define MWM_FUNC_MINIMIZE (1L << 3) -#define MWM_FUNC_MAXIMIZE (1L << 4) -#define MWM_FUNC_CLOSE (1L << 5) - -/* bit definitions for MwmHints.decorations */ -#define MWM_DECOR_ALL (1L << 0) -#define MWM_DECOR_BORDER (1L << 1) -#define MWM_DECOR_RESIZEH (1L << 2) -#define MWM_DECOR_TITLE (1L << 3) -#define MWM_DECOR_MENU (1L << 4) -#define MWM_DECOR_MINIMIZE (1L << 5) -#define MWM_DECOR_MAXIMIZE (1L << 6) - -/* bit definitions for MwmHints.inputMode */ -#define MWM_INPUT_MODELESS 0 -#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 -#define MWM_INPUT_SYSTEM_MODAL 2 -#define MWM_INPUT_FULL_APPLICATION_MODAL 3 - -#define PROP_MWM_HINTS_ELEMENTS 5 - -/* Motif window hints */ -typedef struct _mwmhints -{ - int flags; - int functions; - int decorations; - int inputMode; - int status; -} -MWMHints; - -#endif diff --git a/src/main.c b/src/main.c index da5c62b30..ce36ad0c0 100644 --- a/src/main.c +++ b/src/main.c @@ -7,7 +7,6 @@ Evas_List __e_profiles = NULL; static void cb_exit(void); static void cb_exit(void) { - printf("cb_exit\n"); E_PROF_DUMP; } @@ -21,6 +20,8 @@ static void ch_col(int val, void *data) desk = e_desktops_get(e_desktops_get_current()); e_desktops_scroll(desk, (int)(8 * sin(v)), (int)(8 * cos(v))); e_add_event_timer("time", 0.02, ch_col, val + 1, NULL); + return; + UN(data); } void setup(void); @@ -37,6 +38,8 @@ setup(void) int main(int argc, char **argv) { + e_exec_set_args(argc, argv); + atexit(cb_exit); e_display_init(NULL); e_ev_signal_init(); @@ -52,4 +55,6 @@ main(int argc, char **argv) e_event_loop(); return 0; + UN(argc); + UN(argv); } diff --git a/src/resist.c b/src/resist.c index c4d4016fe..b197ac920 100644 --- a/src/resist.c +++ b/src/resist.c @@ -6,7 +6,7 @@ e_resist_border(E_Border *b) int resist = 1; int desk_resist = 32; int win_resist = 12; - int ok; + int ok = 0; int dx, dy, d; int resist_x = 0, resist_y = 0; char *settings_db = "./settings.db"; @@ -112,16 +112,18 @@ rects = evas_list_append(rects, r); \ } if (dx != 0) { - if (((b->previous.requested.dx < 0) && (b->current.requested.dx > 0)) || - ((b->previous.requested.dx > 0) && (b->current.requested.dx < 0))) + if ((b->previous.requested.x != b->previous.x) && + (((b->previous.requested.dx < 0) && (b->current.requested.dx > 0)) || + ((b->previous.requested.dx > 0) && (b->current.requested.dx < 0)))) b->current.requested.x = b->current.x; else b->current.x = b->current.requested.x + resist_x; } if (dy != 0) { - if (((b->previous.requested.dy < 0) && (b->current.requested.dy > 0)) || - ((b->previous.requested.dy > 0) && (b->current.requested.dy < 0))) + if ((b->previous.requested.y != b->previous.y) && + (((b->previous.requested.dy < 0) && (b->current.requested.dy > 0)) || + ((b->previous.requested.dy > 0) && (b->current.requested.dy < 0)))) b->current.requested.y = b->current.y; else b->current.y = b->current.requested.y + resist_y; diff --git a/src/util.c b/src/util.c index 74aa7689a..d0939c444 100644 --- a/src/util.c +++ b/src/util.c @@ -8,3 +8,12 @@ e_file_modified_time(char *file) if (stat(file, &st) < 0) return 0; return st.st_mtime; } + +void +e_set_env(char *variable, char *content) +{ + char env[4096]; + + sprintf(env, "%s=%s", variable, content); + putenv(env); +}