mirror of
				https://git.yoctoproject.org/libmatchboxwm2
				synced 2025-11-04 13:15:36 +08:00 
			
		
		
		
	2005-11-08 Matthew Allum <mallum@openedhand.com>
* Makefile:
        * Makefile.am:
        * autogen.sh:
        * configure.ac:
        * matchbox-window-manager-2.c:
        * mb-wm-atoms.c:
        * mb-wm-atoms.h:
        * mb-wm-client.c:
        * mb-wm-client.h:
        * mb-wm-core.c:
        * mb-wm-core.h:
        * mb-wm-keys.c:
        * mb-wm-keys.h:
        * mb-wm-layout.c:
        * mb-wm-layout.h:
        * mb-wm-props.c:
        * mb-wm-props.h:
        * mb-wm-stack.c:
        * mb-wm-stack.h:
        * mb-wm-types.h:
        * mb-wm-util.c:
        * mb-wm-util.h:
        * mb-wm.h:
        * src/Makefile.am:
        * src/core/Makefile.am:
        * src/core/mb-wm-client.c: (mb_wm_client_window_new),
        (mb_wm_client_new), (mb_wm_client_base_init):
        * src/core/mb-wm-client.h:
        * src/core/mb-wm-core.c: (test_map_request), (mb_wm_run):
        * src/core/mb-wm-types.h:
        * src/core/mb-wm-window.c:
        * src/core/mb-wm-window.h:
        * src/core/mb-wm.h:
        * src/matchbox-window-manager-2.c:
        (test_panel_client_request_geometry), (test_client_new):
        * xas.c:
        * xas.h:
        Autofooify. Split Window 'wrapper' code into its own file
        and rejig a little.
			
			
This commit is contained in:
		
							
								
								
									
										42
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,3 +1,45 @@
 | 
			
		||||
2005-11-08  Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 | 
			
		||||
	* Makefile:
 | 
			
		||||
	* Makefile.am:
 | 
			
		||||
	* autogen.sh:
 | 
			
		||||
	* configure.ac:
 | 
			
		||||
	* matchbox-window-manager-2.c:
 | 
			
		||||
	* mb-wm-atoms.c:
 | 
			
		||||
	* mb-wm-atoms.h:
 | 
			
		||||
	* mb-wm-client.c:
 | 
			
		||||
	* mb-wm-client.h:
 | 
			
		||||
	* mb-wm-core.c:
 | 
			
		||||
	* mb-wm-core.h:
 | 
			
		||||
	* mb-wm-keys.c:
 | 
			
		||||
	* mb-wm-keys.h:
 | 
			
		||||
	* mb-wm-layout.c:
 | 
			
		||||
	* mb-wm-layout.h:
 | 
			
		||||
	* mb-wm-props.c:
 | 
			
		||||
	* mb-wm-props.h:
 | 
			
		||||
	* mb-wm-stack.c:
 | 
			
		||||
	* mb-wm-stack.h:
 | 
			
		||||
	* mb-wm-types.h:
 | 
			
		||||
	* mb-wm-util.c:
 | 
			
		||||
	* mb-wm-util.h:
 | 
			
		||||
	* mb-wm.h:
 | 
			
		||||
	* src/Makefile.am:
 | 
			
		||||
	* src/core/Makefile.am:
 | 
			
		||||
	* src/core/mb-wm-client.c: (mb_wm_client_window_new),
 | 
			
		||||
	(mb_wm_client_new), (mb_wm_client_base_init):
 | 
			
		||||
	* src/core/mb-wm-client.h:
 | 
			
		||||
	* src/core/mb-wm-core.c: (test_map_request), (mb_wm_run):
 | 
			
		||||
	* src/core/mb-wm-types.h:
 | 
			
		||||
	* src/core/mb-wm-window.c:
 | 
			
		||||
	* src/core/mb-wm-window.h:
 | 
			
		||||
	* src/core/mb-wm.h:
 | 
			
		||||
	* src/matchbox-window-manager-2.c:
 | 
			
		||||
	(test_panel_client_request_geometry), (test_client_new):
 | 
			
		||||
	* xas.c:
 | 
			
		||||
	* xas.h:
 | 
			
		||||
	Autofooify. Split Window 'wrapper' code into its own file
 | 
			
		||||
        and rejig a little.
 | 
			
		||||
 | 
			
		||||
2005-11-06  Matthew Allum  <mallum@openedhand.com>
 | 
			
		||||
 | 
			
		||||
	* Makefile:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,28 +0,0 @@
 | 
			
		||||
LIBS=`pkg-config --libs x11`
 | 
			
		||||
INCS=`pkg-config --cflags x11`
 | 
			
		||||
 | 
			
		||||
#LIBS=`pkg-config --libs xcb`
 | 
			
		||||
#INCS=`pkg-config --cflags xcb`
 | 
			
		||||
 | 
			
		||||
OBJS=mb-wm-core.o mb-wm-stack.o mb-wm-client.o mb-wm-util.o mb-wm-atoms.o \
 | 
			
		||||
     mb-wm-props.c mb-wm-layout.c mb-wm-keys.c xas.c \
 | 
			
		||||
     matchbox-window-manager-2.c
 | 
			
		||||
 | 
			
		||||
HEADERS=mb-wm.h mb-wm-client.h  mb-wm-stack.h mb-wm-util.h mb-wm-types.h \
 | 
			
		||||
	mb-wm-atoms.h mb-wm-types.h mb-wm-core.h xas.h mb-wm-layout.h \
 | 
			
		||||
        mb-wm-keys.h
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	$(CC) -g -Wall $(CFLAGS) $(INCS) -c $*.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
matchbox-window-manager-2: $(OBJS)
 | 
			
		||||
	$(CC) -g -Wall $(CFLAGS) -o $@ $(OBJS) $(LIBS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$(OBJS): $(HEADERS)
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -fr *.o matchbox-window-manager
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Makefile.am
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
SUBDIRS = src
 | 
			
		||||
 | 
			
		||||
# Extra clean files so that maintainer-clean removes *everything*
 | 
			
		||||
 | 
			
		||||
snapshot:
 | 
			
		||||
        $(MAKE) dist distdir=$(PACKAGE)-snapshot-`date +"%Y%m%d"`
 | 
			
		||||
 | 
			
		||||
MAINTAINERCLEANFILES = aclocal.m4 compile config.guess config.sub configure depcomp install-sh ltmain.sh Makefile.in missing
 | 
			
		||||
							
								
								
									
										3
									
								
								autogen.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								autogen.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
autoreconf -v --install || exit 1
 | 
			
		||||
./configure --enable-maintainer-mode "$@"
 | 
			
		||||
							
								
								
									
										33
									
								
								configure.ac
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								configure.ac
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
AC_PREREQ(2.59)
 | 
			
		||||
AC_INIT([matchbox-window-manager-2], 0.0.0, [mallum@handhelds.org])
 | 
			
		||||
AC_CONFIG_SRCDIR([src/core/mb-wm-core.c])
 | 
			
		||||
 | 
			
		||||
AM_INIT_AUTOMAKE()
 | 
			
		||||
AM_MAINTAINER_MODE
 | 
			
		||||
AM_CONFIG_HEADER(config.h)
 | 
			
		||||
 | 
			
		||||
AC_PROG_CC
 | 
			
		||||
AM_PROG_LIBTOOL
 | 
			
		||||
 | 
			
		||||
AC_HEADER_STDC
 | 
			
		||||
AC_CHECK_HEADERS([stdlib.h string.h])
 | 
			
		||||
AC_C_CONST
 | 
			
		||||
AC_CHECK_FUNCS([memset strdup strncasecmp])
 | 
			
		||||
 | 
			
		||||
PKG_CHECK_MODULES(MBWM, x11,,
 | 
			
		||||
	         AC_MSG_ERROR([*** You need to install modern xlibs ***]))
 | 
			
		||||
 | 
			
		||||
MBWM_INCS='-I$(top_srcdir)/src/core -I$(top_srcdir)/src/'
 | 
			
		||||
MBWM_CORE_LIB='$(top_builddir)/src/core/libmatchbox-window-manager-2-core.a'
 | 
			
		||||
 | 
			
		||||
AC_SUBST([MBWM_CFLAGS])
 | 
			
		||||
AC_SUBST([MBWM_LIBS])
 | 
			
		||||
AC_SUBST([MBWM_CORE_LIB])
 | 
			
		||||
AC_SUBST([MBWM_INCS])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AC_OUTPUT([
 | 
			
		||||
Makefile
 | 
			
		||||
src/Makefile  
 | 
			
		||||
src/core/Makefile
 | 
			
		||||
])
 | 
			
		||||
							
								
								
									
										20
									
								
								src/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/Makefile.am
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
SUBDIRS = core
 | 
			
		||||
 | 
			
		||||
INCLUDES = 					\
 | 
			
		||||
	@MBWM_INCS@				\
 | 
			
		||||
	@MBWM_CFLAGS@
 | 
			
		||||
 | 
			
		||||
bin_PROGRAMS = matchbox-window-manager-2
 | 
			
		||||
 | 
			
		||||
matchbox_window_manager_2_SOURCES =             \
 | 
			
		||||
	matchbox-window-manager-2.c
 | 
			
		||||
 | 
			
		||||
matchbox_window_manager_2_LDADD =               \
 | 
			
		||||
	@MBWM_LIBS@				\
 | 
			
		||||
        @MBWM_CORE_LIB@	
 | 
			
		||||
 | 
			
		||||
matchbox_window_manager_2_DEPENDENCIES =	\
 | 
			
		||||
        @MBWM_CORE_LIB@	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MAINTAINERCLEANFILES = config.h.in Makefile.in
 | 
			
		||||
							
								
								
									
										33
									
								
								src/core/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/core/Makefile.am
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
noinst_LIBRARIES = libmatchbox-window-manager-2-core.a
 | 
			
		||||
 | 
			
		||||
core_h  = mb-wm.h             \
 | 
			
		||||
          mb-wm-client.h      \
 | 
			
		||||
	  mb-wm-window.h      \
 | 
			
		||||
          mb-wm-stack.h       \
 | 
			
		||||
          mb-wm-util.h        \
 | 
			
		||||
          mb-wm-types.h       \
 | 
			
		||||
	  mb-wm-atoms.h       \
 | 
			
		||||
          mb-wm-core.h        \
 | 
			
		||||
          mb-wm-layout.h      \
 | 
			
		||||
          mb-wm-props.h       \
 | 
			
		||||
          mb-wm-keys.h        \
 | 
			
		||||
          xas.h
 | 
			
		||||
 | 
			
		||||
core_c  = mb-wm-client.c      \
 | 
			
		||||
	  mb-wm-window.c      \
 | 
			
		||||
          mb-wm-stack.c       \
 | 
			
		||||
          mb-wm-props.c       \
 | 
			
		||||
          mb-wm-util.c        \
 | 
			
		||||
	  mb-wm-atoms.c       \
 | 
			
		||||
          mb-wm-core.c        \
 | 
			
		||||
          mb-wm-layout.c      \
 | 
			
		||||
          mb-wm-keys.c        \
 | 
			
		||||
          xas.c
 | 
			
		||||
 | 
			
		||||
libmatchbox_window_manager_2_core_a_SOURCES = $(core_h) $(core_c)
 | 
			
		||||
 | 
			
		||||
libmatchbox_window_manager_2_core_a_INCLUDES = @MBWM_INCS@ @MBWM_CFLAGS@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MAINTAINERCLEANFILES = config.h.in Makefile.in
 | 
			
		||||
@@ -21,7 +21,7 @@ struct MBWindowManagerClientPriv
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_client_base_init (MBWindowManager             *wm, 
 | 
			
		||||
			MBWindowManagerClient       *client,
 | 
			
		||||
			MBWindowManagerClientWindow *win);
 | 
			
		||||
			MBWMWindow                  *win);
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_client_base_realize (MBWindowManagerClient *client);
 | 
			
		||||
 | 
			
		||||
@@ -72,10 +72,11 @@ mb_wm_client_visibility_mark_dirty (MBWindowManagerClient *client)
 | 
			
		||||
 | 
			
		||||
/* Window new */
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClientWindow*
 | 
			
		||||
#if 0
 | 
			
		||||
MBWMWindow*
 | 
			
		||||
mb_wm_client_window_new (MBWindowManager *wm, Window xwin)
 | 
			
		||||
{
 | 
			
		||||
  MBWindowManagerClientWindow *win = NULL;
 | 
			
		||||
  MBWMWindow *win = NULL;
 | 
			
		||||
 | 
			
		||||
  enum {
 | 
			
		||||
    COOKIE_WIN_TYPE = 0,
 | 
			
		||||
@@ -176,10 +177,12 @@ mb_wm_client_window_new (MBWindowManager *wm, Window xwin)
 | 
			
		||||
  return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* base methods */
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClient* 	/* FIXME: rename to mb_wm_client_base/class_new ? */
 | 
			
		||||
mb_wm_client_new (MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
mb_wm_client_new (MBWindowManager *wm, MBWMWindow *win)
 | 
			
		||||
{
 | 
			
		||||
  MBWindowManagerClient *client = NULL;
 | 
			
		||||
 | 
			
		||||
@@ -195,7 +198,7 @@ mb_wm_client_new (MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
void
 | 
			
		||||
mb_wm_client_base_init (MBWindowManager             *wm, 
 | 
			
		||||
			MBWindowManagerClient       *client,
 | 
			
		||||
			MBWindowManagerClientWindow *win)
 | 
			
		||||
			MBWMWindow *win)
 | 
			
		||||
{
 | 
			
		||||
  client->wmref  = wm;   
 | 
			
		||||
  client->window = win; 
 | 
			
		||||
@@ -222,7 +225,7 @@ mb_wm_client_base_init (MBWindowManager             *wm,
 | 
			
		||||
void
 | 
			
		||||
mb_wm_client_init (MBWindowManager             *wm, 
 | 
			
		||||
		   MBWindowManagerClient       *client,
 | 
			
		||||
		   MBWindowManagerClientWindow *win)
 | 
			
		||||
		   MBWMWindow                  *win)
 | 
			
		||||
{
 | 
			
		||||
  if (client->init)
 | 
			
		||||
    client->init(wm, client, win);
 | 
			
		||||
@@ -84,11 +84,11 @@ MBWMClientReqGeomType;
 | 
			
		||||
/* Methods */
 | 
			
		||||
 | 
			
		||||
typedef  void (*MBWMClientNewMethod) (MBWindowManager       *wm, 
 | 
			
		||||
				      MBWindowManagerClientWindow *win);
 | 
			
		||||
				      MBWMWindow            *win);
 | 
			
		||||
 | 
			
		||||
typedef  void (*MBWMClientInitMethod) (MBWindowManager       *wm, 
 | 
			
		||||
				       MBWindowManagerClient *client,
 | 
			
		||||
				       MBWindowManagerClientWindow *win);
 | 
			
		||||
				       MBWMWindow            *win);
 | 
			
		||||
 | 
			
		||||
typedef  void (*MBWMClientRealizeMethod) (MBWindowManagerClient *client);
 | 
			
		||||
 | 
			
		||||
@@ -108,16 +108,6 @@ typedef  void (*MBWMClientHideMethod) (MBWindowManagerClient *client);
 | 
			
		||||
typedef  void (*MBWMClientSyncMethod) (MBWindowManagerClient *client);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct MBWindowManagerClientWindow
 | 
			
		||||
{
 | 
			
		||||
  MBGeometry   geometry;
 | 
			
		||||
  unsigned int depth;
 | 
			
		||||
  char        *name;
 | 
			
		||||
  Window       xwindow;
 | 
			
		||||
 | 
			
		||||
  Atom         net_type;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct MBWindowManagerClient
 | 
			
		||||
{
 | 
			
		||||
  int                          type;
 | 
			
		||||
@@ -125,7 +115,7 @@ struct MBWindowManagerClient
 | 
			
		||||
 | 
			
		||||
  MBWindowManager             *wmref;
 | 
			
		||||
  char                        *name;
 | 
			
		||||
  MBWindowManagerClientWindow *window;
 | 
			
		||||
  MBWMWindow                  *window;
 | 
			
		||||
  Window                       xwin_frame;
 | 
			
		||||
  unsigned long                stacking_hints;
 | 
			
		||||
 | 
			
		||||
@@ -182,16 +172,16 @@ struct MBWindowManagerClient
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClientWindow*
 | 
			
		||||
MBWMWindow*
 | 
			
		||||
mb_wm_client_window_new (MBWindowManager *wm, Window window);
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClient*
 | 
			
		||||
mb_wm_client_new (MBWindowManager *wm, MBWindowManagerClientWindow *win);
 | 
			
		||||
mb_wm_client_new (MBWindowManager *wm, MBWMWindow *win);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_client_init (MBWindowManager             *wm, 
 | 
			
		||||
		   MBWindowManagerClient       *client,
 | 
			
		||||
                   MBWindowManagerClientWindow *win);
 | 
			
		||||
                   MBWMWindow *win);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_client_realize (MBWindowManagerClient *client);
 | 
			
		||||
@@ -85,7 +85,7 @@ test_map_request (MBWindowManager   *wm,
 | 
			
		||||
 | 
			
		||||
  if (!client)
 | 
			
		||||
    {
 | 
			
		||||
      MBWindowManagerClientWindow *win = NULL; 
 | 
			
		||||
      MBWMWindow *win = NULL; 
 | 
			
		||||
 | 
			
		||||
      if (wm->new_client_from_window_func == NULL)
 | 
			
		||||
	{
 | 
			
		||||
@@ -223,10 +223,11 @@ mb_wm_run(MBWindowManager *wm)
 | 
			
		||||
      XEvent xev;
 | 
			
		||||
      XNextEvent(wm->xdpy, &xev);
 | 
			
		||||
 | 
			
		||||
      MBWM_DBG("@ XEvent: '%s:%i' for %lx", 
 | 
			
		||||
      MBWM_DBG("@ XEvent: '%s:%i' for %lx %s", 
 | 
			
		||||
	       MBWMDEBUGEvents[xev.type], 
 | 
			
		||||
	       xev.type, 
 | 
			
		||||
	       xev.xany.window
 | 
			
		||||
	       xev.xany.window,
 | 
			
		||||
	       xev.xany.window == wm->xwin_root ? "(root)"  : ""
 | 
			
		||||
	       );
 | 
			
		||||
 | 
			
		||||
      switch (xev.type)
 | 
			
		||||
@@ -262,26 +263,19 @@ mb_wm_run(MBWindowManager *wm)
 | 
			
		||||
	    xev_funcs->configure_request(wm, 
 | 
			
		||||
					 (XConfigureRequestEvent*)&xev.xconfigurerequest, 
 | 
			
		||||
					 xev_funcs->user_data);
 | 
			
		||||
 | 
			
		||||
	  break;
 | 
			
		||||
	case KeyPress:
 | 
			
		||||
	  if (xev_funcs->key_press)
 | 
			
		||||
	    xev_funcs->key_press(wm, 
 | 
			
		||||
				 (XKeyEvent*)&xev.xkey, 
 | 
			
		||||
				 xev_funcs->user_data);
 | 
			
		||||
 | 
			
		||||
	  break;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	  break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      if (wm->need_display_sync)
 | 
			
		||||
	mb_wm_core_sync (wm);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -54,7 +54,7 @@ typedef struct MBWindowManagerPriv   MBWindowManagerPriv;
 | 
			
		||||
typedef struct MBWindowManagerClient MBWindowManagerClient;
 | 
			
		||||
 | 
			
		||||
typedef struct MBWindowManagerClientPriv   MBWindowManagerClientPriv;
 | 
			
		||||
typedef struct MBWindowManagerClientWindow MBWindowManagerClientWindow;
 | 
			
		||||
typedef struct MBWMWindow MBWMWindow;
 | 
			
		||||
 | 
			
		||||
typedef unsigned long MBWMCookie;
 | 
			
		||||
typedef int           MBWindowManagerClientType;
 | 
			
		||||
@@ -184,7 +184,7 @@ struct MBWMKeyBinding
 | 
			
		||||
 | 
			
		||||
typedef  MBWindowManagerClient* (*MBWindowManagerNewClientFunc)
 | 
			
		||||
     (MBWindowManager             *wm,
 | 
			
		||||
      MBWindowManagerClientWindow *w);
 | 
			
		||||
      MBWMWindow                  *w);
 | 
			
		||||
 | 
			
		||||
typedef  void (*MBWindowManagerDestroyClientFunc)
 | 
			
		||||
     (MBWindowManager             *wm,
 | 
			
		||||
							
								
								
									
										161
									
								
								src/core/mb-wm-window.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								src/core/mb-wm-window.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,161 @@
 | 
			
		||||
#include "mb-wm.h"
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
  COOKIE_WIN_TYPE = 0,
 | 
			
		||||
  COOKIE_WIN_ATTR,
 | 
			
		||||
  COOKIE_WIN_GEOM,
 | 
			
		||||
  COOKIE_WIN_NAME,
 | 
			
		||||
  COOKIE_WIN_NAME_UTF8,
 | 
			
		||||
  COOKIE_WIN_SIZE_HINTS,
 | 
			
		||||
  COOKIE_WIN_WMHINTS,
 | 
			
		||||
  
 | 
			
		||||
  N_COOKIES
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
MBWMWindow*
 | 
			
		||||
mb_wm_client_window_new (MBWindowManager *wm, Window xwin)
 | 
			
		||||
{
 | 
			
		||||
  MBWMWindow *win = NULL;
 | 
			
		||||
 | 
			
		||||
  win = mb_wm_util_malloc0(sizeof(MBWMWindow));
 | 
			
		||||
 | 
			
		||||
  if (!win)
 | 
			
		||||
    return NULL; 		/* FIXME: Handle out of memory */
 | 
			
		||||
 | 
			
		||||
  win->xwindow = xwin;
 | 
			
		||||
 | 
			
		||||
  mb_wm_window_sync_properties (wm, win, MBWM_WINDOW_PROP_ALL);
 | 
			
		||||
 | 
			
		||||
  return win;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
mb_wm_window_sync_properties (MBWindowManager *wm,
 | 
			
		||||
			      MBWMWindow      *win,
 | 
			
		||||
			      unsigned long    props_req)
 | 
			
		||||
{
 | 
			
		||||
  MBWMCookie       cookies[N_COOKIES];
 | 
			
		||||
  Atom             actual_type_return, *result_atom = NULL;
 | 
			
		||||
  int              actual_format_return;
 | 
			
		||||
  unsigned long    nitems_return;
 | 
			
		||||
  unsigned long    bytes_after_return;
 | 
			
		||||
  unsigned int     foo;
 | 
			
		||||
  int              x_error_code;
 | 
			
		||||
  Window           xwin;
 | 
			
		||||
 | 
			
		||||
  MBWMWindowAttributes *xwin_attr = NULL;
 | 
			
		||||
 | 
			
		||||
  xwin = win->xwindow;
 | 
			
		||||
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_WIN_TYPE)
 | 
			
		||||
    cookies[COOKIE_WIN_TYPE] 
 | 
			
		||||
      = mb_wm_property_atom_req(wm, xwin, 
 | 
			
		||||
				wm->atoms[MBWM_ATOM_NET_WM_WINDOW_TYPE]);
 | 
			
		||||
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_ATTR)
 | 
			
		||||
    cookies[COOKIE_WIN_ATTR]
 | 
			
		||||
      = mb_wm_xwin_get_attributes (wm, xwin);
 | 
			
		||||
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_GEOMETRY)
 | 
			
		||||
    cookies[COOKIE_WIN_GEOM]
 | 
			
		||||
      = mb_wm_xwin_get_geometry (wm, (Drawable)xwin);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_NAME)
 | 
			
		||||
    {
 | 
			
		||||
      cookies[COOKIE_WIN_NAME] 
 | 
			
		||||
	= mb_wm_property_req (wm,      
 | 
			
		||||
			      xwin, 
 | 
			
		||||
			      prop,
 | 
			
		||||
			      (wm)->atoms[MBWM_ATOM_WM_NAME],
 | 
			
		||||
			      1024L,
 | 
			
		||||
			      False,
 | 
			
		||||
			      XA_WM_NAME);
 | 
			
		||||
 | 
			
		||||
      cookies[COOKIE_WIN_NAME_UTF8] 
 | 
			
		||||
	mb_wm_property_utf8_req(wm, xwin, 
 | 
			
		||||
				wm->atoms[MBWM_ATOM_NET_WM_NAME]);
 | 
			
		||||
    }
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_WMHINTS)
 | 
			
		||||
    {
 | 
			
		||||
      cookies[COOKIE_WIN_WMHINTS] 
 | 
			
		||||
	= mb_wm_property_req (wm,      
 | 
			
		||||
			      xwin, 
 | 
			
		||||
			      prop,
 | 
			
		||||
			      (wm)->atoms[MBWM_ATOM_WM_HINTS],
 | 
			
		||||
			      1024L,
 | 
			
		||||
			      False,
 | 
			
		||||
			      XA_WM_HINTS);
 | 
			
		||||
    }
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
  XSync(wm->xdpy, False);
 | 
			
		||||
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_WIN_TYPE)
 | 
			
		||||
    {
 | 
			
		||||
      mb_wm_property_reply (wm,
 | 
			
		||||
			    cookies[COOKIE_WIN_TYPE],
 | 
			
		||||
			    &actual_type_return, 
 | 
			
		||||
			    &actual_format_return, 
 | 
			
		||||
			    &nitems_return, 
 | 
			
		||||
			    &bytes_after_return, 
 | 
			
		||||
			    (unsigned char **)&result_atom,
 | 
			
		||||
			    &x_error_code);
 | 
			
		||||
      
 | 
			
		||||
      if (x_error_code
 | 
			
		||||
	  || actual_type_return != XA_ATOM
 | 
			
		||||
	  || actual_format_return != 32
 | 
			
		||||
	  || nitems_return != 1
 | 
			
		||||
	  || result_atom == NULL)
 | 
			
		||||
	{
 | 
			
		||||
	  MBWM_DBG("### Warning net type prop failed ###");
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
	win->net_type = result_atom[0];
 | 
			
		||||
 | 
			
		||||
      if (result_atom) 
 | 
			
		||||
	XFree(result_atom);
 | 
			
		||||
  
 | 
			
		||||
      result_atom = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (props_req & MBWM_WINDOW_PROP_ATTR)
 | 
			
		||||
    {
 | 
			
		||||
      xwin_attr = mb_wm_xwin_get_attributes_reply (wm,
 | 
			
		||||
					       cookies[COOKIE_WIN_ATTR],
 | 
			
		||||
					       &x_error_code);
 | 
			
		||||
 | 
			
		||||
      if (!xwin_attr || x_error_code)
 | 
			
		||||
	{
 | 
			
		||||
	  MBWM_DBG("### Warning Get Attr Failed ( %i ) ###", x_error_code);
 | 
			
		||||
	  goto abort;
 | 
			
		||||
	}
 | 
			
		||||
      
 | 
			
		||||
      if (!mb_wm_xwin_get_geometry_reply (wm,
 | 
			
		||||
					  cookies[COOKIE_WIN_GEOM],
 | 
			
		||||
					  &win->geometry,
 | 
			
		||||
					  &foo,
 | 
			
		||||
					  &win->depth,
 | 
			
		||||
					  &x_error_code))
 | 
			
		||||
	{
 | 
			
		||||
	  MBWM_DBG("### Warning Get Geometry Failed ( %i ) ###", x_error_code);
 | 
			
		||||
	  MBWM_DBG("###   Cookie ID was %li                ###", cookies[COOKIE_WIN_GEOM]);
 | 
			
		||||
	  goto abort;
 | 
			
		||||
	}
 | 
			
		||||
      
 | 
			
		||||
      MBWM_DBG("@@@ New Window Obj @@@");
 | 
			
		||||
      MBWM_DBG("Win:  %lx", win->xwindow);
 | 
			
		||||
      MBWM_DBG("Type: %lx",win->net_type);
 | 
			
		||||
      MBWM_DBG("Geom: +%i+%i,%ix%i", win->geometry.x, win->geometry.y,
 | 
			
		||||
	       win->geometry.width, win->geometry.height);
 | 
			
		||||
      
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 abort:
 | 
			
		||||
  
 | 
			
		||||
  if (xwin_attr) 
 | 
			
		||||
    XFree(xwin_attr);
 | 
			
		||||
 | 
			
		||||
  return True;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										60
									
								
								src/core/mb-wm-window.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								src/core/mb-wm-window.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
/* 
 | 
			
		||||
 *  Matchbox Window Manager II - A lightweight window manager not for the
 | 
			
		||||
 *                               desktop.
 | 
			
		||||
 *
 | 
			
		||||
 *  Authored By Matthew Allum <mallum@o-hand.com>
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2005 OpenedHand Ltd - http://o-hand.com
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
 *  the Free Software Foundation; either version 2, or (at your option)
 | 
			
		||||
 *  any later version.
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is distributed in the hope that it will be useful,
 | 
			
		||||
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 *  GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _HAVE_MB_WM_WINDOW_H
 | 
			
		||||
#define _HAVE_MB_WM_WINDOW_H
 | 
			
		||||
 | 
			
		||||
#define MBWM_WINDOW_PROP_WIN_TYPE   (1<<1)
 | 
			
		||||
#define MBWM_WINDOW_PROP_GEOMETRY   (1<<2)
 | 
			
		||||
#define MBWM_WINDOW_PROP_ATTR       (1<<3)
 | 
			
		||||
#define MBWM_WINDOW_PROP_NAME       (1<<4)
 | 
			
		||||
#define MBWM_WINDOW_PROP_SIZE_HINTS (1<<5)
 | 
			
		||||
#define MBWM_WINDOW_PROP_ICON       (1<<6)
 | 
			
		||||
#define MBWM_WINDOW_PROP_URGENCY    (1<<7)
 | 
			
		||||
#define MBWM_WINDOW_PROP_GROUP      (1<<8)
 | 
			
		||||
#define MBWM_WINDOW_PROP_PID        (1<<9)
 | 
			
		||||
#define MBWM_WINDOW_PROP_PROTOS     (1<<10)
 | 
			
		||||
#define MBWM_WINDOW_PROP_TRANSIENCY (1<<11)
 | 
			
		||||
#define MBWM_WINDOW_PROP_STATE      (1<<12)
 | 
			
		||||
#define MBWM_WINDOW_PROP_NET_STATE  (1<<13)
 | 
			
		||||
#define MBWM_WINDOW_PROP_STARTUP_ID (1<<14)
 | 
			
		||||
 | 
			
		||||
#define MBWM_WINDOW_PROP_ALL        (0xffffffff)
 | 
			
		||||
 | 
			
		||||
struct MBWMWindow
 | 
			
		||||
{
 | 
			
		||||
  MBGeometry   geometry;
 | 
			
		||||
  unsigned int depth;
 | 
			
		||||
  char        *name;
 | 
			
		||||
  Window       xwindow;
 | 
			
		||||
 | 
			
		||||
  Atom         net_type;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MBWMWindow*
 | 
			
		||||
mb_wm_client_window_new (MBWindowManager *wm, Window xwin);
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
mb_wm_window_sync_properties (MBWindowManager *wm,
 | 
			
		||||
			      MBWMWindow      *win,
 | 
			
		||||
			      unsigned long    props_req);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@@ -66,6 +66,7 @@
 | 
			
		||||
#include "mb-wm-util.h"
 | 
			
		||||
#include "mb-wm-core.h"
 | 
			
		||||
#include "mb-wm-keys.h"
 | 
			
		||||
#include "mb-wm-window.h"
 | 
			
		||||
#include "mb-wm-client.h"
 | 
			
		||||
#include "mb-wm-layout.h"
 | 
			
		||||
#include "mb-wm-stack.h"
 | 
			
		||||
@@ -49,7 +49,7 @@ test_panel_client_request_geometry (MBWindowManagerClient *client,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClient*
 | 
			
		||||
test_panel_client_new(MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
test_panel_client_new(MBWindowManager *wm, MBWMWindow *win)
 | 
			
		||||
{
 | 
			
		||||
  TestPanelClient *pc = NULL;
 | 
			
		||||
 | 
			
		||||
@@ -71,7 +71,7 @@ test_panel_client_new(MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClient*
 | 
			
		||||
test_client_new(MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
test_client_new(MBWindowManager *wm, MBWMWindow *win)
 | 
			
		||||
{
 | 
			
		||||
  TestClient *tc = NULL;
 | 
			
		||||
 | 
			
		||||
@@ -88,7 +88,7 @@ test_client_new(MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MBWindowManagerClient*
 | 
			
		||||
client_new(MBWindowManager *wm, MBWindowManagerClientWindow *win)
 | 
			
		||||
client_new(MBWindowManager *wm, MBWMWindow *win)
 | 
			
		||||
{
 | 
			
		||||
  if (win->net_type == wm->atoms[MBWM_ATOM_NET_WM_WINDOW_TYPE_DOCK])
 | 
			
		||||
    return test_panel_client_new(wm, win);
 | 
			
		||||
		Reference in New Issue
	
	Block a user