This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
  discards  e41bba7056adda0c78b09a4182c9e1a1a71a5c14 (commit)
  discards  eccb762833f9d46a145d254526f89ae7e1369062 (commit)
  discards  6f8997bcb4a9c14b2b32fcfdcb5e0567610151fb (commit)
  discards  c99bed9eb2bba0a819af2f8bf222b0511958cba6 (commit)
  discards  cc0063e7826880d85a5b5473d6be5b9ae75908a7 (commit)
       via  b964a5498e0a19e46ba78c0d357032405e44fd08 (commit)
       via  659106bf5f3929662dcdea458338b8b24351c810 (commit)
       via  d3e5e73bfc2288d85dc8d7f1aeb7da53cde37c08 (commit)
       via  166abcd17addd38c562c9afacaafa4c005ecbef7 (commit)
       via  2abb323777b1a12ab167ea7b52c96d52bd1a8693 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (e41bba7056adda0c78b09a4182c9e1a1a71a5c14)
                         N -- N -- N (b964a5498e0a19e46ba78c0d357032405e44fd08)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/b964a5498e0a19e46ba78c0d357032405e44fd08

commit b964a5498e0a19e46ba78c0d357032405e44fd08
Author: David Maciejak <[email protected]>
Date:   Fri Aug 15 06:46:34 2014 +0700

    wmaker: fix moveres.c compilation warning
    
    This patch is fixing compilation issue:
    
    moveres.c:1801:65: warning: unused parameter 'dx' [-Wunused-parameter]
    
    by removing variable 'dx' from getResizeDirection function.

diff --git a/src/moveres.c b/src/moveres.c
index 3d707d74..c88875b7 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -1798,7 +1798,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
 #define RESIZEBAR      1
 #define HCONSTRAIN     2
 
-static int getResizeDirection(WWindow * wwin, int x, int y, int dx, int dy, 
int flags)
+static int getResizeDirection(WWindow * wwin, int x, int y, int dy, int flags)
 {
        int w = wwin->frame->core->width - 1;
        int cw = wwin->frame->resizebar_corner_width;
@@ -1980,9 +1980,7 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
                                                     || abs(orig_y - 
event.xmotion.y_root) < HRESIZE_THRESHOLD))
                                        flags |= HCONSTRAIN;
 
-                               res = getResizeDirection(wwin, tx, ty,
-                                                        orig_x - 
event.xmotion.x_root,
-                                                        orig_y - 
event.xmotion.y_root, flags);
+                               res = getResizeDirection(wwin, tx, ty, orig_y - 
event.xmotion.y_root, flags);
 
                                if (res == (UP | LEFT))
                                        XChangeActivePointerGrab(dpy, 
ButtonMotionMask

http://repo.or.cz/w/wmaker-crm.git/commit/659106bf5f3929662dcdea458338b8b24351c810

commit 659106bf5f3929662dcdea458338b8b24351c810
Author: David Maciejak <[email protected]>
Date:   Thu Aug 14 12:32:11 2014 +0700

    wmaker: add miniwindow apercu
    
    This patch is adding miniwindow apercu when the mouse
    is over the miniwindows.

diff --git a/WINGs/wwindow.c b/WINGs/wwindow.c
index 5293f87b..a04ab6ae 100644
--- a/WINGs/wwindow.c
+++ b/WINGs/wwindow.c
@@ -606,8 +606,8 @@ void WMSetWindowMiniwindowPixmap(WMWindow * win, WMPixmap * 
pixmap)
 
 void WMSetWindowMiniwindowTitle(WMWindow * win, const char *title)
 {
-       if ((win->miniTitle && !title) || (!win->miniTitle && title)
-           || (title && win->miniTitle && strcoll(title, win->miniTitle) != 
0)) {
+       if (win && ((win->miniTitle && !title) || (!win->miniTitle && title)
+           || (title && win->miniTitle && strcoll(title, win->miniTitle) != 
0))) {
                if (win->miniTitle)
                        wfree(win->miniTitle);
 
diff --git a/WPrefs.app/Preferences.c b/WPrefs.app/Preferences.c
index 7d772139..b6b78913 100644
--- a/WPrefs.app/Preferences.c
+++ b/WPrefs.app/Preferences.c
@@ -39,7 +39,7 @@ typedef struct _Panel {
        WMPopUpButton *posiP;
 
        WMFrame *ballF;
-       WMButton *ballB[4];
+       WMButton *ballB[5];
 
        WMFrame *optF;
        WMButton *bounceB;
@@ -136,8 +136,9 @@ static void showData(_Panel * panel)
 
        WMSetButtonSelected(panel->ballB[0], 
GetBoolForKey("WindowTitleBalloons"));
        WMSetButtonSelected(panel->ballB[1], 
GetBoolForKey("MiniwindowTitleBalloons"));
-       WMSetButtonSelected(panel->ballB[2], GetBoolForKey("AppIconBalloons"));
-       WMSetButtonSelected(panel->ballB[3], GetBoolForKey("HelpBalloons"));
+       WMSetButtonSelected(panel->ballB[2], 
GetBoolForKey("MiniwindowApercuBalloons"));
+       WMSetButtonSelected(panel->ballB[3], GetBoolForKey("AppIconBalloons"));
+       WMSetButtonSelected(panel->ballB[4], GetBoolForKey("HelpBalloons"));
 }
 
 static void storeData(_Panel * panel)
@@ -198,8 +199,9 @@ static void storeData(_Panel * panel)
        SetBoolForKey(WMGetButtonSelected(panel->bounceRaisB), 
"RaiseAppIconsWhenBouncing");
        SetBoolForKey(WMGetButtonSelected(panel->ballB[0]), 
"WindowTitleBalloons");
        SetBoolForKey(WMGetButtonSelected(panel->ballB[1]), 
"MiniwindowTitleBalloons");
-       SetBoolForKey(WMGetButtonSelected(panel->ballB[2]), "AppIconBalloons");
-       SetBoolForKey(WMGetButtonSelected(panel->ballB[3]), "HelpBalloons");
+       SetBoolForKey(WMGetButtonSelected(panel->ballB[2]), 
"MiniwindowApercuBalloons");
+       SetBoolForKey(WMGetButtonSelected(panel->ballB[3]), "AppIconBalloons");
+       SetBoolForKey(WMGetButtonSelected(panel->ballB[4]), "HelpBalloons");
 }
 
 static void createPanel(Panel * p)
@@ -251,26 +253,27 @@ static void createPanel(Panel * p)
 
     /***************** Balloon Text ****************/
        panel->ballF = WMCreateFrame(panel->box);
-       WMResizeWidget(panel->ballF, 240, 109);
+       WMResizeWidget(panel->ballF, 240, 126);
        WMMoveWidget(panel->ballF, 265, 10);
-       WMSetFrameTitle(panel->ballF, _("Show balloon text for..."));
+       WMSetFrameTitle(panel->ballF, _("Show balloon for..."));
 
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < 5; i++) {
                panel->ballB[i] = WMCreateSwitchButton(panel->ballF);
                WMResizeWidget(panel->ballB[i], 210, 20);
                WMMoveWidget(panel->ballB[i], 15, 16 + i * 22);
        }
        WMSetButtonText(panel->ballB[0], _("incomplete window titles"));
        WMSetButtonText(panel->ballB[1], _("miniwindow titles"));
-       WMSetButtonText(panel->ballB[2], _("application/dock icons"));
-       WMSetButtonText(panel->ballB[3], _("internal help"));
+       WMSetButtonText(panel->ballB[2], _("miniwindow apercus"));
+       WMSetButtonText(panel->ballB[3], _("application/dock icons"));
+       WMSetButtonText(panel->ballB[4], _("internal help"));
 
        WMMapSubwidgets(panel->ballF);
 
     /***************** Options ****************/
        panel->optF = WMCreateFrame(panel->box);
-       WMResizeWidget(panel->optF, 240, 101);
-       WMMoveWidget(panel->optF, 265, 124);
+       WMResizeWidget(panel->optF, 240, 91);
+       WMMoveWidget(panel->optF, 265, 136);
        WMSetFrameTitle(panel->optF, _("AppIcon bouncing"));
 
        panel->bounceB = WMCreateSwitchButton(panel->optF);
@@ -279,21 +282,21 @@ static void createPanel(Panel * p)
        WMSetButtonText(panel->bounceB, _("Disable AppIcon bounce."));
 
        panel->bounceUrgB = WMCreateSwitchButton(panel->optF);
-       WMResizeWidget(panel->bounceUrgB, 210, 30);
-       WMMoveWidget(panel->bounceUrgB, 15, 39);
+       WMResizeWidget(panel->bounceUrgB, 210, 28);
+       WMMoveWidget(panel->bounceUrgB, 15, 37);
        WMSetButtonText(panel->bounceUrgB, _("Bounce AppIcon when the 
application wants attention."));
        WMSetButtonSelected(panel->bounceUrgB, True); /* defaults to true */
 
        panel->bounceRaisB = WMCreateSwitchButton(panel->optF);
-       WMResizeWidget(panel->bounceRaisB, 210, 25);
-       WMMoveWidget(panel->bounceRaisB, 15, 70);
+       WMResizeWidget(panel->bounceRaisB, 210, 23);
+       WMMoveWidget(panel->bounceRaisB, 15, 65);
        WMSetButtonText(panel->bounceRaisB, _("Raise AppIcons when bouncing."));
 
        WMMapSubwidgets(panel->optF);
 
     /***************** Workspace border ****************/
        panel->borderF = WMCreateFrame(panel->box);
-       WMResizeWidget(panel->borderF, 240, 80);
+       WMResizeWidget(panel->borderF, 240, 82);
        WMMoveWidget(panel->borderF, 15, 145);
        WMSetFrameTitle(panel->borderF, _("Workspace border"));
 
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index d0212932..5553d5b3 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -392,7 +392,8 @@ extern struct WPreferences {
 
     /* balloon text */
     char window_balloon;
-    char miniwin_balloon;
+    char miniwin_title_balloon;
+    char miniwin_apercu_balloon;
     char appicon_balloon;
     char help_balloon;
 
diff --git a/src/actions.c b/src/actions.c
index a767072f..ae326a11 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1094,6 +1094,40 @@ void wIconifyWindow(WWindow * wwin)
 
                wwin->icon = icon_create_for_wwindow(wwin);
                wwin->icon->mapped = 1;
+
+               /* extract the window screenshot everytime, as the option can 
be enable anytime */
+               if (wwin->client_win && wwin->flags.mapped) {
+                       RImage *apercu;
+                       XImage *pimg;
+                       unsigned int w, h;
+                       int x, y;
+                       Window baz;
+
+                       XRaiseWindow(dpy, wwin->frame->core->window);
+                       XTranslateCoordinates(dpy, wwin->client_win, 
wwin->screen_ptr->root_win, 0, 0, &x, &y, &baz);
+
+                       w = attribs.width;
+                       h = attribs.height;
+
+                       if (x - attribs.x + attribs.width > 
wwin->screen_ptr->scr_width)
+                               w = wwin->screen_ptr->scr_width - x + attribs.x;
+
+                       if (y - attribs.y + attribs.height > 
wwin->screen_ptr->scr_height)
+                               h = wwin->screen_ptr->scr_height - y + 
attribs.y;
+
+                       pimg = XGetImage(dpy, wwin->client_win, 0, 0, w, h, 
AllPlanes, ZPixmap);
+                       if (pimg) {
+                               apercu = 
RCreateImageFromXImage(wwin->screen_ptr->rcontext, pimg, NULL);
+                               XDestroyImage(pimg);
+
+                               if (apercu) {
+                                       set_icon_apercu(wwin->icon, apercu);
+                                       RReleaseImage(apercu);
+                               } else {
+                                       wwarning("window apercu creation 
failed");
+                               }
+                       }
+               }
        }
 
        wwin->flags.miniaturized = 1;
diff --git a/src/balloon.c b/src/balloon.c
index b9c77bb2..769a3468 100644
--- a/src/balloon.c
+++ b/src/balloon.c
@@ -42,6 +42,7 @@
 #include "appicon.h"
 #include "workspace.h"
 #include "balloon.h"
+#include "misc.h"
 
 
 typedef struct _WBalloon {
@@ -59,6 +60,7 @@ typedef struct _WBalloon {
        WMHandlerID timer;
 
        Pixmap contents;
+       Pixmap apercu;
 
        char mapped;
        char ignoreTimer;
@@ -376,6 +378,77 @@ static void showText(WScreen *scr, int x, int y, int h, 
int w, const char *text)
 }
 #endif                         /* !SHAPED_BALLOON */
 
+static void showApercu(WScreen *scr, int x, int y, int h, int w, char *title, 
Pixmap apercu)
+{
+       int width;
+       int height;
+       Pixmap pixmap;
+       WMFont *font = scr->info_text_font;
+       int titleHeight = 0;
+       char *shortenTitle = title;
+
+       if (scr->balloon->contents)
+               XFreePixmap(dpy, scr->balloon->contents);
+
+       height = h;
+       width  = w;
+
+       if (wPreferences.miniwin_title_balloon) {
+               shortenTitle = ShrinkString(font, title, width - APERCU_BORDER);
+               titleHeight = countLines(shortenTitle) * WMFontHeight(font) + 4;
+               height += titleHeight;
+       }
+
+
+       if (x < 0)
+               x = 0;
+       else if (x + width > scr->scr_width - 1)
+               x = scr->scr_width - width - APERCU_BORDER;
+
+       if (y - height - 2 < 0) {
+               y += wPreferences.icon_size;
+               if (y < 0)
+                       y = 0;
+       } else {
+               y -= height + 2;
+       }
+
+       if (scr->window_title_texture[0])
+               XSetForeground(dpy, scr->draw_gc, 
scr->window_title_texture[0]->any.color.pixel);
+       else
+               XSetForeground(dpy, scr->draw_gc, scr->light_pixel);
+
+       pixmap = XCreatePixmap(dpy, scr->root_win, width, height, scr->w_depth);
+       XFillRectangle(dpy, pixmap, scr->draw_gc, 0, 0, width, height);
+
+       if (shortenTitle && wPreferences.miniwin_title_balloon) {
+               drawMultiLineString(scr->wmscreen, pixmap, 
scr->window_title_color[0], font,
+                                               APERCU_BORDER, APERCU_BORDER, 
shortenTitle, strlen(shortenTitle));
+               wfree(shortenTitle);
+       }
+
+       XCopyArea(dpy, apercu, pixmap, scr->draw_gc,
+                               0, 0, (wPreferences.icon_size - 1 - 
APERCU_BORDER) * 2,
+                               (wPreferences.icon_size - 1 - APERCU_BORDER) * 
2,
+                               APERCU_BORDER, APERCU_BORDER + titleHeight);
+
+#ifdef SHAPED_BALLOON
+       XShapeCombineMask(dpy, scr->balloon->window, ShapeBounding, 0, 0, None, 
ShapeSet);
+#endif
+       XResizeWindow(dpy, scr->balloon->window, width, height);
+       XMoveWindow(dpy, scr->balloon->window, x, y);
+
+       XSetWindowBackgroundPixmap(dpy, scr->balloon->window, pixmap);
+
+       XClearWindow(dpy, scr->balloon->window);
+       XMapRaised(dpy, scr->balloon->window);
+
+
+       scr->balloon->contents = pixmap;
+
+       scr->balloon->mapped = 1;
+}
+
 static void showBalloon(WScreen * scr)
 {
        int x, y;
@@ -389,7 +462,14 @@ static void showBalloon(WScreen * scr)
                scr->balloon->prevType = 0;
                return;
        }
-       showText(scr, x, y, scr->balloon->h, w, scr->balloon->text);
+
+       if (wPreferences.miniwin_apercu_balloon && scr->balloon->apercu != None)
+               /* used to display either the apercu alone or the apercu and 
the title */
+               showApercu(scr, x, y, (wPreferences.icon_size - 1) * 2, 
(wPreferences.icon_size - 1) * 2,
+                                       scr->balloon->text, 
scr->balloon->apercu);
+       else
+               if (wPreferences.miniwin_title_balloon)
+                       showText(scr, x, y, scr->balloon->h, w, 
scr->balloon->text);
 }
 
 static void frameBalloon(WObjDescriptor * object)
@@ -420,7 +500,9 @@ static void miniwindowBalloon(WObjDescriptor * object)
        }
        scr->balloon->h = icon->core->height;
        scr->balloon->text = wstrdup(icon->icon_name);
+       scr->balloon->apercu = icon->apercu;
        scr->balloon->objectWindow = icon->core->window;
+
        if ((scr->balloon->prevType == object->parent_type || 
scr->balloon->prevType == WCLASS_APPICON)
            && scr->balloon->ignoreTimer) {
                XUnmapWindow(dpy, scr->balloon->window);
@@ -522,6 +604,8 @@ void wBalloonEnteredObject(WScreen * scr, WObjDescriptor * 
object)
                wfree(scr->balloon->text);
        scr->balloon->text = NULL;
 
+       scr->balloon->apercu = None;
+
        if (!object) {
                wBalloonHide(scr);
                balloon->ignoreTimer = 0;
@@ -538,7 +622,7 @@ void wBalloonEnteredObject(WScreen * scr, WObjDescriptor * 
object)
                        appiconBalloon(object);
                break;
        case WCLASS_MINIWINDOW:
-               if (wPreferences.miniwin_balloon)
+               if (wPreferences.miniwin_title_balloon || 
wPreferences.miniwin_apercu_balloon)
                        miniwindowBalloon(object);
                break;
        case WCLASS_APPICON:
diff --git a/src/defaults.c b/src/defaults.c
index 266684ba..155fe6f7 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -458,7 +458,9 @@ WDefaultEntry optionList[] = {
        {"WindowTitleBalloons", "NO", NULL,
            &wPreferences.window_balloon, getBool, NULL, NULL, NULL},
        {"MiniwindowTitleBalloons", "NO", NULL,
-           &wPreferences.miniwin_balloon, getBool, NULL, NULL, NULL},
+           &wPreferences.miniwin_title_balloon, getBool, NULL, NULL, NULL},
+       {"MiniwindowApercuBalloons", "NO", NULL,
+           &wPreferences.miniwin_apercu_balloon, getBool, NULL, NULL, NULL},
        {"AppIconBalloons", "NO", NULL,
            &wPreferences.appicon_balloon, getBool, NULL, NULL, NULL},
        {"HelpBalloons", "NO", NULL,
diff --git a/src/icon.c b/src/icon.c
index b5bb3089..1aa27ea7 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -225,6 +225,9 @@ void wIconDestroy(WIcon *icon)
        if (icon->pixmap)
                XFreePixmap(dpy, icon->pixmap);
 
+       if (icon->apercu)
+               XFreePixmap(dpy, icon->apercu);
+
        unset_icon_image(icon);
 
        wCoreDestroy(icon->core);
@@ -582,6 +585,23 @@ void set_icon_image_from_image(WIcon *icon, RImage *image)
        icon->file_image = image;
 }
 
+void set_icon_apercu(WIcon *icon, RImage *image)
+{
+       Pixmap tmp;
+       RImage *scaled_apercu;
+       WScreen *scr = icon->core->screen_ptr;
+
+       scaled_apercu = RSmoothScaleImage(image, (wPreferences.icon_size - 1 - 
APERCU_BORDER) * 2,
+                                               (wPreferences.icon_size - 1 - 
APERCU_BORDER) * 2 );
+
+       if (RConvertImage(scr->rcontext, scaled_apercu, &tmp)) {
+               if (icon->apercu != None)
+                       XFreePixmap(dpy, icon->apercu);
+               icon->apercu = tmp;
+       }
+       RReleaseImage(scaled_apercu);
+}
+
 void wIconUpdate(WIcon *icon)
 {
        WWindow *wwin = NULL;
diff --git a/src/icon.h b/src/icon.h
index 347814be..af82f5c2 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -29,6 +29,8 @@
 #define TILE_CLIP      1
 #define TILE_DRAWER    2
 
+#define APERCU_BORDER 2
+
 typedef struct WIcon {
        WCoreWindow     *core;
        WWindow         *owner;         /* owner window */
@@ -48,6 +50,7 @@ typedef struct WIcon {
        unsigned int    highlighted:1;
 
        Pixmap          pixmap;
+       Pixmap          apercu;
 
        WMHandlerID     handlerID;      /* timer handler ID for cycling select
                                         * color */
@@ -74,5 +77,6 @@ char *get_name_for_instance_class(const char *wm_instance, 
const char *wm_class)
 
 void wIconSetHighlited(WIcon *icon, Bool flag);
 void set_icon_image_from_image(WIcon *icon, RImage *image);
+void set_icon_apercu(WIcon *icon, RImage *image);
 
 #endif /* WMICON_H_ */

http://repo.or.cz/w/wmaker-crm.git/commit/d3e5e73bfc2288d85dc8d7f1aeb7da53cde37c08

commit d3e5e73bfc2288d85dc8d7f1aeb7da53cde37c08
Author: David Maciejak <[email protected]>
Date:   Thu Aug 14 12:30:17 2014 +0700

    wmaker: Add drag-nd-drop support
    
    This patch is removing the experimental status of
    drag-nd-drop support on the dock and adding an option
    to disable the feature from the configure step.

diff --git a/configure.ac b/configure.ac
index 4352e906..8eea8528 100644
--- a/configure.ac
+++ b/configure.ac
@@ -501,6 +501,18 @@ dnl ============================
 AC_ARG_ENABLE(modelock, AS_HELP_STRING([--enable-modelock], [XKB keyboard 
language status support]),
                AC_DEFINE(XKB_MODELOCK, 1, [whether XKB language MODELOCK 
should be enabled]))
 
+dnl XDND Drag-nd-Drop support
+dnl ============================
+AC_ARG_ENABLE([xdnd],
+    [AS_HELP_STRING([--disable-xdnd], [disable Drag-nd-Drop support])],
+    [AS_CASE(["$enableval"],
+        [yes|no], [],
+        [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
+    [enable_xdnd=yes
+  supported_xext="$supported_xext XDnD"
+  AC_DEFINE(XDND, 1, [whether Drag-nd-Drop support should be enabled])
+])
+
 dnl XShape support
 dnl ==============
 AC_ARG_ENABLE([shape],
diff --git a/src/wconfig.h.in b/src/wconfig.h.in
index f444a19f..c1548ee6 100644
--- a/src/wconfig.h.in
+++ b/src/wconfig.h.in
@@ -36,9 +36,6 @@
 /* If you want animations for iconification, shading, icon arrangement etc. */
 #define ANIMATIONS
 
-/* support for XDND drop in the Dock. Experimental */
-/*#define XDND*/
-
 /* support for Motif window manager (mwm) window hints */
 #define MWM_HINTS
 

http://repo.or.cz/w/wmaker-crm.git/commit/166abcd17addd38c562c9afacaafa4c005ecbef7

commit 166abcd17addd38c562c9afacaafa4c005ecbef7
Author: David Maciejak <[email protected]>
Date:   Thu Aug 14 12:28:53 2014 +0700

    wmaker: Add drag-nd-drop support in info panel
    
    This patch is adding a message in the info panel
    if drag-nd-drop was compiled in.

diff --git a/src/dialog.c b/src/dialog.c
index 90e7192b..20c82ac6 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -1315,6 +1315,10 @@ void wShowInfoPanel(WScreen *scr)
        strbuf = wstrappend(strbuf, ", MWM");
 #endif
 
+#ifdef XDND
+       strbuf = wstrappend(strbuf, ", XDnD");
+#endif
+
 #ifdef USE_MAGICK
        strbuf = wstrappend(strbuf, ", ImageMagick");
 #endif

http://repo.or.cz/w/wmaker-crm.git/commit/2abb323777b1a12ab167ea7b52c96d52bd1a8693

commit 2abb323777b1a12ab167ea7b52c96d52bd1a8693
Author: David Maciejak <[email protected]>
Date:   Thu Aug 14 12:27:37 2014 +0700

    wmaker: Improve drag-nd-drop support
    
    This patch is cleaning the previous DnD support,
    and adds the get type list protocol negociation.
    Currently only supporting uri-list type.

diff --git a/src/xdnd.c b/src/xdnd.c
index 3ffce50f..59e8a526 100644
--- a/src/xdnd.c
+++ b/src/xdnd.c
@@ -1,26 +1,39 @@
+/*
+ *  Window Maker window manager
+ *
+ *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 2014 Window Maker Team
+ *
+ *  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 of the License, 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.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation
+ */
+
 /* Many part of code are ripped of an example from JX's site */
 
 #include "wconfig.h"
 
 #ifdef XDND
 
-#include <X11/Xlib.h>
 #include "WindowMaker.h"
-#include "window.h"
 #include "dock.h"
 #include "xdnd.h"
-#include "motif.h"
-
 #include "workspace.h"
 
 #include <stdlib.h>
-#include <string.h>
 #include <stdio.h>
-
+#include <string.h>
 #include <X11/Xatom.h>
 
-#define XDND_VERSION 3L
-
 static Atom _XA_XdndAware;
 static Atom _XA_XdndEnter;
 static Atom _XA_XdndLeave;
@@ -30,18 +43,13 @@ static Atom _XA_XdndStatus;
 static Atom _XA_XdndActionCopy;
 static Atom _XA_XdndSelection;
 static Atom _XA_XdndFinished;
+static Atom _XA_XdndTypeList;
 static Atom _XA_WINDOWMAKER_XDNDEXCHANGE;
+static Atom supported_typelist;
+static Atom selected_typelist;
 
-/*
- Atom _XA_MOTIF_DRAG_RECEIVER_INFO;
- Atom _XA_MOTIF_DRAG_AND_DROP_MESSAGE;
- */
-
-static Atom atom_support;
-
-void wXDNDInitializeAtoms()
+void wXDNDInitializeAtoms(void)
 {
-
        _XA_XdndAware = XInternAtom(dpy, "XdndAware", False);
        _XA_XdndEnter = XInternAtom(dpy, "XdndEnter", False);
        _XA_XdndLeave = XInternAtom(dpy, "XdndLeave", False);
@@ -51,41 +59,21 @@ void wXDNDInitializeAtoms()
        _XA_XdndActionCopy = XInternAtom(dpy, "XdndActionCopy", False);
        _XA_XdndSelection = XInternAtom(dpy, "XdndSelection", False);
        _XA_XdndFinished = XInternAtom(dpy, "XdndFinished", False);
-
+       _XA_XdndTypeList = XInternAtom(dpy, "XdndTypeList", False);
        _XA_WINDOWMAKER_XDNDEXCHANGE = XInternAtom(dpy, 
"_WINDOWMAKER_XDNDEXCHANGE", False);
 
-       /*
-          _XA_MOTIF_DRAG_RECEIVER_INFO = XInternAtom(dpy, 
"_MOTIF_DRAG_RECEIVER_INFO",False);
-          _XA_MOTIF_DRAG_AND_DROP_MESSAGE = XInternAtom(dpy, 
"_MOTIF_DRAG_AND_DROP_MESSAGE", False);
-        */
+       supported_typelist = XInternAtom(dpy, "text/uri-list", False);
 }
 
 void wXDNDMakeAwareness(Window window)
 {
-       long int xdnd_version = 3;
-       /*
-          MotifDragReceiverInfo info;
-        */
-       XChangeProperty(dpy, window, _XA_XdndAware, XA_ATOM, 32, 
PropModeAppend, (unsigned char *)&xdnd_version, 1);
-
-    /*** MOTIF ***
-     info.byte_order = '0';
-     info.protocol_version = 0;
-     info.protocol_style = XmDRAG_DYNAMIC;
-     info.proxy_window = 0;
-     info.num_drop_sites = 0;
-     info.total_size = sizeof(info);
-
-     XChangeProperty (dpy, window,
-     _XA_MOTIF_DRAG_RECEIVER_INFO,
-     _XA_MOTIF_DRAG_RECEIVER_INFO,
-     8, PropModeReplace,
-     (unsigned char *)&info,
-     sizeof (info));
-     */
+       long int xdnd_version = XDND_VERSION;
+       XChangeProperty(dpy, window, _XA_XdndAware, XA_ATOM, 32,
+                                       PropModeAppend, (unsigned char 
*)&xdnd_version, 1);
 }
 
-void wXDNDDecodeURI(char *uri) {
+static void wXDNDDecodeURI(char *uri)
+{
        char *last = uri + strlen(uri);
        while (uri < last-2) {
                if (*uri == '%') {
@@ -100,7 +88,7 @@ void wXDNDDecodeURI(char *uri) {
        }
 }
 
-Bool wXDNDProcessSelection(XEvent * event)
+Bool wXDNDProcessSelection(XEvent *event)
 {
        WScreen *scr = wScreenForWindow(event->xselection.requestor);
        char *retain;
@@ -114,7 +102,7 @@ Bool wXDNDProcessSelection(XEvent * event)
 
        XGetWindowProperty(dpy, event->xselection.requestor,
                           _XA_WINDOWMAKER_XDNDEXCHANGE,
-                          0, 65536, True, atom_support, &ret_type, &ret_format,
+                          0, 65536, True, selected_typelist, &ret_type, 
&ret_format,
                           &ret_item, &remain_byte, (unsigned char **)&delme);
 
        /*send finished */
@@ -178,16 +166,15 @@ Bool wXDNDProcessSelection(XEvent * event)
                        wfree(tmp);
                }
                WMFreeArray(items);
-               if (scr->xdestring[0]) {
+               if (scr->xdestring[0])
                        wDockReceiveDNDDrop(scr, event);
-               }
                wfree(scr->xdestring);  /* this xdestring is not from Xlib (no 
XFree) */
        }
 
        return True;
 }
 
-Bool isAwareXDND(Window window)
+static Bool isAwareXDND(Window window)
 {
        Atom actual;
        int format;
@@ -208,14 +195,15 @@ Bool isAwareXDND(Window window)
        return True;
 }
 
-Bool acceptXDND(Window window)
+static Bool acceptXDND(Window window)
 {
        WScreen *scr = wScreenForWindow(window);
        WDock *dock;
        int icon_pos, i;
 
        icon_pos = -1;
-       if ((dock = scr->dock) != NULL) {
+       dock = scr->dock;
+       if (dock) {
                for (i = 0; i < dock->max_icons; i++) {
                        if (dock->icon_array[i]
                            && dock->icon_array[i]->icon->core->window == 
window) {
@@ -224,12 +212,15 @@ Bool acceptXDND(Window window)
                        }
                }
        }
-       if (icon_pos < 0 && (dock = 
w_global.workspace.array[w_global.workspace.current]->clip) != NULL) {
-               for (i = 0; i < dock->max_icons; i++) {
-                       if (dock->icon_array[i]
-                           && dock->icon_array[i]->icon->core->window == 
window) {
-                               icon_pos = i;
-                               break;
+       if (icon_pos < 0) {
+               dock = 
w_global.workspace.array[w_global.workspace.current]->clip;
+               if (dock) {
+                       for (i = 0; i < dock->max_icons; i++) {
+                               if (dock->icon_array[i]
+                                   && dock->icon_array[i]->icon->core->window 
== window) {
+                                       icon_pos = i;
+                                       break;
+                               }
                        }
                }
        }
@@ -246,74 +237,66 @@ Bool acceptXDND(Window window)
        return False;
 }
 
-Bool wXDNDProcessClientMessage(XClientMessageEvent * event)
+static void wXDNDGetTypeList(Display *dpy, Window window)
 {
-       /* test */
-       {
-               char *name = XGetAtomName(dpy, event->message_type);
-               /*
-                  printf("Get %sn",name);
-                */
-               XFree(name);
+       Atom type, *a;
+       Atom *typelist;
+       int format, i;
+       unsigned long count, remaining;
+       unsigned char *data = NULL;
+
+       XGetWindowProperty(dpy, window, _XA_XdndTypeList,
+                                               0, 0x8000000L, False, XA_ATOM,
+                                               &type, &format, &count, 
&remaining, &data);
+
+       if (type != XA_ATOM || format != 32 || count == 0 || !data) {
+               if (data)
+                       XFree(data);
+               wwarning(_("wXDNDGetTypeList failed = %ld"), _XA_XdndTypeList);
+               return;
        }
 
-       /*
-          if (event->message_type == _XA_MOTIF_DRAG_AND_DROP_MESSAGE) {
-          printf("motif dnd msg %dn",event->data.b[0]);
-          if (event->data.b[0] == XmDROP_START){
-          unsigned x_root, y_root, flags;
-          unsigned char reason;
-          unsigned long timestamp;
-          Atom atom;
-          Window source_window;
-          MotifDragInitiatorInfo *initiator_info;
-          Atom ret_type;
-          int ret_format;
-          unsigned long ret_item;
-          unsigned long remain_byte;
-
-          reason = event->data.b[0];
-          flags = event->data.s[1];
-          timestamp = event->data.l[1];
-          x_root = event->data.s[4];
-          y_root = event->data.s[5];
-          atom = event->data.l[3];
-          source_window = event->data.l[4];
-
-          XGetWindowProperty(dpy, source_window, atom,
-          0, sizeof(*initiator_info), True, atom_support,
-          &ret_type, &ret_format,
-          &ret_item, &remain_byte, (unsigned char **)&initiator_info);
-          }
-          }
-          else */
+       typelist = malloc((count + 1) * sizeof(Atom));
+       a = (Atom *) data;
+       for (i = 0; i < count; i++) {
+               typelist[i] = a[i];
+               if (typelist[i] == supported_typelist) {
+                       selected_typelist = typelist[i];
+                       break;
+               }
+       }
+       typelist[count] = 0;
+       XFree(data);
+       free(typelist);
+}
+
+Bool wXDNDProcessClientMessage(XClientMessageEvent *event)
+{
        if (event->message_type == _XA_XdndEnter) {
-               if ((event->data.l[1] & 1) == 0) {
-                       atom_support = event->data.l[2];
+
+               if (XDND_ENTER_THREE_TYPES(event)) {
+                       selected_typelist = XDND_ENTER_TYPE(event, 0);
+               } else {
+                       wXDNDGetTypeList(dpy, XDND_ENTER_SOURCE_WIN(event));
+                       /*
+                       char *name = XGetAtomName(dpy, selected_typelist);
+                       fprintf(stderr, "Get %sn",name);
+                       XFree(name);
+                       */
                }
-               /*
-                  else puts("enter more than 3 types");
-                */
                return True;
        } else if (event->message_type == _XA_XdndLeave) {
                return True;
        } else if (event->message_type == _XA_XdndDrop) {
-               if (event->data.l[0] == XGetSelectionOwner(dpy, 
_XA_XdndSelection)) {
-                       XConvertSelection(dpy, _XA_XdndSelection, atom_support,
-                                         _XA_WINDOWMAKER_XDNDEXCHANGE, 
event->window, CurrentTime);
-               } else {
-                       //printf("weird selection owner? QT?n");
-                       XConvertSelection(dpy, _XA_XdndSelection, atom_support,
+               if (XDND_DROP_SOURCE_WIN(event) == XGetSelectionOwner(dpy, 
_XA_XdndSelection)) {
+                       XConvertSelection(dpy, _XA_XdndSelection, 
selected_typelist,
                                          _XA_WINDOWMAKER_XDNDEXCHANGE, 
event->window, CurrentTime);
                }
                return True;
        } else if (event->message_type == _XA_XdndPosition) {
                XEvent xevent;
-               Window srcwin = event->data.l[0];
-               if (atom_support != XInternAtom(dpy, "text/uri-list", False)) {
-                       return True;
-               }
-               {
+               Window srcwin = XDND_POSITION_SOURCE_WIN(event);
+               if (selected_typelist == supported_typelist) {
                        memset(&xevent, 0, sizeof(xevent));
                        xevent.xany.type = ClientMessage;
                        xevent.xany.display = dpy;
@@ -324,7 +307,7 @@ Bool wXDNDProcessClientMessage(XClientMessageEvent * event)
                        XDND_STATUS_TARGET_WIN(&xevent) = event->window;
                        XDND_STATUS_WILL_ACCEPT_SET(&xevent, 
acceptXDND(event->window));
                        XDND_STATUS_WANT_POSITION_SET(&xevent, True);
-                       XDND_STATUS_RECT_SET(&xevent, 0, 0, 1024, 768);
+                       XDND_STATUS_RECT_SET(&xevent, 0, 0, 0, 0);
                        XDND_STATUS_ACTION(&xevent) = _XA_XdndActionCopy;
 
                        XSendEvent(dpy, srcwin, 0, 0, &xevent);
@@ -333,5 +316,4 @@ Bool wXDNDProcessClientMessage(XClientMessageEvent * event)
        }
        return False;
 }
-
 #endif
diff --git a/src/xdnd.h b/src/xdnd.h
index 1ee0e43b..baaf92ff 100644
--- a/src/xdnd.h
+++ b/src/xdnd.h
@@ -1,48 +1,49 @@
+/*
+ *  Window Maker window manager
+ *
+ *  Copyright (c) 1997-2003 Alfredo K. Kojima
+ *  Copyright (c) 2014 Window Maker Team
+ *
+ *  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 of the License, 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.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation
+ */
+
 #ifndef _XDND_H_
 #define _XDND_H_
 
-void wXDNDInitializeAtoms();
+void wXDNDInitializeAtoms(void);
 Bool wXDNDProcessSelection(XEvent *event);
 Bool wXDNDProcessClientMessage(XClientMessageEvent *event);
 void wXDNDMakeAwareness(Window window);
 
-/* header was ripped from xdnd's example on its page */
+#define XDND_VERSION 3L
 
-#define XDND_THREE 3
-#define XDND_ENTER_SOURCE_WIN(e)       ((e)->xclient.data.l[0])
-#define XDND_ENTER_THREE_TYPES(e)      (((e)->xclient.data.l[1] & 0x1UL) == 0)
-#define XDND_ENTER_THREE_TYPES_SET(e,b)        (e)->xclient.data.l[1] = 
((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
-#define XDND_ENTER_VERSION(e)          ((e)->xclient.data.l[1] >> 24)
-#define XDND_ENTER_VERSION_SET(e,v)    (e)->xclient.data.l[1] = 
((e)->xclient.data.l[1] & ~(0xFF << 24)) | ((v) << 24)
-#define XDND_ENTER_TYPE(e,i)           ((e)->xclient.data.l[2 + i])    /* i => 
(0, 1, 2) */
+#define XDND_ENTER_SOURCE_WIN(e)       ((e)->data.l[0])
+#define XDND_ENTER_THREE_TYPES(e)      (((e)->data.l[1] & 0x1UL) == 0)
+#define XDND_ENTER_TYPE(e, i)          ((e)->data.l[2 + i])    /* i => (0, 1, 
2) */
 
 /* XdndPosition */
-#define XDND_POSITION_SOURCE_WIN(e)    ((e)->xclient.data.l[0])
-#define XDND_POSITION_ROOT_X(e)                ((e)->xclient.data.l[2] >> 16)
-#define XDND_POSITION_ROOT_Y(e)                ((e)->xclient.data.l[2] & 
0xFFFFUL)
-#define XDND_POSITION_ROOT_SET(e,x,y)  (e)->xclient.data.l[2]  = ((x) << 16) | 
((y) & 0xFFFFUL)
-#define XDND_POSITION_TIME(e)          ((e)->xclient.data.l[3])
-#define XDND_POSITION_ACTION(e)                ((e)->xclient.data.l[4])
+#define XDND_POSITION_SOURCE_WIN(e)     ((e)->data.l[0])
 
 /* XdndStatus */
 #define XDND_STATUS_TARGET_WIN(e)      ((e)->xclient.data.l[0])
-#define XDND_STATUS_WILL_ACCEPT(e)     ((e)->xclient.data.l[1] & 0x1L)
-#define XDND_STATUS_WILL_ACCEPT_SET(e,b) (e)->xclient.data.l[1] = 
((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
-#define XDND_STATUS_WANT_POSITION(e)   ((e)->xclient.data.l[1] & 0x2UL)
-#define XDND_STATUS_WANT_POSITION_SET(e,b) (e)->xclient.data.l[1] = 
((e)->xclient.data.l[1] & ~0x2UL) | (((b) == 0) ? 0 : 0x2UL)
-#define XDND_STATUS_RECT_X(e)          ((e)->xclient.data.l[2] >> 16)
-#define XDND_STATUS_RECT_Y(e)          ((e)->xclient.data.l[2] & 0xFFFFL)
-#define XDND_STATUS_RECT_WIDTH(e)      ((e)->xclient.data.l[3] >> 16)
-#define XDND_STATUS_RECT_HEIGHT(e)     ((e)->xclient.data.l[3] & 0xFFFFL)
-#define XDND_STATUS_RECT_SET(e,x,y,w,h)        {(e)->xclient.data.l[2] = ((x) 
<< 16) | ((y) & 0xFFFFUL); (e)->xclient.data.l[3] = ((w) << 16) | ((h) & 
0xFFFFUL); }
+#define XDND_STATUS_WILL_ACCEPT_SET(e, b) (e)->xclient.data.l[1] = 
((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
+#define XDND_STATUS_WANT_POSITION_SET(e, b) (e)->xclient.data.l[1] = 
((e)->xclient.data.l[1] & ~0x2UL) | (((b) == 0) ? 0 : 0x2UL)
+#define XDND_STATUS_RECT_SET(e, x, y, w, h)    {(e)->xclient.data.l[2] = ((x) 
<< 16) | ((y) & 0xFFFFUL); (e)->xclient.data.l[3] = ((w) << 16) | ((h) & 
0xFFFFUL); }
 #define XDND_STATUS_ACTION(e)          ((e)->xclient.data.l[4])
 
-/* XdndLeave */
-#define XDND_LEAVE_SOURCE_WIN(e)       ((e)->xclient.data.l[0])
-
 /* XdndDrop */
-#define XDND_DROP_SOURCE_WIN(e)                ((e)->xclient.data.l[0])
-#define XDND_DROP_TIME(e)              ((e)->xclient.data.l[2])
+#define XDND_DROP_SOURCE_WIN(e)         ((e)->data.l[0])
 
 /* XdndFinished */
 #define XDND_FINISHED_TARGET_WIN(e)    ((e)->xclient.data.l[0])

-----------------------------------------------------------------------

Summary of changes:
 src/moveres.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to [email protected].

Reply via email to