mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Added composite stuff (alpha stage, of course).
A lot of things are pending for implementation like region translucency, shadows, fading... Per window translucency is in, but now working as expected.
This commit is contained in:
17
evoke/ClassHack.c
Normal file
17
evoke/ClassHack.c
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Evoke, head honcho of everything
|
||||||
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
|
* Copyright (c) 2000-2007 EDE Authors.
|
||||||
|
*
|
||||||
|
* This program is licensed under terms of the
|
||||||
|
* GNU General Public License version 2 or newer.
|
||||||
|
* See COPYING for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ClassHack.h"
|
||||||
|
|
||||||
|
int get_attributes_class_hack(XWindowAttributes* attr) {
|
||||||
|
return attr->class;
|
||||||
|
}
|
36
evoke/ClassHack.h
Normal file
36
evoke/ClassHack.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Evoke, head honcho of everything
|
||||||
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
|
* Copyright (c) 2000-2007 EDE Authors.
|
||||||
|
*
|
||||||
|
* This program is licensed under terms of the
|
||||||
|
* GNU General Public License version 2 or newer.
|
||||||
|
* See COPYING for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CLASSHACK_H__
|
||||||
|
#define __CLASSHACK_H__
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A stupid hack to extract value from 'class' member in XWindowAttributes structure.
|
||||||
|
* Calling it in regular C++ translation unit will yield compilation error (sic)
|
||||||
|
* so we must force it to be seen as regular C source.
|
||||||
|
*
|
||||||
|
* Does X developers ever heard for C++ language ?@#?#!@
|
||||||
|
*/
|
||||||
|
|
||||||
|
int get_attributes_class_hack(XWindowAttributes* attr);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
1289
evoke/Composite.cpp
Normal file
1289
evoke/Composite.cpp
Normal file
File diff suppressed because it is too large
Load Diff
60
evoke/Composite.h
Normal file
60
evoke/Composite.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Evoke, head honcho of everything
|
||||||
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
|
* Based on xcompmgr (c) 2003 Keith Packard.
|
||||||
|
* Copyright (c) 2000-2007 EDE Authors.
|
||||||
|
*
|
||||||
|
* This program is licensed under terms of the
|
||||||
|
* GNU General Public License version 2 or newer.
|
||||||
|
* See COPYING for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __COMPOSITE_H__
|
||||||
|
#define __COMPOSITE_H__
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/extensions/Xdamage.h> // XserverRegion already included in Xdamage.h
|
||||||
|
#include <edelib/List.h>
|
||||||
|
|
||||||
|
struct CWindow;
|
||||||
|
typedef edelib::list<CWindow*> CWindowList;
|
||||||
|
typedef edelib::list<CWindow*>::iterator CWindowListIter;
|
||||||
|
|
||||||
|
class Composite {
|
||||||
|
private:
|
||||||
|
bool manual_redirect;
|
||||||
|
|
||||||
|
CWindowList window_list;
|
||||||
|
void add_window(Window id, Window previous);
|
||||||
|
void map_window(Window id, unsigned long sequence, bool fade);
|
||||||
|
void unmap_window(Window id, bool fade);
|
||||||
|
void finish_unmap_window(CWindow* win);
|
||||||
|
CWindow* find_window(Window id);
|
||||||
|
XserverRegion window_extents(CWindow* win);
|
||||||
|
|
||||||
|
void configure_window(const XConfigureEvent* ce);
|
||||||
|
void restack_window(CWindow* win, Window new_above);
|
||||||
|
void property_notify(const XPropertyEvent* pe);
|
||||||
|
void expose_event(const XExposeEvent* ee);
|
||||||
|
void reparent_notify(const XReparentEvent* re);
|
||||||
|
void circulate_window(const XCirculateEvent* ce);
|
||||||
|
|
||||||
|
void damage_window(XDamageNotifyEvent* de);
|
||||||
|
void repair_window(CWindow* win);
|
||||||
|
void destroy_window(Window id, bool gone, bool fade);
|
||||||
|
void finish_destroy_window(Window id, bool gone);
|
||||||
|
|
||||||
|
void paint_root(void);
|
||||||
|
|
||||||
|
public:
|
||||||
|
Composite();
|
||||||
|
~Composite();
|
||||||
|
bool init(void);
|
||||||
|
void handle_xevents(const XEvent* xev);
|
||||||
|
|
||||||
|
void paint_all(XserverRegion region);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -199,7 +199,7 @@ void wake_up_cb(int fd, void* v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EvokeService::EvokeService() :
|
EvokeService::EvokeService() :
|
||||||
is_running(0), logfile(NULL), xsm(NULL), pidfile(NULL), lockfile(NULL) {
|
is_running(0), logfile(NULL), xsm(NULL), composite(NULL), pidfile(NULL), lockfile(NULL) {
|
||||||
|
|
||||||
wake_up_pipe[0] = wake_up_pipe[1] = -1;
|
wake_up_pipe[0] = wake_up_pipe[1] = -1;
|
||||||
//quit_child_pid = quit_child_ret = -1;
|
//quit_child_pid = quit_child_ret = -1;
|
||||||
@ -209,6 +209,8 @@ EvokeService::~EvokeService() {
|
|||||||
if(logfile)
|
if(logfile)
|
||||||
delete logfile;
|
delete logfile;
|
||||||
|
|
||||||
|
delete composite;
|
||||||
|
|
||||||
stop_xsettings_manager(true);
|
stop_xsettings_manager(true);
|
||||||
|
|
||||||
if(lockfile) {
|
if(lockfile) {
|
||||||
@ -499,6 +501,15 @@ void EvokeService::stop_xsettings_manager(bool serialize) {
|
|||||||
xsm = NULL;
|
xsm = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EvokeService::init_composite(void) {
|
||||||
|
composite = new Composite();
|
||||||
|
|
||||||
|
if(!composite->init()) {
|
||||||
|
delete composite;
|
||||||
|
composite = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EvokeService::setup_atoms(Display* d) {
|
void EvokeService::setup_atoms(Display* d) {
|
||||||
// with them must be send '1' or property will be ignored (except _EDE_EVOKE_SPAWN)
|
// with them must be send '1' or property will be ignored (except _EDE_EVOKE_SPAWN)
|
||||||
_ede_shutdown_all = XInternAtom(d, "_EDE_EVOKE_SHUTDOWN_ALL", False);
|
_ede_shutdown_all = XInternAtom(d, "_EDE_EVOKE_SHUTDOWN_ALL", False);
|
||||||
@ -731,6 +742,10 @@ int EvokeService::handle(const XEvent* xev) {
|
|||||||
EVOKE_LOG("XSETTINGS manager shutdown\n");
|
EVOKE_LOG("XSETTINGS manager shutdown\n");
|
||||||
stop_xsettings_manager(true);
|
stop_xsettings_manager(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(composite)
|
||||||
|
composite->handle_xevents(xev);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
else if(xev->type == MapNotify) {
|
else if(xev->type == MapNotify) {
|
||||||
puts("=================");
|
puts("=================");
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Xsm.h"
|
#include "Xsm.h"
|
||||||
|
#include "Composite.h"
|
||||||
|
|
||||||
#include <edelib/List.h>
|
#include <edelib/List.h>
|
||||||
#include <edelib/String.h>
|
#include <edelib/String.h>
|
||||||
@ -57,6 +58,7 @@ class EvokeService {
|
|||||||
bool is_running;
|
bool is_running;
|
||||||
Log* logfile;
|
Log* logfile;
|
||||||
Xsm* xsm;
|
Xsm* xsm;
|
||||||
|
Composite* composite;
|
||||||
char* pidfile;
|
char* pidfile;
|
||||||
char* lockfile;
|
char* lockfile;
|
||||||
|
|
||||||
@ -87,6 +89,8 @@ class EvokeService {
|
|||||||
void init_xsettings_manager(void);
|
void init_xsettings_manager(void);
|
||||||
void stop_xsettings_manager(bool serialize);
|
void stop_xsettings_manager(bool serialize);
|
||||||
|
|
||||||
|
void init_composite(void);
|
||||||
|
|
||||||
int handle(const XEvent* ev);
|
int handle(const XEvent* ev);
|
||||||
|
|
||||||
Log* log(void) { return logfile; }
|
Log* log(void) { return logfile; }
|
||||||
|
@ -15,6 +15,8 @@ ObjectC++Flags evoke.cpp : -DUSE_SIGHUP ;
|
|||||||
|
|
||||||
SOURCE = evoke.cpp
|
SOURCE = evoke.cpp
|
||||||
EvokeService.cpp
|
EvokeService.cpp
|
||||||
|
Composite.cpp
|
||||||
|
ClassHack.c
|
||||||
Xsm.cpp
|
Xsm.cpp
|
||||||
Spawn.cpp
|
Spawn.cpp
|
||||||
Splash.cpp
|
Splash.cpp
|
||||||
@ -23,11 +25,12 @@ SOURCE = evoke.cpp
|
|||||||
Crash.cpp
|
Crash.cpp
|
||||||
Autostart.cpp ;
|
Autostart.cpp ;
|
||||||
|
|
||||||
LinkAgainst evoke : -lao -lvorbis -lvorbisfile ;
|
LinkAgainst evoke : -lXcomposite -lXdamage -lXfixes -lXrender -lao -lvorbis -lvorbisfile ;
|
||||||
#LinkAgainst evoke : -lpthread ;
|
#LinkAgainst evoke : -lpthread ;
|
||||||
|
|
||||||
EdeProgram evoke : $(SOURCE) ;
|
EdeProgram evoke : $(SOURCE) ;
|
||||||
FltkProgramBare test/evoke_test : test/evoke_test.cpp ;
|
FltkProgramBare test/evoke_test : test/evoke_test.cpp ;
|
||||||
FltkProgramBare test/stress_test : test/stress_test.cpp ;
|
FltkProgramBare test/stress_test : test/stress_test.cpp ;
|
||||||
|
FltkProgramBare test/opacity_test : test/opacity_test.cpp ;
|
||||||
#TranslationStrings locale : $(SOURCE) ;
|
#TranslationStrings locale : $(SOURCE) ;
|
||||||
EdeManual doc/evoke.txt ;
|
EdeManual doc/evoke.txt ;
|
||||||
|
@ -241,9 +241,10 @@ bool Splash::next_client(void) {
|
|||||||
msgbox->copy_label(buff);
|
msgbox->copy_label(buff);
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
if(!dry_run)
|
if(!dry_run) {
|
||||||
spawn_program(cmd, service_watcher_cb);
|
spawn_program(cmd, service_watcher_cb);
|
||||||
//spawn_program(cmd);
|
//spawn_program(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
++clist_it;
|
++clist_it;
|
||||||
++counter;
|
++counter;
|
||||||
|
@ -175,6 +175,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
service->setup_atoms(fl_display);
|
service->setup_atoms(fl_display);
|
||||||
service->init_xsettings_manager();
|
service->init_xsettings_manager();
|
||||||
|
service->init_composite();
|
||||||
|
|
||||||
signal(SIGINT, quit_signal);
|
signal(SIGINT, quit_signal);
|
||||||
signal(SIGTERM, quit_signal);
|
signal(SIGTERM, quit_signal);
|
||||||
@ -193,7 +194,13 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
service->start();
|
service->start();
|
||||||
|
|
||||||
|
#if 0
|
||||||
XSelectInput(fl_display, RootWindow(fl_display, fl_screen), PropertyChangeMask | SubstructureNotifyMask | ClientMessage);
|
XSelectInput(fl_display, RootWindow(fl_display, fl_screen), PropertyChangeMask | SubstructureNotifyMask | ClientMessage);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// composite engine included too
|
||||||
|
XSelectInput(fl_display, RootWindow(fl_display, fl_screen),
|
||||||
|
SubstructureNotifyMask | ExposureMask | StructureNotifyMask | PropertyChangeMask | ClientMessage);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register event listener and run in infinite loop. Loop will be
|
* Register event listener and run in infinite loop. Loop will be
|
||||||
|
46
evoke/test/opacity_test.cpp
Normal file
46
evoke/test/opacity_test.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#include <FL/Fl.h>
|
||||||
|
#include <FL/Fl_Window.h>
|
||||||
|
#include <FL/Fl_Box.h>
|
||||||
|
#include <FL/Fl_Value_Slider.h>
|
||||||
|
#include <FL/x.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
Fl_Window* win;
|
||||||
|
Fl_Value_Slider* slider;
|
||||||
|
Atom opacity_atom;
|
||||||
|
|
||||||
|
void slider_cb(Fl_Widget*, void*) {
|
||||||
|
printf("callback %i\n", (int)slider->value());
|
||||||
|
//int v = (int)slider->value();
|
||||||
|
//unsigned int v = (unsigned int)0xe0000000;
|
||||||
|
unsigned int v = (unsigned int)4;
|
||||||
|
XChangeProperty(fl_display, fl_xid(win), opacity_atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&v, 1);
|
||||||
|
XFlush(fl_display);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
fl_open_display();
|
||||||
|
|
||||||
|
opacity_atom = XInternAtom(fl_display, "_NET_WM_WINDOW_OPACITY", False);
|
||||||
|
|
||||||
|
win = new Fl_Window(240, 175, "Opacity test");
|
||||||
|
win->begin();
|
||||||
|
Fl_Box* sbox = new Fl_Box(10, 9, 220, 102, "sample text");
|
||||||
|
sbox->box(FL_ENGRAVED_BOX);
|
||||||
|
sbox->color((Fl_Color)186);
|
||||||
|
sbox->labelcolor((Fl_Color)23);
|
||||||
|
|
||||||
|
slider = new Fl_Value_Slider(10, 142, 220, 18, "Opacity percent:");
|
||||||
|
slider->type(1);
|
||||||
|
slider->step(1);
|
||||||
|
slider->maximum(100);
|
||||||
|
slider->minimum(1);
|
||||||
|
slider->value(100);
|
||||||
|
slider->callback(slider_cb);
|
||||||
|
slider->align(FL_ALIGN_TOP_LEFT);
|
||||||
|
win->end();
|
||||||
|
win->show();
|
||||||
|
slider_cb(0,0);
|
||||||
|
return Fl::run();
|
||||||
|
}
|
Reference in New Issue
Block a user