Merge branch 'm4/master'
authorMikael Magnusson <mikachu@gmail.com>
Tue, 2 Aug 2011 20:18:14 +0000 (22:18 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Tue, 2 Aug 2011 20:18:14 +0000 (22:18 +0200)
1  2 
Makefile.am
obrender/render.h
openbox/prompt.c

diff --combined Makefile.am
@@@ -47,7 -47,8 +47,7 @@@ nodist_rc_SCRIPTS = 
        data/autostart/autostart
  
  dist_libexec_SCRIPTS = \
 -      data/autostart/openbox-xdg-autostart \
 -      data/autostart/openbox-autostart
 +      data/autostart/openbox-xdg-autostart
  
  nodist_libexec_SCRIPTS = \
        data/autostart/openbox-autostart
@@@ -86,6 -87,8 +86,8 @@@ obrender_libobrender_la_LIBADD = 
        $(XML_LIBS)
  obrender_libobrender_la_SOURCES = \
        gettext.h \
+       obrender/button.h \
+       obrender/button.c \
        obrender/color.h \
        obrender/color.c \
        obrender/font.h \
@@@ -151,6 -154,8 +153,6 @@@ obt_libobt_la_SOURCES = 
        obt/signal.h \
        obt/signal.c \
        obt/util.h \
 -      obt/watch.h \
 -      obt/watch.c \
        obt/xqueue.h \
        obt/xqueue.c
  
@@@ -170,8 -175,6 +172,8 @@@ openbox_openbox_CPPFLAGS = 
        -DCONFIGDIR=\"$(configdir)\" \
        -DG_LOG_DOMAIN=\"Openbox\"
  openbox_openbox_LDADD = \
 +      $(XINERAMA_LIBS) \
 +      $(XRANDR_LIBS) \
        $(SM_LIBS) \
        $(GLIB_LIBS) \
        $(X_LIBS) \
@@@ -323,11 -326,9 +325,11 @@@ tools_obxprop_obxprop_SOURCES = 
  ## gdm-control ##
  
  tools_gdm_control_gdm_control_CPPFLAGS = \
 +      $(XAUTH_CFLAGS) \
        $(X_CFLAGS) \
        $(GLIB_CFLAGS)
  tools_gdm_control_gdm_control_LDADD = \
 +      $(XAUTH_LIBS) \
        $(X_LIBS) \
        $(GLIB_LIBS)
  tools_gdm_control_gdm_control_SOURCES = \
@@@ -450,6 -451,7 +452,6 @@@ obtpubinclude_HEADERS = 
        obt/signal.h \
        obt/util.h \
        obt/version.h \
 -      obt/watch.h \
        obt/xqueue.h
  
  nodist_pkgconfig_DATA = \
@@@ -471,21 -473,20 +473,21 @@@ dist_rc_DATA = 
  edit = $(SED) \
        -e 's!@version\@!$(VERSION)!' \
        -e 's!@configdir\@!$(configdir)!' \
 +      -e 's!@rcdir\@!$(rcdir)!' \
        -e 's!@libexecdir\@!$(libexecdir)!' \
        -e 's!@bindir\@!$(bindir)!'
  
 -data/autostart/autostart: $(srcdir)/data/autostart/autostart.in Makefile
 +data/autostart/autostart: $(top_srcdir)/data/autostart/autostart.in Makefile
        @echo make: creating $@
 -      @test -d $(shell dirname $(builddir)/$@) || \
 -        mkdir $(shell dirname $(builddir)/$@)
 -      @$(edit) $< >$(builddir)/$@
 +      @test -d $(shell dirname $(top_builddir)/$@) || \
 +        mkdir $(shell dirname $(top_builddir)/$@)
 +      @$(edit) $< >$(top_builddir)/$@
  
 -data/autostart/openbox-autostart: $(srcdir)/data/autostart/openbox-autostart.in Makefile
 +data/autostart/openbox-autostart: $(top_srcdir)/data/autostart/openbox-autostart.in Makefile
        @echo make: creating $@
 -      @test -d $(shell dirname $(builddir)/$@) || \
 -        mkdir $(shell dirname $(builddir)/$@)
 -      @$(edit) $< >$(builddir)/$@
 +      @test -d $(shell dirname $(top_builddir)/$@) || \
 +        mkdir $(shell dirname $(top_builddir)/$@)
 +      @$(edit) $< >$(top_builddir)/$@
  
  %.desktop: %.desktop.in Makefile
        @echo make: creating $@
diff --combined obrender/render.h
@@@ -44,11 -44,11 +44,12 @@@ typedef struct _RrPixmapMask       RrPi
  typedef struct _RrInstance         RrInstance;
  typedef struct _RrColor            RrColor;
  typedef struct _RrImage            RrImage;
 +typedef struct _RrImageSet         RrImageSet;
  typedef struct _RrImagePic         RrImagePic;
  typedef struct _RrImageCache       RrImageCache;
+ typedef struct _RrButton           RrButton;
  
 -typedef guint32 RrPixel32;
 +typedef guint32 RrPixel32;  /* RGBA format */
  typedef guint16 RrPixel16;
  typedef guchar  RrPixel8;
  
@@@ -221,7 -221,7 +222,7 @@@ struct _RrTexture 
  
  struct _RrAppearance {
      const RrInstance *inst;
+     
      RrSurface surface;
      gint textures;
      RrTexture *texture;
@@@ -239,43 -239,24 +240,43 @@@ struct _RrImagePic 
      /* The sum of all the pixels.  This is used to compare pictures if their
         hashes match. */
      gint sum;
 -    /* The name of the image.  This is used to determine
 -       if the named image already is loaded.  May be NULL if the image
 -       was not loaded from disk. */
 -    gchar *name;
  };
  
  typedef void (*RrImageDestroyFunc)(RrImage *image, gpointer data);
  
 -/*! An RrImage is a sort of meta-image.  It can contain multiple versions of
 -  an image at different sizes, which may or may not be completely different
 -  pictures */
 +/*! An RrImage refers to a RrImageSet.  If multiple RrImageSets end up
 +  holding the same image data, they will be marged and the RrImages that
 +  point to them would be updated. */
  struct _RrImage {
      gint ref;
 +    RrImageSet *set;
 +
 +    /* This function (if not NULL) will be called just before destroying
 +      RrImage. */
 +    RrImageDestroyFunc destroy_func;
 +    gpointer           destroy_data;
 +};
 +
 +/*! An RrImage is a sort of meta-image.  It can contain multiple versions
 +  of an image at different sizes, which may or may not be completely different
 +  pictures */
 +struct _RrImageSet
 +{
      RrImageCache *cache;
  
 +    /*! If a picture is loaded by a name, then it has a name attached to it.
 +      This contains a list of strings, containing all names that have ever
 +      been associated with the RrImageSet. A name in the RrImageCache can
 +      only be associated with a single RrImageSet. */
 +    GSList *names;
 +
 +    /*! RrImages that point at this RrImageSet. If this is empty, then there
 +      are no images using the set and it can be freed. */
 +    GSList *images;
 +
      /*! An array of "originals", that is of RrPictures that have been added
        to the image in various sizes, and that have not been resized.  These
 -      are explicitly added to the RrImage. */
 +      are explicitly added to the RrImageSet. */
      RrImagePic **original;
      gint n_original;
      /*! An array of "resized" pictures.  When an "original" RrPicture
        RrImage. */
      RrImagePic **resized;
      gint n_resized;
 -
 -    /* This function (if not NULL) will be called just before destroying
 -      RrImage. */
 -    RrImageDestroyFunc destroy_func;
 -    gpointer           destroy_data;
  };
  
+ struct _RrButton {
+     const RrInstance *inst;
+     /* colors */
+     RrColor *focused_unpressed_color;
+     RrColor *unfocused_unpressed_color;
+     RrColor *focused_pressed_color;
+     RrColor *unfocused_pressed_color;
+     RrColor *disabled_focused_color;
+     RrColor *disabled_unfocused_color;
+     RrColor *hover_focused_color;
+     RrColor *hover_unfocused_color;
+     RrColor *toggled_hover_focused_color;
+     RrColor *toggled_hover_unfocused_color;
+     RrColor *toggled_focused_pressed_color;
+     RrColor *toggled_unfocused_pressed_color;
+     RrColor *toggled_focused_unpressed_color;
+     RrColor *toggled_unfocused_unpressed_color;
+     
+     /* masks */
+     RrPixmapMask *mask;
+     RrPixmapMask *pressed_mask;
+     RrPixmapMask *disabled_mask;
+     RrPixmapMask *hover_mask;
+     RrPixmapMask *toggled_mask;
+     RrPixmapMask *toggled_hover_mask;
+     RrPixmapMask *toggled_pressed_mask;
+    
+     /* textures */
+     RrAppearance *a_focused_unpressed;
+     RrAppearance *a_unfocused_unpressed;
+     RrAppearance *a_focused_pressed;
+     RrAppearance *a_unfocused_pressed;
+     RrAppearance *a_disabled_focused;
+     RrAppearance *a_disabled_unfocused;
+     RrAppearance *a_hover_focused;
+     RrAppearance *a_hover_unfocused;
+     RrAppearance *a_toggled_focused_unpressed;
+     RrAppearance *a_toggled_unfocused_unpressed;
+     RrAppearance *a_toggled_focused_pressed;
+     RrAppearance *a_toggled_unfocused_pressed;
+     RrAppearance *a_toggled_hover_focused;
+     RrAppearance *a_toggled_hover_unfocused;
+ };
  /* these are the same on all endian machines because it seems to be dependant
     on the endianness of the gfx card, not the cpu. */
  #define RrDefaultAlphaOffset 24
@@@ -318,6 -350,7 +365,7 @@@ gint     RrGreenMask    (const RrInstan
  gint     RrBlueMask     (const RrInstance *inst);
  
  RrColor *RrColorNew   (const RrInstance *inst, gint r, gint g, gint b);
+ RrColor *RrColorCopy  (RrColor *c);
  RrColor *RrColorParse (const RrInstance *inst, gchar *colorname);
  void     RrColorFree  (RrColor *in);
  
@@@ -335,6 -368,9 +383,9 @@@ void          RrAppearanceAddTextures(R
  /*! Always call this when changing the type of a texture in an appearance */
  void          RrAppearanceClearTextures(RrAppearance *a);
  
+ RrButton *RrButtonNew (const RrInstance *inst);
+ void      RrButtonFree(RrButton *b);
  RrFont *RrFontOpen          (const RrInstance *inst, const gchar *name,
                               gint size, RrFontWeight weight, RrFontSlant slant);
  RrFont *RrFontOpenDefault   (const RrInstance *inst);
@@@ -370,41 -406,23 +421,41 @@@ RrImageCache* RrImageCacheNew(gint max_
  void          RrImageCacheRef(RrImageCache *self);
  void          RrImageCacheUnref(RrImageCache *self);
  
 -/*! Finds an image in the cache, if it is already in there */
 -RrImage*      RrImageCacheFind(RrImageCache *self,
 -                               RrPixel32 *data, gint w, gint h);
 -/*! Finds an image in the cache, by searching for the name of the image */
 -RrImage*      RrImageCacheFindName(RrImageCache *self,
 -                                   const gchar *name);
 -
 -RrImage* RrImageNew(RrImageCache *cache);
 -void     RrImageRef(RrImage *im);
 -void     RrImageUnref(RrImage *im);
 -
 -void     RrImageAddPicture(RrImage *im, const RrPixel32 *data, gint w, gint h);
 -/*! Adds a picture by name, from a file on disk. 
 -  @name Can be a full path to an image, or it can be a name as per the
 -        freedesktop.org icon spec. */
 -gboolean RrImageAddPictureName(RrImage *im, const gchar *name);
 -void     RrImageRemovePicture(RrImage *im, gint w, gint h);
 +/*! Create a new image, or return one from the cache that matches.
 +  @param cache The image cache.
 +  @param old The current RrImage, which the new image should be added to.
 +    Use this if loading a different sized version of the same image.
 +    The returned RrImage should replace the one passed in as old.
 +    Pass NULL here if adding an image which is (or may be) entirely new.
 +  @param name The name of the icon to be loaded off disk, or used in the cache
 +  @return Returns NULL if unable to load an image by the name and it is not in
 +    the cache already
 +*/
 +RrImage* RrImageNewFromName(RrImageCache *cache, const gchar *name);
 +
 +/*! Create a new image, or return one from the cache that matches.
 +  @param cache The image cache.
 +  @param data The image data in RGBA32 format.  There should be @w * @h many
 +    values in the data array.
 +  @param w The width of the image data.
 +  @param h The height of the image data.
 +  @return Returns NULL if unable to load an image by the name and it is not in
 +    the cache already
 +*/
 +RrImage* RrImageNewFromData(RrImageCache *cache, RrPixel32 *data,
 +                            gint w, gint h);
 +
 +/*! Add a new size of a picture to an image.
 +  If a picture has multiple versions of different sizes (example 16x16, 32x32
 +  and so on), they should all be under the same RrImage.  This adds a new
 +  size to an existing RrImage, associating the newly sized picture with the
 +  others in the RrImage - classifying them as being the same logical image at a
 +  different dimention.
 +*/
 +void RrImageAddFromData(RrImage *image, RrPixel32 *data, gint w, gint h);
 +
 +void RrImageRef(RrImage *im);
 +void RrImageUnref(RrImage *im);
  
  G_END_DECLS
  
diff --combined openbox/prompt.c
@@@ -59,10 -59,10 +59,10 @@@ void prompt_startup(gboolean reconfig
      /* note: this is not a copy, don't free it */
      prompt_a_bg = ob_rr_theme->osd_bg;
  
-     prompt_a_button = RrAppearanceCopy(ob_rr_theme->a_focused_unpressed_close);
-     prompt_a_focus = RrAppearanceCopy(ob_rr_theme->a_hover_focused_close);
-     prompt_a_press = RrAppearanceCopy(ob_rr_theme->a_focused_pressed_close);
-     prompt_a_pfocus = RrAppearanceCopy(ob_rr_theme->a_focused_pressed_close);
+     prompt_a_button = RrAppearanceCopy(ob_rr_theme->btn_close->a_focused_unpressed);
+     prompt_a_focus = RrAppearanceCopy(ob_rr_theme->btn_close->a_hover_focused);
+     prompt_a_press = RrAppearanceCopy(ob_rr_theme->btn_close->a_focused_pressed);
+     prompt_a_pfocus = RrAppearanceCopy(ob_rr_theme->btn_close->a_focused_pressed);
  
      c_button = prompt_a_button->texture[0].data.mask.color;
      c_focus = prompt_a_focus->texture[0].data.mask.color;
@@@ -175,7 -175,7 +175,7 @@@ ObPrompt* prompt_new(const gchar *msg, 
  
      /* set the window's title */
      if (title)
 -        OBT_PROP_SETS(self->super.window, NET_WM_NAME, utf8, title);
 +        OBT_PROP_SETS(self->super.window, NET_WM_NAME, title);
  
      /* listen for key presses on the window */
      self->event_mask = KeyPressMask;