1 #ifndef YXEMBED_H
2 #define YXEMBED_H
3 
4 #include "ywindow.h"
5 #include "yxapp.h"
6 #include <X11/Xatom.h>
7 
8 #define XEMBED_PROTOCOL_VERSION         0
9 
10 #define XEMBED_MAPPED                   (1<<0)
11 
12 #define XEMBED_EMBEDDED_NOTIFY          0
13 #define XEMBED_WINDOW_ACTIVATE          1
14 #define XEMBED_WINDOW_DEACTIVATE        2
15 #define XEMBED_REQUEST_FOCUS            3
16 #define XEMBED_FOCUS_IN                 4
17 #define XEMBED_FOCUS_OUT                5
18 #define XEMBED_FOCUS_NEXT               6
19 #define XEMBED_FOCUS_PREV               7
20 #define XEMBED_MODALITY_ON              10
21 #define XEMBED_MODALITY_OFF             11
22 #define XEMBED_REGISTER_ACCELERATOR     12
23 #define XEMBED_UNREGISTER_ACCELERATOR   13
24 #define XEMBED_ACTIVATE_ACCELERATOR     14
25 
26 class YXEmbedClient;
27 
28 class YXEmbed {
29 public:
30     virtual ~YXEmbed();
31 
32     virtual void damagedClient() = 0;
33     virtual bool destroyedClient(Window win) = 0;
34     virtual void handleClientUnmap(Window win) = 0;
35     virtual void handleClientMap(Window win) = 0;
36     virtual Window getHandle() = 0;
37     virtual unsigned getWidth() = 0;
38     virtual unsigned getHeight() = 0;
39 };
40 
41 class YXEmbedClient: public YWindow {
42 public:
43     YXEmbedClient(YXEmbed *embedder, YWindow *aParent, Window win);
44     virtual ~YXEmbedClient();
45 
46     virtual void handleDamageNotify(const XDamageNotifyEvent &);
47     virtual void handleDestroyWindow(const XDestroyWindowEvent& destroyWindow);
48     virtual void handleReparentNotify(const XReparentEvent& reparent);
49     virtual void handleConfigure(const XConfigureEvent& configure);
50     virtual void handleProperty(const XPropertyEvent& property);
51     virtual void handleUnmap(const XUnmapEvent& unmap);
52 
53     void infoMapped(bool map = true);
54     void sendNotify();
55     void sendActivate();
56     void sendMessage(long type, long detail = 0, long data1 = 0, long data2 = 0);
trace()57     bool trace() const { return fTrace; }
58 
59 private:
60     YXEmbed *fEmbedder;
61     Atom fInfo[2];
62     bool fTrace;
63 };
64 
65 #endif
66 
67 // vim: set sw=4 ts=4 et:
68