mirror of
				https://git.yoctoproject.org/libmatchboxwm2
				synced 2025-11-04 13:15:36 +08:00 
			
		
		
		
	2007-09-18 Tomas Frydrych <tf@o-hand.com>
* TODO:
	Removed items already done.
        * src/core/mb-window-manager.c:
        * src/core/mb-window-manager.h:
        * src/core/mb-wm-layout.c:
        * src/core/mb-wm-layout.h:
        * src/core/mb-wm-types.h:
        * src/managers/matchbox-window-manager-2-simple.c:
	Objectified layout.
			
			
This commit is contained in:
		
							
								
								
									
										13
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,3 +1,16 @@
 | 
			
		||||
2007-09-18  Tomas Frydrych  <tf@o-hand.com>
 | 
			
		||||
 | 
			
		||||
        * TODO:
 | 
			
		||||
	Removed items already done.
 | 
			
		||||
	
 | 
			
		||||
        * src/core/mb-window-manager.c:
 | 
			
		||||
        * src/core/mb-window-manager.h:
 | 
			
		||||
        * src/core/mb-wm-layout.c:
 | 
			
		||||
        * src/core/mb-wm-layout.h:
 | 
			
		||||
        * src/core/mb-wm-types.h:
 | 
			
		||||
        * src/managers/matchbox-window-manager-2-simple.c:
 | 
			
		||||
	Objectified layout.
 | 
			
		||||
	
 | 
			
		||||
2007-09-18  Tomas Frydrych  <tf@o-hand.com>
 | 
			
		||||
 | 
			
		||||
        * src/core/mb-wm-client.c:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								TODO
									
									
									
									
									
								
							@@ -6,9 +6,6 @@ In no particular order
 | 
			
		||||
   + add tracking of these props changing with some kind of signals
 | 
			
		||||
     (so clients types can use them)
 | 
			
		||||
 | 
			
		||||
 - Support root window EWMH props and abstract in API accordingly.
 | 
			
		||||
   + Also track changes.
 | 
			
		||||
 | 
			
		||||
 - Simple signal mechanism for MBObject ?
 | 
			
		||||
 | 
			
		||||
 - Add an extras/ dir adding optional support for;
 | 
			
		||||
@@ -28,9 +25,6 @@ In no particular order
 | 
			
		||||
   + this will then allow support for _NET_WM_PING proto.
 | 
			
		||||
   + event calls should be modular enough to hook into glib main loop.
 | 
			
		||||
 | 
			
		||||
 - Port mb-wm-layout, mb-wm to be MBObjects. Allow creation of MBWM
 | 
			
		||||
   with alternate layout engine for example. (Stacking too?)
 | 
			
		||||
 | 
			
		||||
 - Improve client types, add an input window type. 
 | 
			
		||||
 | 
			
		||||
 - Image based theme engine - takes a single 'template' image and conf file
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,7 @@ mb_wm_destroy (MBWMObject *this)
 | 
			
		||||
 | 
			
		||||
  mb_wm_object_unref (MB_WM_OBJECT (wm->root_win));
 | 
			
		||||
  mb_wm_object_unref (MB_WM_OBJECT (wm->theme));
 | 
			
		||||
  mb_wm_object_unref (MB_WM_OBJECT (wm->layout));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -347,7 +348,8 @@ mb_wm_sync (MBWindowManager *wm)
 | 
			
		||||
  /* Size stuff first assume newly managed windows unmapped ?
 | 
			
		||||
   *
 | 
			
		||||
  */
 | 
			
		||||
  mb_wm_layout_manager_update (wm);
 | 
			
		||||
  if (wm->layout)
 | 
			
		||||
    mb_wm_layout_update (wm->layout);
 | 
			
		||||
 | 
			
		||||
  /* Create the actual window */
 | 
			
		||||
  mb_wm_stack_enumerate(wm, client)
 | 
			
		||||
@@ -1033,3 +1035,12 @@ mb_wm_handle_show_desktop (MBWindowManager * wm, Bool show)
 | 
			
		||||
  if (wm_klass->show_desktop)
 | 
			
		||||
      wm_klass->show_desktop (wm, show);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_set_layout (MBWindowManager *wm, MBWMLayout *layout, Bool sync)
 | 
			
		||||
{
 | 
			
		||||
  wm->layout = layout;
 | 
			
		||||
 | 
			
		||||
  if (sync)
 | 
			
		||||
    mb_wm_sync (wm);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,7 @@ struct MBWindowManager
 | 
			
		||||
  const char                  *sm_client_id;
 | 
			
		||||
 | 
			
		||||
  MBWMTheme                   *theme;
 | 
			
		||||
  MBWMLayout                  *layout;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct MBWindowManagerClass
 | 
			
		||||
@@ -101,6 +102,9 @@ struct MBWindowManagerClass
 | 
			
		||||
MBWindowManager *
 | 
			
		||||
mb_wm_new (int argc, char **argv);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_set_layout (MBWindowManager *wm, MBWMLayout *layout, Bool sync);
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
mb_wm_class_type ();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,83 @@
 | 
			
		||||
#define SET_HEIGHT (1<<4)
 | 
			
		||||
#define SET_ALL    (SET_X|SET_Y|SET_WIDTH|SET_HEIGHT)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_layout_real_update (MBWMLayout * layout);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_layout_class_init (MBWMObjectClass *klass)
 | 
			
		||||
{
 | 
			
		||||
  MBWMLayoutClass * layout_class = MB_WM_LAYOUT_CLASS (klass);
 | 
			
		||||
 | 
			
		||||
  layout_class->update = mb_wm_layout_real_update;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_layout_destroy (MBWMObject *this)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_layout_init (MBWMObject *this, va_list vap)
 | 
			
		||||
{
 | 
			
		||||
  MBWMLayout *layout = MB_WM_LAYOUT (this);
 | 
			
		||||
  MBWMObjectProp    prop;
 | 
			
		||||
  MBWindowManager  *wm = NULL;
 | 
			
		||||
 | 
			
		||||
  prop = va_arg(vap, MBWMObjectProp);
 | 
			
		||||
  while (prop)
 | 
			
		||||
    {
 | 
			
		||||
      switch (prop)
 | 
			
		||||
	{
 | 
			
		||||
	case MBWMObjectPropWm:
 | 
			
		||||
	  wm = va_arg(vap, MBWindowManager *);
 | 
			
		||||
	  break;
 | 
			
		||||
	default:
 | 
			
		||||
	  MBWMO_PROP_EAT (vap, prop);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      prop = va_arg(vap, MBWMObjectProp);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  MBWM_ASSERT (wm);
 | 
			
		||||
 | 
			
		||||
  layout->wm = wm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
mb_wm_layout_class_type ()
 | 
			
		||||
{
 | 
			
		||||
  static int type = 0;
 | 
			
		||||
 | 
			
		||||
  if (UNLIKELY(type == 0))
 | 
			
		||||
    {
 | 
			
		||||
      static MBWMObjectClassInfo info = {
 | 
			
		||||
	sizeof (MBWMLayoutClass),
 | 
			
		||||
	sizeof (MBWMLayout),
 | 
			
		||||
	mb_wm_layout_init,
 | 
			
		||||
	mb_wm_layout_destroy,
 | 
			
		||||
	mb_wm_layout_class_init
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      type = mb_wm_object_register_class (&info, MB_WM_TYPE_OBJECT, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MBWMLayout*
 | 
			
		||||
mb_wm_layout_new (MBWindowManager *wm)
 | 
			
		||||
{
 | 
			
		||||
  MBWMLayout *layout;
 | 
			
		||||
 | 
			
		||||
  layout = MB_WM_LAYOUT (mb_wm_object_new (MB_WM_TYPE_LAYOUT,
 | 
			
		||||
					   MBWMObjectPropWm, wm,
 | 
			
		||||
					   NULL));
 | 
			
		||||
  return layout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool
 | 
			
		||||
clip_geometry (MBGeometry *geom,
 | 
			
		||||
mb_wm_layout_clip_geometry (MBGeometry *geom,
 | 
			
		||||
			    MBGeometry *min,
 | 
			
		||||
			    int         flags)
 | 
			
		||||
{
 | 
			
		||||
@@ -45,7 +120,7 @@ clip_geometry (MBGeometry *geom,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool
 | 
			
		||||
maximise_geometry (MBGeometry *geom,
 | 
			
		||||
mb_wm_layout_maximise_geometry (MBGeometry *geom,
 | 
			
		||||
				MBGeometry *max,
 | 
			
		||||
				int         flags)
 | 
			
		||||
{
 | 
			
		||||
@@ -78,8 +153,8 @@ maximise_geometry (MBGeometry *geom,
 | 
			
		||||
  return changed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int /* FIXME: work for multiple edges */
 | 
			
		||||
mb_wm_layout_manager_get_edge_offset (MBWindowManager *wm,
 | 
			
		||||
static int /* FIXME: work for multiple edges */
 | 
			
		||||
mb_wm_layout_get_edge_offset (MBWindowManager *wm,
 | 
			
		||||
			      int              edge)
 | 
			
		||||
{
 | 
			
		||||
  MBGeometry             coverage;
 | 
			
		||||
@@ -113,9 +188,10 @@ mb_wm_layout_manager_get_edge_offset (MBWindowManager *wm,
 | 
			
		||||
  return offset;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_layout_manager_update (MBWindowManager *wm) 
 | 
			
		||||
static void
 | 
			
		||||
mb_wm_layout_real_update (MBWMLayout * layout)
 | 
			
		||||
{
 | 
			
		||||
  MBWindowManager       *wm = layout->wm;
 | 
			
		||||
  int                    min_x, max_x, min_y, max_y;
 | 
			
		||||
  MBGeometry             coverage, avail_geom;
 | 
			
		||||
  MBWindowManagerClient *client = NULL;
 | 
			
		||||
@@ -165,11 +241,12 @@ mb_wm_layout_manager_update (MBWindowManager *wm)
 | 
			
		||||
	mb_wm_client_get_coverage (client, &coverage);
 | 
			
		||||
 | 
			
		||||
	/* set x,y to avail and max width */
 | 
			
		||||
	need_change = maximise_geometry (&coverage,
 | 
			
		||||
	need_change = mb_wm_layout_maximise_geometry (&coverage,
 | 
			
		||||
						      &avail_geom,
 | 
			
		||||
						      SET_X|SET_Y|SET_WIDTH);
 | 
			
		||||
	/* Too high */
 | 
			
		||||
	need_change |= clip_geometry (&coverage, &avail_geom, SET_HEIGHT);
 | 
			
		||||
	need_change |= mb_wm_layout_clip_geometry (&coverage,
 | 
			
		||||
						   &avail_geom, SET_HEIGHT);
 | 
			
		||||
 | 
			
		||||
	if (need_change)
 | 
			
		||||
	  mb_wm_client_request_geometry (client,
 | 
			
		||||
@@ -188,11 +265,12 @@ mb_wm_layout_manager_update (MBWindowManager *wm)
 | 
			
		||||
	mb_wm_client_get_coverage (client, &coverage);
 | 
			
		||||
 | 
			
		||||
	/* set x,y to avail and max width */
 | 
			
		||||
	need_change = maximise_geometry (&coverage,
 | 
			
		||||
	need_change = mb_wm_layout_maximise_geometry (&coverage,
 | 
			
		||||
						      &avail_geom,
 | 
			
		||||
						      SET_X|SET_WIDTH);
 | 
			
		||||
	/* Too high */
 | 
			
		||||
	need_change |= clip_geometry (&coverage, &avail_geom, SET_HEIGHT);
 | 
			
		||||
	need_change |= mb_wm_layout_clip_geometry (&coverage,
 | 
			
		||||
						   &avail_geom, SET_HEIGHT);
 | 
			
		||||
 | 
			
		||||
	if (coverage.y != avail_geom.y + avail_geom.height - coverage.height)
 | 
			
		||||
	  {
 | 
			
		||||
@@ -215,11 +293,12 @@ mb_wm_layout_manager_update (MBWindowManager *wm)
 | 
			
		||||
	mb_wm_client_get_coverage (client, &coverage);
 | 
			
		||||
 | 
			
		||||
	/* set x,y to avail and max width */
 | 
			
		||||
	need_change = maximise_geometry (&coverage,
 | 
			
		||||
	need_change = mb_wm_layout_maximise_geometry (&coverage,
 | 
			
		||||
						      &avail_geom,
 | 
			
		||||
						      SET_X|SET_Y|SET_HEIGHT);
 | 
			
		||||
	/* Too wide */
 | 
			
		||||
	need_change |= clip_geometry (&coverage, &avail_geom, SET_WIDTH);
 | 
			
		||||
	need_change |= mb_wm_layout_clip_geometry (&coverage,
 | 
			
		||||
						   &avail_geom, SET_WIDTH);
 | 
			
		||||
 | 
			
		||||
	if (need_change)
 | 
			
		||||
	  mb_wm_client_request_geometry (client,
 | 
			
		||||
@@ -237,11 +316,12 @@ mb_wm_layout_manager_update (MBWindowManager *wm)
 | 
			
		||||
	mb_wm_client_get_coverage (client, &coverage);
 | 
			
		||||
 | 
			
		||||
	/* set x,y to avail and max width */
 | 
			
		||||
	need_change = maximise_geometry (&coverage,
 | 
			
		||||
	need_change = mb_wm_layout_maximise_geometry (&coverage,
 | 
			
		||||
						      &avail_geom,
 | 
			
		||||
						      SET_Y|SET_HEIGHT);
 | 
			
		||||
	/* Too wide */
 | 
			
		||||
	need_change |= clip_geometry (&coverage, &avail_geom, SET_WIDTH);
 | 
			
		||||
	need_change |= mb_wm_layout_clip_geometry (&coverage,
 | 
			
		||||
						   &avail_geom, SET_WIDTH);
 | 
			
		||||
 | 
			
		||||
	if (need_change)
 | 
			
		||||
	  mb_wm_client_request_geometry (client,
 | 
			
		||||
@@ -287,3 +367,14 @@ mb_wm_layout_manager_update (MBWindowManager *wm)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_layout_update (MBWMLayout * layout)
 | 
			
		||||
{
 | 
			
		||||
  MBWMLayoutClass *klass;
 | 
			
		||||
 | 
			
		||||
  klass = MB_WM_LAYOUT_CLASS (MB_WM_OBJECT_GET_CLASS (layout));
 | 
			
		||||
 | 
			
		||||
  MBWM_ASSERT (klass->update);
 | 
			
		||||
 | 
			
		||||
  klass->update (layout);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,33 @@
 | 
			
		||||
#ifndef _HAVE_MB_WM_LAYOUT_MANAGER_H
 | 
			
		||||
#define _HAVE_MB_WM_LAYOUT_MANAGER_H
 | 
			
		||||
 | 
			
		||||
#include "mb-wm.h"
 | 
			
		||||
 | 
			
		||||
#define MB_WM_LAYOUT(c) ((MBWMLayout*)(c))
 | 
			
		||||
#define MB_WM_LAYOUT_CLASS(c) ((MBWMLayoutClass*)(c))
 | 
			
		||||
#define MB_WM_TYPE_LAYOUT (mb_wm_layout_class_type ())
 | 
			
		||||
 | 
			
		||||
struct MBWMLayout
 | 
			
		||||
{
 | 
			
		||||
  MBWMObject    parent;
 | 
			
		||||
 | 
			
		||||
  MBWindowManager *wm;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct MBWMLayoutClass
 | 
			
		||||
{
 | 
			
		||||
  MBWMObjectClass parent;
 | 
			
		||||
 | 
			
		||||
  void (*update) (MBWMLayout *layout);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
mb_wm_layout_class_type ();
 | 
			
		||||
 | 
			
		||||
MBWMLayout*
 | 
			
		||||
mb_wm_layout_new (MBWindowManager *wm);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
mb_wm_layout_manager_update (MBWindowManager *wm); 
 | 
			
		||||
mb_wm_layout_update (MBWMLayout *layout);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -92,6 +92,9 @@ typedef struct MBWMDecor                   MBWMDecor;
 | 
			
		||||
typedef struct MBWMDecorClass              MBWMDecorClass;
 | 
			
		||||
typedef struct MBWMDecorButton             MBWMDecorButton;
 | 
			
		||||
typedef struct MBWMDecorButtonClass        MBWMDecorButtonClass;
 | 
			
		||||
typedef struct MBWMLayout                  MBWMLayout;
 | 
			
		||||
typedef struct MBWMLayoutClass             MBWMLayoutClass;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef unsigned long MBWMCookie;
 | 
			
		||||
typedef int           MBWindowManagerClientType;
 | 
			
		||||
 
 | 
			
		||||
@@ -82,6 +82,8 @@ key_binding_func (MBWindowManager   *wm,
 | 
			
		||||
int
 | 
			
		||||
main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
  MBWMLayout * layout;
 | 
			
		||||
 | 
			
		||||
#ifdef MBWM_WANT_DEBUG
 | 
			
		||||
  struct sigaction sa;
 | 
			
		||||
  sigfillset(&sa.sa_mask);
 | 
			
		||||
@@ -96,6 +98,13 @@ main(int argc, char **argv)
 | 
			
		||||
  if (wm == NULL)
 | 
			
		||||
    mb_wm_util_fatal_error("OOM?");
 | 
			
		||||
 | 
			
		||||
  layout = mb_wm_layout_new (wm);
 | 
			
		||||
 | 
			
		||||
  if (layout == NULL)
 | 
			
		||||
    mb_wm_util_fatal_error("OOM?");
 | 
			
		||||
 | 
			
		||||
  mb_wm_set_layout (wm, layout, False);
 | 
			
		||||
 | 
			
		||||
  mb_wm_keys_binding_add_with_spec (wm,
 | 
			
		||||
				    "<alt>d",
 | 
			
		||||
				    key_binding_func,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user