mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
bag tree finished.. updated code to new bags
This commit is contained in:
231
WINGs/Resources/Makefile.in
Normal file
231
WINGs/Resources/Makefile.in
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DESTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
|
||||||
|
top_builddir = ../..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
transform = @program_transform_name@
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
AS = @AS@
|
||||||
|
CC = @CC@
|
||||||
|
CPP_PATH = @CPP_PATH@
|
||||||
|
DFLAGS = @DFLAGS@
|
||||||
|
DLLIBS = @DLLIBS@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
GFXLIBS = @GFXLIBS@
|
||||||
|
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
||||||
|
ICONEXT = @ICONEXT@
|
||||||
|
INTLIBS = @INTLIBS@
|
||||||
|
LD = @LD@
|
||||||
|
LIBPL = @LIBPL@
|
||||||
|
LIBRARY_SEARCH_PATH = @LIBRARY_SEARCH_PATH@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LITE = @LITE@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MOFILES = @MOFILES@
|
||||||
|
NETLIBS = @NETLIBS@
|
||||||
|
NLSDIR = @NLSDIR@
|
||||||
|
NM = @NM@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
WPMOFILES = @WPMOFILES@
|
||||||
|
XCFLAGS = @XCFLAGS@
|
||||||
|
XGETTEXT = @XGETTEXT@
|
||||||
|
XLFLAGS = @XLFLAGS@
|
||||||
|
XLIBS = @XLIBS@
|
||||||
|
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||||
|
X_LIBRARY_PATH = @X_LIBRARY_PATH@
|
||||||
|
supported_locales = @supported_locales@
|
||||||
|
wprefsdir = @wprefsdir@
|
||||||
|
|
||||||
|
resdatadir = $(datadir)/WINGs
|
||||||
|
|
||||||
|
resdata_DATA = Images.tiff Images.xpm defaultIcon.tiff defaultIcon.xpm
|
||||||
|
|
||||||
|
EXTRA_DIST = $(resdata_DATA) Images.xcf
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = ../../src/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
DATA = $(resdata_DATA)
|
||||||
|
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
TAR = gtar
|
||||||
|
GZIP_ENV = --best
|
||||||
|
all: all-redirect
|
||||||
|
.SUFFIXES:
|
||||||
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu WINGs/Resources/Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
|
||||||
|
install-resdataDATA: $(resdata_DATA)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(resdatadir)
|
||||||
|
@list='$(resdata_DATA)'; for p in $$list; do \
|
||||||
|
if test -f $(srcdir)/$$p; then \
|
||||||
|
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(resdatadir)/$$p"; \
|
||||||
|
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(resdatadir)/$$p; \
|
||||||
|
else if test -f $$p; then \
|
||||||
|
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(resdatadir)/$$p"; \
|
||||||
|
$(INSTALL_DATA) $$p $(DESTDIR)$(resdatadir)/$$p; \
|
||||||
|
fi; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-resdataDATA:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(resdata_DATA)'; for p in $$list; do \
|
||||||
|
rm -f $(DESTDIR)$(resdatadir)/$$p; \
|
||||||
|
done
|
||||||
|
tags: TAGS
|
||||||
|
TAGS:
|
||||||
|
|
||||||
|
|
||||||
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
|
||||||
|
subdir = WINGs/Resources
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
here=`cd $(top_builddir) && pwd`; \
|
||||||
|
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||||
|
distdir=`cd $(distdir) && pwd`; \
|
||||||
|
cd $(top_srcdir) \
|
||||||
|
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu WINGs/Resources/Makefile
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pr $$/$$file $(distdir)/$$file; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
info-am:
|
||||||
|
info: info-am
|
||||||
|
dvi-am:
|
||||||
|
dvi: dvi-am
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
installcheck-am:
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-exec-am:
|
||||||
|
install-exec: install-exec-am
|
||||||
|
|
||||||
|
install-data-am: install-resdataDATA
|
||||||
|
install-data: install-data-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
install: install-am
|
||||||
|
uninstall-am: uninstall-resdataDATA
|
||||||
|
uninstall: uninstall-am
|
||||||
|
all-am: Makefile $(DATA)
|
||||||
|
all-redirect: all-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(resdatadir)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
mostlyclean-am: mostlyclean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
clean-am: clean-generic mostlyclean-am
|
||||||
|
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
distclean-am: distclean-generic clean-am
|
||||||
|
-rm -f libtool
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
.PHONY: uninstall-resdataDATA install-resdataDATA tags distdir info-am \
|
||||||
|
info dvi-am dvi check check-am installcheck-am installcheck \
|
||||||
|
install-exec-am install-exec install-data-am install-data install-am \
|
||||||
|
install uninstall-am uninstall all-redirect all-am all installdirs \
|
||||||
|
mostlyclean-generic distclean-generic clean-generic \
|
||||||
|
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
@@ -105,6 +105,8 @@ struct W_DraggingInfo {
|
|||||||
|
|
||||||
int protocolVersion;
|
int protocolVersion;
|
||||||
|
|
||||||
|
WMView *destView;
|
||||||
|
|
||||||
/* only valid if in the same app.. should be treated as internal data */
|
/* only valid if in the same app.. should be treated as internal data */
|
||||||
// WMView *destination;
|
// WMView *destination;
|
||||||
// WMView *source;
|
// WMView *source;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
WBNotFound = INT_MAX /* element was not found in bag */
|
WBNotFound = INT_MIN /* element was not found in bag */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -153,6 +153,7 @@ typedef struct W_BagFunctions {
|
|||||||
int (*putInBag)(WMBag *self, void *item);
|
int (*putInBag)(WMBag *self, void *item);
|
||||||
int (*insertInBag)(WMBag *self, int index, void *item);
|
int (*insertInBag)(WMBag *self, int index, void *item);
|
||||||
int (*removeFromBag)(WMBag *bag, void *item);
|
int (*removeFromBag)(WMBag *bag, void *item);
|
||||||
|
int (*eraseFromBag)(WMBag *bag, int index);
|
||||||
int (*deleteFromBag)(WMBag *bag, int index);
|
int (*deleteFromBag)(WMBag *bag, int index);
|
||||||
void *(*getFromBag)(WMBag *bag, int index);
|
void *(*getFromBag)(WMBag *bag, int index);
|
||||||
int (*firstInBag)(WMBag *bag, void *item);
|
int (*firstInBag)(WMBag *bag, void *item);
|
||||||
@@ -359,9 +360,16 @@ WMBag *WMCreateTreeBagWithDestructor(void (*destructor)(void*));
|
|||||||
|
|
||||||
#define WMPutInBag(bag, item) bag->func.putInBag(bag, item)
|
#define WMPutInBag(bag, item) bag->func.putInBag(bag, item)
|
||||||
|
|
||||||
|
/* insert will increment the index of elements after it by 1 */
|
||||||
#define WMInsertInBag(bag, index, item) bag->func.insertInBag(bag, index, item)
|
#define WMInsertInBag(bag, index, item) bag->func.insertInBag(bag, index, item)
|
||||||
|
|
||||||
/* this is slow */
|
/* this is slow */
|
||||||
|
/* erase will remove the element from the bag,
|
||||||
|
* but will keep the index of the other elements unchanged */
|
||||||
|
#define WMEraseFromBag(bag, index) bag->func.deleteFromBag(bag, index)
|
||||||
|
|
||||||
|
/* delete and remove will remove the elements and cause the elements
|
||||||
|
* after them to decrement their indexes by 1 */
|
||||||
#define WMRemoveFromBag(bag, item) bag->func.removeFromBag(bag, item)
|
#define WMRemoveFromBag(bag, item) bag->func.removeFromBag(bag, item)
|
||||||
|
|
||||||
#define WMDeleteFromBag(bag, index) bag->func.deleteFromBag(bag, index)
|
#define WMDeleteFromBag(bag, index) bag->func.deleteFromBag(bag, index)
|
||||||
@@ -405,6 +413,17 @@ WMBag *WMCreateTreeBagWithDestructor(void (*destructor)(void*));
|
|||||||
#define WMBagIndexForIterator(bag, ptr) bag->func.indexForIterator(bag, ptr)
|
#define WMBagIndexForIterator(bag, ptr) bag->func.indexForIterator(bag, ptr)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define WM_ITERATE_BAG(bag, var, i) \
|
||||||
|
for (var = WMBagFirst(bag, &(i)); (i) != NULL; \
|
||||||
|
var = WMBagNext(bag, &(i)))
|
||||||
|
|
||||||
|
#define WM_ETARETI_BAG(bag, var, i) \
|
||||||
|
for (var = WMBagLast(bag, &(i)); (i) != NULL; \
|
||||||
|
var = WMBagPrevious(bag, &(i)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* WMData handling */
|
/* WMData handling */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "WUtil.h"
|
#include "WUtil.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
typedef struct W_ArrayBag {
|
typedef struct W_ArrayBag {
|
||||||
void **items;
|
void **items;
|
||||||
@@ -50,6 +50,7 @@ static W_BagFunctions arrayFunctions = {
|
|||||||
insertInBag,
|
insertInBag,
|
||||||
removeFromBag,
|
removeFromBag,
|
||||||
deleteFromBag,
|
deleteFromBag,
|
||||||
|
deleteFromBag,
|
||||||
getFromBag,
|
getFromBag,
|
||||||
firstInBag,
|
firstInBag,
|
||||||
countInBag,
|
countInBag,
|
||||||
@@ -81,7 +82,7 @@ WMCreateArrayBagWithDestructor(int initialSize, void (*destructor)(void*))
|
|||||||
W_ArrayBag *array;
|
W_ArrayBag *array;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
assert(0&&"array bag is not working");
|
||||||
bag = wmalloc(sizeof(WMBag));
|
bag = wmalloc(sizeof(WMBag));
|
||||||
|
|
||||||
array = wmalloc(sizeof(W_ArrayBag));
|
array = wmalloc(sizeof(W_ArrayBag));
|
||||||
@@ -414,3 +415,5 @@ indexForIterator(WMBag *bag, WMBagIterator ptr)
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ static int appendBag(WMBag *self, WMBag *bag);
|
|||||||
static int putInBag(WMBag *self, void *item);
|
static int putInBag(WMBag *self, void *item);
|
||||||
static int insertInBag(WMBag *self, int index, void *item);
|
static int insertInBag(WMBag *self, int index, void *item);
|
||||||
static int removeFromBag(WMBag *bag, void *item);
|
static int removeFromBag(WMBag *bag, void *item);
|
||||||
|
static int eraseFromBag(WMBag *bag, int index);
|
||||||
static int deleteFromBag(WMBag *bag, int index);
|
static int deleteFromBag(WMBag *bag, int index);
|
||||||
static void *getFromBag(WMBag *bag, int index);
|
static void *getFromBag(WMBag *bag, int index);
|
||||||
static int countInBag(WMBag *bag, void *item);
|
static int countInBag(WMBag *bag, void *item);
|
||||||
@@ -58,6 +59,7 @@ static W_BagFunctions bagFunctions = {
|
|||||||
putInBag,
|
putInBag,
|
||||||
insertInBag,
|
insertInBag,
|
||||||
removeFromBag,
|
removeFromBag,
|
||||||
|
eraseFromBag,
|
||||||
deleteFromBag,
|
deleteFromBag,
|
||||||
getFromBag,
|
getFromBag,
|
||||||
firstInBag,
|
firstInBag,
|
||||||
@@ -514,7 +516,7 @@ static int insertInBag(WMBag *self, int index, void *item)
|
|||||||
|
|
||||||
rbTreeInsert(SELF, ptr);
|
rbTreeInsert(SELF, ptr);
|
||||||
|
|
||||||
while ((ptr = treeSuccessor(ptr, SELF->nil))) {
|
while ((ptr = treeSuccessor(ptr, SELF->nil)) != SELF->nil) {
|
||||||
ptr->index++;
|
ptr->index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,6 +532,32 @@ static int removeFromBag(WMBag *self, void *item)
|
|||||||
{
|
{
|
||||||
W_Node *ptr = treeFind(SELF->root, SELF->nil, item);
|
W_Node *ptr = treeFind(SELF->root, SELF->nil, item);
|
||||||
|
|
||||||
|
if (ptr != SELF->nil) {
|
||||||
|
W_Node *tmp;
|
||||||
|
|
||||||
|
SELF->count--;
|
||||||
|
|
||||||
|
tmp = treeSuccessor(ptr, SELF->nil);
|
||||||
|
while (tmp != SELF->nil) {
|
||||||
|
tmp->index--;
|
||||||
|
tmp = treeSuccessor(tmp, SELF->nil);
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = rbTreeDelete(SELF, ptr);
|
||||||
|
free(ptr);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int eraseFromBag(WMBag *self, int index)
|
||||||
|
{
|
||||||
|
W_Node *ptr = treeSearch(SELF->root, SELF->nil, index);
|
||||||
|
|
||||||
if (ptr != SELF->nil) {
|
if (ptr != SELF->nil) {
|
||||||
|
|
||||||
SELF->count--;
|
SELF->count--;
|
||||||
@@ -549,9 +577,16 @@ static int deleteFromBag(WMBag *self, int index)
|
|||||||
W_Node *ptr = treeSearch(SELF->root, SELF->nil, index);
|
W_Node *ptr = treeSearch(SELF->root, SELF->nil, index);
|
||||||
|
|
||||||
if (ptr != SELF->nil) {
|
if (ptr != SELF->nil) {
|
||||||
|
W_Node *tmp;
|
||||||
|
|
||||||
SELF->count--;
|
SELF->count--;
|
||||||
|
|
||||||
|
tmp = treeSuccessor(ptr, SELF->nil);
|
||||||
|
while (tmp != SELF->nil) {
|
||||||
|
tmp->index--;
|
||||||
|
tmp = treeSuccessor(tmp, SELF->nil);
|
||||||
|
}
|
||||||
|
|
||||||
ptr = rbTreeDelete(SELF, ptr);
|
ptr = rbTreeDelete(SELF, ptr);
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
|
||||||
@@ -566,9 +601,6 @@ static void *getFromBag(WMBag *self, int index)
|
|||||||
{
|
{
|
||||||
W_Node *node;
|
W_Node *node;
|
||||||
|
|
||||||
if (SELF->count>0)
|
|
||||||
assert(SELF->root != SELF->nil);
|
|
||||||
|
|
||||||
node = treeSearch(SELF->root, SELF->nil, index);
|
node = treeSearch(SELF->root, SELF->nil, index);
|
||||||
if (node != SELF->nil)
|
if (node != SELF->nil)
|
||||||
return node->data;
|
return node->data;
|
||||||
@@ -632,7 +664,19 @@ static void *replaceInBag(WMBag *self, int index, void *item)
|
|||||||
old = ptr->data;
|
old = ptr->data;
|
||||||
ptr->data = item;
|
ptr->data = item;
|
||||||
} else {
|
} else {
|
||||||
insertInBag(self, index, item);
|
W_Node *ptr;
|
||||||
|
|
||||||
|
ptr = wmalloc(sizeof(W_Node));
|
||||||
|
|
||||||
|
ptr->data = item;
|
||||||
|
ptr->index = index;
|
||||||
|
ptr->left = SELF->nil;
|
||||||
|
ptr->right = SELF->nil;
|
||||||
|
ptr->parent = SELF->nil;
|
||||||
|
|
||||||
|
rbTreeInsert(SELF, ptr);
|
||||||
|
|
||||||
|
SELF->count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
|
|||||||
@@ -353,8 +353,9 @@ WMCreateConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
|
|||||||
cPtr->wasNonBlocking = WMIsConnectionNonBlocking(cPtr);
|
cPtr->wasNonBlocking = WMIsConnectionNonBlocking(cPtr);
|
||||||
cPtr->isNonBlocking = cPtr->wasNonBlocking;
|
cPtr->isNonBlocking = cPtr->wasNonBlocking;
|
||||||
|
|
||||||
// some way to find out if it is connected, and binded. can't find
|
/* some way to find out if it is connected, and binded. can't find
|
||||||
// if it listens though!!!
|
if it listens though!!!
|
||||||
|
*/
|
||||||
|
|
||||||
size = sizeof(clientname);
|
size = sizeof(clientname);
|
||||||
n = getpeername(sock, (struct sockaddr*) &clientname, &size);
|
n = getpeername(sock, (struct sockaddr*) &clientname, &size);
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ findChildInWindow(Display *dpy, Window toplevel, int x, int y)
|
|||||||
|
|
||||||
XFree(children);
|
XFree(children);
|
||||||
|
|
||||||
if (!child)
|
if (child == None)
|
||||||
return toplevel;
|
return toplevel;
|
||||||
else
|
else
|
||||||
return child;
|
return child;
|
||||||
@@ -376,6 +376,16 @@ notifyDragEnter(WMScreen *scr, WMDraggingInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
translateCoordinates(WMScreen *scr, Window target, int fromX, int fromY,
|
||||||
|
int *x, int *y)
|
||||||
|
{
|
||||||
|
Window child;
|
||||||
|
|
||||||
|
XTranslateCoordinates(scr->display, scr->rootWin, target,
|
||||||
|
fromX, fromY, x, y, &child);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
updateDraggingInfo(WMScreen *scr, WMDraggingInfo *info,
|
updateDraggingInfo(WMScreen *scr, WMDraggingInfo *info,
|
||||||
@@ -912,10 +922,10 @@ getTypeList(Window window, XClientMessageEvent *event)
|
|||||||
types[i++] = event->data.l[3];
|
types[i++] = event->data.l[3];
|
||||||
if (event->data.l[4] != None)
|
if (event->data.l[4] != None)
|
||||||
types[i++] = event->data.l[4];
|
types[i++] = event->data.l[4];
|
||||||
types[i] = NULL;
|
types[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (types[0] == NULL) {
|
if (types[0] == 0) {
|
||||||
wwarning("received invalid drag & drop type list");
|
wwarning("received invalid drag & drop type list");
|
||||||
//XXX return;
|
//XXX return;
|
||||||
}
|
}
|
||||||
@@ -924,16 +934,16 @@ getTypeList(Window window, XClientMessageEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
||||||
WMView *view;
|
WMView *oldView = NULL, *newView = NULL;
|
||||||
int operation;
|
unsigned operation = 0;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
if (event->message_type == scr->xdndEnterAtom) {
|
if (event->message_type == scr->xdndEnterAtom) {
|
||||||
Atom *types;
|
|
||||||
Window foo, bar;
|
Window foo, bar;
|
||||||
int bla;
|
int bla;
|
||||||
unsigned ble;
|
unsigned ble;
|
||||||
@@ -952,38 +962,54 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info.protocolVersion = event->data.l[0] >> 24;
|
scr->dragInfo.protocolVersion = event->data.l[1] >> 24;
|
||||||
|
scr->dragInfo.sourceWindow = event->data.l[0];
|
||||||
info.sourceWindow = event->data.l[0];
|
scr->dragInfo.destinationWindow = event->window;
|
||||||
info.destinationWindow = event->window;
|
|
||||||
|
|
||||||
/* XXX */
|
/* XXX */
|
||||||
info.image = NULL;
|
scr->dragInfo.image = NULL;
|
||||||
|
|
||||||
XQueryPointer(scr->display, scr->rootWin, &foo, &bar,
|
XQueryPointer(scr->display, scr->rootWin, &foo, &bar,
|
||||||
&event->location.x, &event->location.y,
|
&scr->dragInfo.location.x, &scr->dragInfo.location.y,
|
||||||
&bla, &bla, &ble);
|
&bla, &bla, &ble);
|
||||||
|
|
||||||
view = findViewInToplevel(scr->display,
|
translateCoordinates(scr, scr->dragInfo.destinationWindow,
|
||||||
scr->dragInfo.destinationWindow,
|
scr->dragInfo.location.x,
|
||||||
scr->dragInfo.location.x,
|
scr->dragInfo.location.y, &x, &y);
|
||||||
scr->dragInfo.location.y);
|
|
||||||
|
|
||||||
|
newView = findViewInToplevel(scr->display,
|
||||||
|
scr->dragInfo.destinationWindow,
|
||||||
|
x, y);
|
||||||
|
|
||||||
if (IS_DROPPABLE(view)) {
|
if (IS_DROPPABLE(view)) {
|
||||||
|
|
||||||
|
scr->dragInfo.destinationView = view;
|
||||||
|
|
||||||
operation =
|
operation =
|
||||||
view->dragDestinationProcs->draggingEntered(view,
|
view->dragDestinationProcs->draggingEntered(view,
|
||||||
&scr->dragInfo);
|
&scr->dragInfo);
|
||||||
} else {
|
|
||||||
operation = 0;
|
|
||||||
}
|
}
|
||||||
|
if (operation > 0) {
|
||||||
|
Atom action;
|
||||||
|
|
||||||
|
switch (operation) {
|
||||||
|
default:
|
||||||
|
action = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendClientMessage(scr->display, scr->dragInfo.sourceWindow,
|
||||||
|
scr->xdndStatusAtom,
|
||||||
|
scr->dragInfo.destinationWindow,
|
||||||
|
1, 0, 0, action);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (event->message_type == scr->xdndPositionAtom
|
} else if (event->message_type == scr->xdndPositionAtom
|
||||||
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
||||||
unsigned operation = 0;
|
|
||||||
|
|
||||||
scr->dragInfo.location.x = event->data.l[2] >> 16;
|
scr->dragInfo.location.x = event->data.l[2] >> 16;
|
||||||
scr->dragInfo.location.y = event->data.l[2] 0xffff;
|
scr->dragInfo.location.y = event->data.l[2] & 0xffff;
|
||||||
|
|
||||||
if (scr->dragInfo.protocolVersion >= 1) {
|
if (scr->dragInfo.protocolVersion >= 1) {
|
||||||
scr->dragInfo.timestamp = event->data.l[3];
|
scr->dragInfo.timestamp = event->data.l[3];
|
||||||
@@ -993,24 +1019,35 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
|||||||
scr->dragInfo.sourceOperation = 0; /*XXX*/
|
scr->dragInfo.sourceOperation = 0; /*XXX*/
|
||||||
}
|
}
|
||||||
|
|
||||||
child = findChildInWindow(scr->display, scr->dragInfo.destinationWindow,
|
translateCoordinates(scr, scr->dragInfo.destinationWindow,
|
||||||
scr->dragInfo.location.x,
|
scr->dragInfo.location.x,
|
||||||
scr->dragInfo.location.y);
|
scr->dragInfo.location.y, &x, &y);
|
||||||
if (child != None) {
|
|
||||||
view = W_GetViewForXWindow(scr->display, child);
|
view = findViewInToplevel(scr->display,
|
||||||
} else {
|
scr->dragInfo.destinationWindow,
|
||||||
view = NULL;
|
x, y);
|
||||||
|
|
||||||
|
if (scr->dragInfo.destinationView != view) {
|
||||||
|
WMView *oldVIew = scr->dragInfo.destinationView;
|
||||||
|
|
||||||
|
oldView->dragDestinationProcs->draggingExited(oldView,
|
||||||
|
&scr->dragInfo);
|
||||||
|
|
||||||
|
scr->dragInfo.destinationView = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IS_DROPPABLE(view)) {
|
if (IS_DROPPABLE(view)) {
|
||||||
|
|
||||||
|
|
||||||
operation =
|
operation =
|
||||||
view->dragDestinationProcs->draggingUpdated(view,
|
view->dragDestinationProcs->draggingUpdated(view,
|
||||||
&scr->dragInfo);
|
&scr->dragInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation == 0) {
|
if (operation == 0) {
|
||||||
sendClientMessage(scr->display, scr->xdndStatusAtom,
|
sendClientMessage(scr->display, scr->dragInfo.sourceWindow,
|
||||||
scr->dragInfo.sourceWindow,
|
scr->xdndStatusAtom,
|
||||||
scr->dragInfo.destinationWindow,
|
scr->dragInfo.destinationWindow,
|
||||||
0, 0, 0, None);
|
0, 0, 0, None);
|
||||||
} else {
|
} else {
|
||||||
@@ -1018,25 +1055,30 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
|||||||
|
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
default:
|
default:
|
||||||
action =;
|
action = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendClientMessage(scr->display, scr->xdndStatusAtom,
|
sendClientMessage(scr->display, scr->dragInfo.sourceWindow,
|
||||||
scr->dragInfo.sourceWindow,
|
scr->xdndStatusAtom,
|
||||||
scr->dragInfo.destinationWindow,
|
scr->dragInfo.destinationWindow,
|
||||||
1, 0, 0, action);
|
1, 0, 0, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
puts("position");
|
// puts("position");
|
||||||
} else if (event->message_type == scr->xdndLeaveAtom
|
} else if (event->message_type == scr->xdndLeaveAtom
|
||||||
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
||||||
|
|
||||||
|
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
|
||||||
|
|
||||||
puts("leave");
|
puts("leave");
|
||||||
} else if (event->message_type == scr->xdndDropAtom
|
} else if (event->message_type == scr->xdndDropAtom
|
||||||
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
puts("drop");
|
puts("drop");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -431,13 +431,11 @@ void
|
|||||||
WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
||||||
WMNotification *notification, unsigned mask)
|
WMNotification *notification, unsigned mask)
|
||||||
{
|
{
|
||||||
int i;
|
WMBagIterator i;
|
||||||
WMNotification *tmp;
|
WMNotification *tmp;
|
||||||
|
|
||||||
if ((mask & WNCOnName) && (mask & WNCOnSender)) {
|
if ((mask & WNCOnName) && (mask & WNCOnSender)) {
|
||||||
for (i = 0; i < WMGetBagItemCount(queue->asapQueue); i++) {
|
WM_ITERATE_BAG(queue->asapQueue, tmp, i) {
|
||||||
tmp = WMGetFromBag(queue->asapQueue, i);
|
|
||||||
|
|
||||||
if (notification->object == tmp->object &&
|
if (notification->object == tmp->object &&
|
||||||
strcmp(notification->name, tmp->name) == 0) {
|
strcmp(notification->name, tmp->name) == 0) {
|
||||||
WMRemoveFromBag(queue->asapQueue, tmp);
|
WMRemoveFromBag(queue->asapQueue, tmp);
|
||||||
@@ -445,9 +443,7 @@ WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < WMGetBagItemCount(queue->idleQueue); i++) {
|
WM_ITERATE_BAG(queue->idleQueue, tmp, i) {
|
||||||
tmp = WMGetFromBag(queue->idleQueue, i);
|
|
||||||
|
|
||||||
if (notification->object == tmp->object &&
|
if (notification->object == tmp->object &&
|
||||||
strcmp(notification->name, tmp->name) == 0) {
|
strcmp(notification->name, tmp->name) == 0) {
|
||||||
WMRemoveFromBag(queue->idleQueue, tmp);
|
WMRemoveFromBag(queue->idleQueue, tmp);
|
||||||
@@ -456,18 +452,14 @@ WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mask & WNCOnName) {
|
} else if (mask & WNCOnName) {
|
||||||
for (i = 0; i < WMGetBagItemCount(queue->asapQueue); i++) {
|
WM_ITERATE_BAG(queue->asapQueue, tmp, i) {
|
||||||
tmp = WMGetFromBag(queue->asapQueue, i);
|
|
||||||
|
|
||||||
if (strcmp(notification->name, tmp->name) == 0) {
|
if (strcmp(notification->name, tmp->name) == 0) {
|
||||||
WMRemoveFromBag(queue->asapQueue, tmp);
|
WMRemoveFromBag(queue->asapQueue, tmp);
|
||||||
WMReleaseNotification(tmp);
|
WMReleaseNotification(tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < WMGetBagItemCount(queue->idleQueue); i++) {
|
WM_ITERATE_BAG(queue->idleQueue, tmp, i) {
|
||||||
tmp = WMGetFromBag(queue->idleQueue, i);
|
|
||||||
|
|
||||||
if (strcmp(notification->name, tmp->name) == 0) {
|
if (strcmp(notification->name, tmp->name) == 0) {
|
||||||
WMRemoveFromBag(queue->idleQueue, tmp);
|
WMRemoveFromBag(queue->idleQueue, tmp);
|
||||||
WMReleaseNotification(tmp);
|
WMReleaseNotification(tmp);
|
||||||
@@ -475,18 +467,14 @@ WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mask & WNCOnSender) {
|
} else if (mask & WNCOnSender) {
|
||||||
for (i = 0; i < WMGetBagItemCount(queue->asapQueue); i++) {
|
WM_ITERATE_BAG(queue->asapQueue, tmp, i) {
|
||||||
tmp = WMGetFromBag(queue->asapQueue, i);
|
|
||||||
|
|
||||||
if (notification->object == tmp->object) {
|
if (notification->object == tmp->object) {
|
||||||
WMRemoveFromBag(queue->asapQueue, tmp);
|
WMRemoveFromBag(queue->asapQueue, tmp);
|
||||||
WMReleaseNotification(tmp);
|
WMReleaseNotification(tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < WMGetBagItemCount(queue->idleQueue); i++) {
|
WM_ITERATE_BAG(queue->idleQueue, tmp, i) {
|
||||||
tmp = WMGetFromBag(queue->idleQueue, i);
|
|
||||||
|
|
||||||
if (notification->object == tmp->object) {
|
if (notification->object == tmp->object) {
|
||||||
WMRemoveFromBag(queue->idleQueue, tmp);
|
WMRemoveFromBag(queue->idleQueue, tmp);
|
||||||
WMReleaseNotification(tmp);
|
WMReleaseNotification(tmp);
|
||||||
|
|||||||
@@ -46,43 +46,18 @@ static void willResizeColorWell();
|
|||||||
|
|
||||||
W_ViewDelegate _ColorWellViewDelegate = {
|
W_ViewDelegate _ColorWellViewDelegate = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
willResizeColorWell
|
willResizeColorWell
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static unsigned draggingSourceOperation(WMView *self, Bool local);
|
#if 0
|
||||||
static void beganDragImage(WMView *self, WMPixmap *image, WMPoint point);
|
static WMDragSourceProcs dragProcs = {
|
||||||
static void endedDragImage(WMView *self, WMPixmap *image, WMPoint point,
|
|
||||||
Bool deposited);
|
|
||||||
|
|
||||||
|
|
||||||
static WMDragSourceProcs _DragSourceProcs = {
|
|
||||||
draggingSourceOperation,
|
|
||||||
beganDragImage,
|
|
||||||
endedDragImage,
|
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static unsigned draggingEntered(WMView *self, WMDraggingInfo *info);
|
|
||||||
static unsigned draggingUpdated(WMView *self, WMDraggingInfo *info);
|
|
||||||
static void draggingExited(WMView *self, WMDraggingInfo *info);
|
|
||||||
static Bool prepareForDragOperation(WMView *self, WMDraggingInfo *info);
|
|
||||||
static Bool performDragOperation(WMView *self, WMDraggingInfo *info);
|
|
||||||
static void concludeDragOperation(WMView *self, WMDraggingInfo *info);
|
|
||||||
|
|
||||||
static WMDragDestinationProcs _DragDestinationProcs = {
|
|
||||||
draggingEntered,
|
|
||||||
draggingUpdated,
|
|
||||||
draggingExited,
|
|
||||||
prepareForDragOperation,
|
|
||||||
performDragOperation,
|
|
||||||
concludeDragOperation
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_WIDTH 60
|
#define DEFAULT_WIDTH 60
|
||||||
#define DEFAULT_HEIGHT 30
|
#define DEFAULT_HEIGHT 30
|
||||||
@@ -194,15 +169,6 @@ WMCreateColorWell(WMWidget *parent)
|
|||||||
WMAddNotificationObserver(colorChangedObserver, cPtr,
|
WMAddNotificationObserver(colorChangedObserver, cPtr,
|
||||||
WMColorPanelColorChangedNotification, NULL);
|
WMColorPanelColorChangedNotification, NULL);
|
||||||
|
|
||||||
// WMSetViewDragSourceProcs(cPtr->view, &_DragSourceProcs);
|
|
||||||
// WMSetViewDragDestinationProcs(cPtr->view, &_DragDestinationProcs);
|
|
||||||
|
|
||||||
{
|
|
||||||
char *types[2] = {"application/X-color", NULL};
|
|
||||||
|
|
||||||
//WMRegisterViewForDraggedTypes(cPtr->view, types);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cPtr;
|
return cPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,32 +276,6 @@ handleEvents(XEvent *event, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
draggingSourceOperation(WMView *self, Bool local)
|
|
||||||
{
|
|
||||||
puts("DRAG SOURCE");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
beganDragImage(WMView *self, WMPixmap *image, WMPoint point)
|
|
||||||
{
|
|
||||||
puts("BEGAN DRAG");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
endedDragImage(WMView *self, WMPixmap *image, WMPoint point, Bool deposited)
|
|
||||||
{
|
|
||||||
if (deposited)
|
|
||||||
puts("ENDED DRAG SUCCESS");
|
|
||||||
else
|
|
||||||
puts("ENDED DRAG CANCEL");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static WMPixmap*
|
static WMPixmap*
|
||||||
makeDragPixmap(WMColorWell *cPtr)
|
makeDragPixmap(WMColorWell *cPtr)
|
||||||
{
|
{
|
||||||
@@ -352,6 +292,221 @@ makeDragPixmap(WMColorWell *cPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
slideView(WMView *view, int srcX, int srcY, int dstX, int dstY)
|
||||||
|
{
|
||||||
|
double x, y, dx, dy;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
srcX -= 8;
|
||||||
|
srcY -= 8;
|
||||||
|
dstX -= 8;
|
||||||
|
dstY -= 8;
|
||||||
|
|
||||||
|
x = srcX;
|
||||||
|
y = srcY;
|
||||||
|
|
||||||
|
dx = (double)(dstX-srcX)/20.0;
|
||||||
|
dy = (double)(dstY-srcY)/20.0;
|
||||||
|
|
||||||
|
for (i = 0; i < 20; i++) {
|
||||||
|
W_MoveView(view, x, y);
|
||||||
|
XFlush(view->screen->display);
|
||||||
|
|
||||||
|
x += dx;
|
||||||
|
y += dy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static Window
|
||||||
|
findChildInWindow(Display *dpy, Window toplevel, int x, int y)
|
||||||
|
{
|
||||||
|
Window foo, bar;
|
||||||
|
Window *children;
|
||||||
|
unsigned nchildren;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!XQueryTree(dpy, toplevel, &foo, &bar,
|
||||||
|
&children, &nchildren) || children == NULL) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* first window that contains the point is the one */
|
||||||
|
for (i = nchildren-1; i >= 0; i--) {
|
||||||
|
XWindowAttributes attr;
|
||||||
|
|
||||||
|
if (XGetWindowAttributes(dpy, children[i], &attr)
|
||||||
|
&& attr.map_state == IsViewable
|
||||||
|
&& x >= attr.x && y >= attr.y
|
||||||
|
&& x < attr.x + attr.width && y < attr.y + attr.height) {
|
||||||
|
Window child;
|
||||||
|
|
||||||
|
child = findChildInWindow(dpy, children[i],
|
||||||
|
x - attr.x, y - attr.y);
|
||||||
|
|
||||||
|
XFree(children);
|
||||||
|
|
||||||
|
if (!child)
|
||||||
|
return toplevel;
|
||||||
|
else
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(children);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Window
|
||||||
|
findWindowUnderDragPointer(WMScreen *scr, int x, int y, Window iconWindow)
|
||||||
|
{
|
||||||
|
Window foo, bar;
|
||||||
|
Window *children;
|
||||||
|
unsigned nchildren;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!XQueryTree(scr->display, scr->rootWin, &foo, &bar,
|
||||||
|
&children, &nchildren) || children == NULL) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* try to find the window below the iconWindow by traversing
|
||||||
|
* the whole window list */
|
||||||
|
|
||||||
|
/* first find the position of the iconWindow */
|
||||||
|
for (i = nchildren-1; i >= 0; i--) {
|
||||||
|
if (children[i] == iconWindow) {
|
||||||
|
i--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i <= 0) {
|
||||||
|
XFree(children);
|
||||||
|
return scr->rootWin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* first window that contains the point is the one */
|
||||||
|
for (; i >= 0; i--) {
|
||||||
|
XWindowAttributes attr;
|
||||||
|
Window child;
|
||||||
|
|
||||||
|
if (XGetWindowAttributes(scr->display, children[i], &attr)
|
||||||
|
&& attr.map_state == IsViewable
|
||||||
|
&& x >= attr.x && y >= attr.y
|
||||||
|
&& x < attr.x + attr.width && y < attr.y + attr.height
|
||||||
|
&& (child = findChildInWindow(scr->display, children[i],
|
||||||
|
x - attr.x, y - attr.y))) {
|
||||||
|
XFree(children);
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(children);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
dragColor(ColorWell *cPtr, XEvent *event, WMPixmap *image)
|
||||||
|
{
|
||||||
|
WMView *dragView;
|
||||||
|
WMScreen *scr = cPtr->view->screen;
|
||||||
|
Display *dpy = scr->display;
|
||||||
|
XColor black = {0, 0,0,0, DoRed|DoGreen|DoBlue};
|
||||||
|
XColor green = {0x0045b045, 0x4500,0xb000,0x4500, DoRed|DoGreen|DoBlue};
|
||||||
|
XColor back = {0, 0xffff,0xffff,0xffff, DoRed|DoGreen|DoBlue};
|
||||||
|
Bool done = False;
|
||||||
|
WMColorWell *activeWell = NULL;
|
||||||
|
|
||||||
|
dragView = W_CreateTopView(scr);
|
||||||
|
|
||||||
|
W_ResizeView(dragView, 16, 16);
|
||||||
|
dragView->attribFlags |= CWOverrideRedirect | CWSaveUnder;
|
||||||
|
dragView->attribs.event_mask = StructureNotifyMask;
|
||||||
|
dragView->attribs.override_redirect = True;
|
||||||
|
dragView->attribs.save_under = True;
|
||||||
|
|
||||||
|
W_MoveView(dragView, event->xmotion.x_root-8, event->xmotion.y_root-8);
|
||||||
|
|
||||||
|
W_RealizeView(dragView);
|
||||||
|
|
||||||
|
W_MapView(dragView);
|
||||||
|
|
||||||
|
XSetWindowBackgroundPixmap(dpy, dragView->window, WMGetPixmapXID(image));
|
||||||
|
XClearWindow(dpy, dragView->window);
|
||||||
|
|
||||||
|
|
||||||
|
XGrabPointer(dpy, scr->rootWin, True,
|
||||||
|
ButtonMotionMask|ButtonReleaseMask,
|
||||||
|
GrabModeSync, GrabModeAsync,
|
||||||
|
scr->rootWin, scr->defaultCursor, CurrentTime);
|
||||||
|
|
||||||
|
while (!done) {
|
||||||
|
XEvent ev;
|
||||||
|
WMView *view;
|
||||||
|
Window win;
|
||||||
|
|
||||||
|
XAllowEvents(dpy, SyncPointer, CurrentTime);
|
||||||
|
WMNextEvent(dpy, &ev);
|
||||||
|
|
||||||
|
switch (ev.type) {
|
||||||
|
case ButtonRelease:
|
||||||
|
if (activeWell != NULL) {
|
||||||
|
WMSetColorWellColor(activeWell, cPtr->color);
|
||||||
|
WMPostNotificationName(WMColorWellDidChangeNotification,
|
||||||
|
activeWell, NULL);
|
||||||
|
} else {
|
||||||
|
slideView(dragView, ev.xbutton.x_root, ev.xbutton.y_root,
|
||||||
|
event->xmotion.x_root, event->xmotion.y_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
done = True;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionNotify:
|
||||||
|
while (XCheckTypedEvent(dpy, MotionNotify, &ev)) ;
|
||||||
|
|
||||||
|
W_MoveView(dragView, ev.xmotion.x_root-8, ev.xmotion.y_root-8);
|
||||||
|
|
||||||
|
win = findWindowUnderDragPointer(scr, ev.xmotion.x_root,
|
||||||
|
ev.xmotion.y_root,
|
||||||
|
dragView->window);
|
||||||
|
|
||||||
|
if (win != None && win != scr->rootWin) {
|
||||||
|
view = W_GetViewForXWindow(dpy, win);
|
||||||
|
} else {
|
||||||
|
view = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (view && view->self && W_CLASS(view->self) == WC_ColorWell
|
||||||
|
&& view->self != activeWell && view->self != cPtr) {
|
||||||
|
|
||||||
|
activeWell = view->self;
|
||||||
|
XRecolorCursor(dpy, scr->defaultCursor, &green, &back);
|
||||||
|
|
||||||
|
} else if (!view || view->self != activeWell) {
|
||||||
|
|
||||||
|
XRecolorCursor(dpy, scr->defaultCursor, &black, &back);
|
||||||
|
activeWell = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
WMHandleEvent(&ev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
|
XRecolorCursor(dpy, scr->defaultCursor, &black, &back);
|
||||||
|
|
||||||
|
W_DestroyView(dragView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handleDragEvents(XEvent *event, void *data)
|
handleDragEvents(XEvent *event, void *data)
|
||||||
{
|
{
|
||||||
@@ -371,17 +526,17 @@ handleDragEvents(XEvent *event, void *data)
|
|||||||
|| abs(cPtr->ipoint.y - event->xmotion.y) > 4) {
|
|| abs(cPtr->ipoint.y - event->xmotion.y) > 4) {
|
||||||
WMSize offs;
|
WMSize offs;
|
||||||
WMPixmap *pixmap;
|
WMPixmap *pixmap;
|
||||||
char *types[2] = {"application/X-color", NULL};
|
|
||||||
|
|
||||||
offs.width = 2;
|
offs.width = 2;
|
||||||
offs.height = 2;
|
offs.height = 2;
|
||||||
pixmap = makeDragPixmap(cPtr);
|
pixmap = makeDragPixmap(cPtr);
|
||||||
/*
|
|
||||||
WMDragImageFromView(cPtr->view, pixmap, types,
|
/*
|
||||||
wmkpoint(event->xmotion.x_root,
|
WMDragImageFromView(cPtr->view, pixmap, cPtr->view->pos,
|
||||||
event->xmotion.y_root),
|
offs, event, True);
|
||||||
offs, event, True);
|
* */
|
||||||
*/
|
|
||||||
|
dragColor(cPtr, event, pixmap);
|
||||||
|
|
||||||
WMReleasePixmap(pixmap);
|
WMReleasePixmap(pixmap);
|
||||||
}
|
}
|
||||||
@@ -430,76 +585,3 @@ destroyColorWell(ColorWell *cPtr)
|
|||||||
wfree(cPtr);
|
wfree(cPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
draggingEntered(WMView *self, WMDraggingInfo *info)
|
|
||||||
{
|
|
||||||
WMPoint point = WMGetViewScreenPosition(self);
|
|
||||||
|
|
||||||
printf("%i %i || %i %i %i %i\n", info->location.x, info->location.y,
|
|
||||||
point.x, point.y, W_VIEW_WIDTH(self), W_VIEW_HEIGHT(self));
|
|
||||||
|
|
||||||
if (info->location.x >= point.x
|
|
||||||
&& info->location.y >= point.y
|
|
||||||
&& info->location.x < point.x + W_VIEW_WIDTH(self)
|
|
||||||
&& info->location.y < point.y + W_VIEW_HEIGHT(self)) {
|
|
||||||
/* self */
|
|
||||||
puts("ENTERED 0");
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
puts("ENTERED 1");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
draggingUpdated(WMView *self, WMDraggingInfo *info)
|
|
||||||
{
|
|
||||||
|
|
||||||
WMPoint point = WMGetViewScreenPosition(self);
|
|
||||||
|
|
||||||
puts("UPDATED");
|
|
||||||
if (info->location.x >= point.x
|
|
||||||
&& info->location.y >= point.y
|
|
||||||
&& info->location.x < point.x + W_VIEW_WIDTH(self)
|
|
||||||
&& info->location.y < point.y + W_VIEW_WIDTH(self)) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
draggingExited(WMView *self, WMDraggingInfo *info)
|
|
||||||
{
|
|
||||||
puts("EXITED");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
prepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
|
||||||
{
|
|
||||||
puts("PREPARING");
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
performDragOperation(WMView *self, WMDraggingInfo *info)
|
|
||||||
{
|
|
||||||
WMData *data;
|
|
||||||
|
|
||||||
// data = WMGetDroppedData(self);
|
|
||||||
puts("DROPPED");
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
concludeDragOperation(WMView *self, WMDraggingInfo *info)
|
|
||||||
{
|
|
||||||
puts("FINISHED");
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ WMDeleteIdleHandler(WMHandlerID handlerID)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pos = WMGetFirstInBag(idleHandler, handler);
|
pos = WMGetFirstInBag(idleHandler, handler);
|
||||||
if (pos >= 0) {
|
if (pos != WBNotFound) {
|
||||||
wfree(handler);
|
wfree(handler);
|
||||||
WMDeleteFromBag(idleHandler, pos);
|
WMDeleteFromBag(idleHandler, pos);
|
||||||
}
|
}
|
||||||
@@ -291,7 +291,7 @@ WMDeleteInputHandler(WMHandlerID handlerID)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pos = WMGetFirstInBag(inputHandler, handler);
|
pos = WMGetFirstInBag(inputHandler, handler);
|
||||||
if (pos >= 0) {
|
if (pos != WBNotFound) {
|
||||||
wfree(handler);
|
wfree(handler);
|
||||||
WMDeleteFromBag(inputHandler, pos);
|
WMDeleteFromBag(inputHandler, pos);
|
||||||
}
|
}
|
||||||
@@ -588,7 +588,7 @@ WMHandleEvent(XEvent *event)
|
|||||||
|
|
||||||
} else if (event->type == ClientMessage) {
|
} else if (event->type == ClientMessage) {
|
||||||
|
|
||||||
//W_HandleDNDClientMessage(toplevel, &event->xclient);
|
W_HandleDNDClientMessage(toplevel, &event->xclient);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if it's a key event, redispatch it to the focused control */
|
/* if it's a key event, redispatch it to the focused control */
|
||||||
@@ -786,7 +786,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
|||||||
|
|
||||||
handler = WMGetFromBag(handlerCopy, i);
|
handler = WMGetFromBag(handlerCopy, i);
|
||||||
/* check if the handler still exist or was removed by a callback */
|
/* check if the handler still exist or was removed by a callback */
|
||||||
if (WMGetFirstInBag(inputHandler, handler)<0)
|
if (WMGetFirstInBag(inputHandler, handler) == WBNotFound)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
@@ -891,7 +891,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
|||||||
|
|
||||||
handler = WMGetFromBag(handlerCopy, i);
|
handler = WMGetFromBag(handlerCopy, i);
|
||||||
/* check if the handler still exist or was removed by a callback */
|
/* check if the handler still exist or was removed by a callback */
|
||||||
if (WMGetFirstInBag(inputHandler, handler)<0)
|
if (WMGetFirstInBag(inputHandler, handler) == WBNotFound)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
|
|||||||
@@ -104,19 +104,17 @@ closestListItem(WMList *list, char *text, Bool exact)
|
|||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
WMBag *items = WMGetListItems(list);
|
WMBag *items = WMGetListItems(list);
|
||||||
int i;
|
WMBagIterator i;
|
||||||
int len = strlen(text);
|
int len = strlen(text);
|
||||||
|
|
||||||
if (len==0)
|
if (len==0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(items); i++) {
|
WM_ITERATE_BAG(items, item, i) {
|
||||||
item = WMGetFromBag(items, i);
|
|
||||||
|
|
||||||
if (strlen(item->text) >= len &&
|
if (strlen(item->text) >= len &&
|
||||||
((exact && strcmp(item->text, text)==0) ||
|
((exact && strcmp(item->text, text)==0) ||
|
||||||
(!exact && strncmp(item->text, text, len)==0))) {
|
(!exact && strncmp(item->text, text, len)==0))) {
|
||||||
return i;
|
return WMBagIndexForIterator(items, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -534,14 +534,14 @@ static void
|
|||||||
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
||||||
{
|
{
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
int i;
|
WMBagIterator i;
|
||||||
|
|
||||||
if (family->typefaces) {
|
if (family->typefaces) {
|
||||||
for (i = 0; i < WMGetBagItemCount(family->typefaces); i++) {
|
for (face = WMBagFirst(family->typefaces, &i);
|
||||||
|
face != NULL;
|
||||||
|
face = WMBagNext(family->typefaces, &i)) {
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
face = WMGetFromBag(family->typefaces, i);
|
|
||||||
|
|
||||||
if (strcmp(face->weight, fontFields[WEIGHT]) != 0) {
|
if (strcmp(face->weight, fontFields[WEIGHT]) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -584,7 +584,7 @@ addTypefaceToFamily(Family *family, char fontFields[NUM_FIELDS][256])
|
|||||||
static void
|
static void
|
||||||
addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
||||||
{
|
{
|
||||||
int i;
|
WMBagIterator i;
|
||||||
Family *fam;
|
Family *fam;
|
||||||
WMBag *family;
|
WMBag *family;
|
||||||
|
|
||||||
@@ -593,11 +593,11 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
|||||||
|
|
||||||
if (family) {
|
if (family) {
|
||||||
/* look for same encoding/registry and foundry */
|
/* look for same encoding/registry and foundry */
|
||||||
for (i = 0; i < WMGetBagItemCount(family); i++) {
|
for (fam = WMBagFirst(family, &i);
|
||||||
|
fam != NULL;
|
||||||
|
fam = WMBagNext(family, &i)) {
|
||||||
int enc, reg, found;
|
int enc, reg, found;
|
||||||
|
|
||||||
fam = WMGetFromBag(family, i);
|
|
||||||
|
|
||||||
enc = (strcmp(fam->encoding, fontFields[ENCODING]) == 0);
|
enc = (strcmp(fam->encoding, fontFields[ENCODING]) == 0);
|
||||||
reg = (strcmp(fam->registry, fontFields[REGISTRY]) == 0);
|
reg = (strcmp(fam->registry, fontFields[REGISTRY]) == 0);
|
||||||
found = (strcmp(fam->foundry, fontFields[FOUNDRY]) == 0);
|
found = (strcmp(fam->foundry, fontFields[FOUNDRY]) == 0);
|
||||||
@@ -608,11 +608,11 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* look for same encoding/registry */
|
/* look for same encoding/registry */
|
||||||
for (i = 0; i < WMGetBagItemCount(family); i++) {
|
for (fam = WMBagFirst(family, &i);
|
||||||
|
fam != NULL;
|
||||||
|
fam = WMBagNext(family, &i)) {
|
||||||
int enc, reg;
|
int enc, reg;
|
||||||
|
|
||||||
fam = WMGetFromBag(family, i);
|
|
||||||
|
|
||||||
enc = (strcmp(fam->encoding, fontFields[ENCODING]) == 0);
|
enc = (strcmp(fam->encoding, fontFields[ENCODING]) == 0);
|
||||||
reg = (strcmp(fam->registry, fontFields[REGISTRY]) == 0);
|
reg = (strcmp(fam->registry, fontFields[REGISTRY]) == 0);
|
||||||
|
|
||||||
@@ -636,11 +636,11 @@ addFontToFamily(WMHashTable *families, char fontFields[NUM_FIELDS][256])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* look for same foundry */
|
/* look for same foundry */
|
||||||
for (i = 0; i < WMGetBagItemCount(family); i++) {
|
for (fam = WMBagFirst(family, &i);
|
||||||
|
fam != NULL;
|
||||||
|
fam = WMBagNext(family, &i)) {
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
fam = WMGetFromBag(family, i);
|
|
||||||
|
|
||||||
found = (strcmp(fam->foundry, fontFields[FOUNDRY]) == 0);
|
found = (strcmp(fam->foundry, fontFields[FOUNDRY]) == 0);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
@@ -740,13 +740,14 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
|
|||||||
enumer = WMEnumerateHashTable(families);
|
enumer = WMEnumerateHashTable(families);
|
||||||
|
|
||||||
while ((bag = WMNextHashEnumeratorItem(&enumer))) {
|
while ((bag = WMNextHashEnumeratorItem(&enumer))) {
|
||||||
int i;
|
WMBagIterator i;
|
||||||
Family *fam;
|
Family *fam;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
for (fam = WMBagFirst(bag, &i);
|
||||||
fam = WMGetFromBag(bag, i);
|
fam != NULL;
|
||||||
|
fam = WMBagNext(bag, &i)) {
|
||||||
|
|
||||||
strcpy(buffer, fam->name);
|
strcpy(buffer, fam->name);
|
||||||
|
|
||||||
@@ -834,7 +835,7 @@ familyClick(WMWidget *w, void *data)
|
|||||||
Family *family;
|
Family *family;
|
||||||
FontPanel *panel = (FontPanel*)data;
|
FontPanel *panel = (FontPanel*)data;
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
int i;
|
WMBagIterator i;
|
||||||
/* current typeface and size */
|
/* current typeface and size */
|
||||||
char *oface = NULL;
|
char *oface = NULL;
|
||||||
char *osize = NULL;
|
char *osize = NULL;
|
||||||
@@ -854,13 +855,14 @@ familyClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
WMClearList(panel->typLs);
|
WMClearList(panel->typLs);
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(family->typefaces); i++) {
|
|
||||||
|
for (face = WMBagFirst(family->typefaces, &i);
|
||||||
|
face != NULL;
|
||||||
|
face = WMBagNext(family->typefaces, &i)) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int top=0;
|
int top=0;
|
||||||
WMListItem *fitem;
|
WMListItem *fitem;
|
||||||
|
|
||||||
face = WMGetFromBag(family->typefaces, i);
|
|
||||||
|
|
||||||
if (strcmp(face->weight, "medium") == 0) {
|
if (strcmp(face->weight, "medium") == 0) {
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -931,11 +933,12 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
FontPanel *panel = (FontPanel*)data;
|
FontPanel *panel = (FontPanel*)data;
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
int i;
|
WMBagIterator i;
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
||||||
char *osize = NULL;
|
char *osize = NULL;
|
||||||
int sizei = -1;
|
int sizei = -1;
|
||||||
|
int size;
|
||||||
|
|
||||||
osize = WMGetTextFieldText(panel->sizT);
|
osize = WMGetTextFieldText(panel->sizT);
|
||||||
|
|
||||||
@@ -945,10 +948,9 @@ typefaceClick(WMWidget *w, void *data)
|
|||||||
|
|
||||||
WMClearList(panel->sizLs);
|
WMClearList(panel->sizLs);
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(face->sizes); i++) {
|
for (size = (int)WMBagFirst(face->sizes, &i);
|
||||||
int size;
|
i != NULL;
|
||||||
|
size = (int)WMBagNext(face->sizes, &i)) {
|
||||||
size = (int)WMGetFromBag(face->sizes, i);
|
|
||||||
|
|
||||||
if (size != 0) {
|
if (size != 0) {
|
||||||
sprintf(buffer, "%i", size);
|
sprintf(buffer, "%i", size);
|
||||||
|
|||||||
@@ -171,9 +171,9 @@ WMInsertListItem(WMList *lPtr, int row, char *text)
|
|||||||
lPtr->selectedItem++;
|
lPtr->selectedItem++;
|
||||||
|
|
||||||
if (row < 0)
|
if (row < 0)
|
||||||
row = WMGetBagItemCount(lPtr->items);
|
WMPutInBag(lPtr->items, item);
|
||||||
|
else
|
||||||
WMInsertInBag(lPtr->items, row, item);
|
WMInsertInBag(lPtr->items, row, item);
|
||||||
|
|
||||||
/* update the scroller when idle, so that we don't waste time
|
/* update the scroller when idle, so that we don't waste time
|
||||||
* updating it when another item is going to be added later */
|
* updating it when another item is going to be added later */
|
||||||
@@ -589,18 +589,17 @@ int
|
|||||||
WMFindRowOfListItemWithTitle(WMList *lPtr, char *title)
|
WMFindRowOfListItemWithTitle(WMList *lPtr, char *title)
|
||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
int i;
|
WMBagIterator i;
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
|
||||||
for (i=0; i < WMGetBagItemCount(lPtr->items); i++) {
|
WM_ITERATE_BAG(lPtr->items, item, i) {
|
||||||
item = WMGetFromBag(lPtr->items, i);
|
|
||||||
if (strcmp(item->text, title)==0) {
|
if (strcmp(item->text, title)==0) {
|
||||||
ok = 1;
|
ok = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok ? i : -1;
|
return ok ? WMBagIndexForIterator(lPtr->items, i) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -781,14 +780,13 @@ static void
|
|||||||
destroyList(List *lPtr)
|
destroyList(List *lPtr)
|
||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
int i;
|
WMBagIterator i;
|
||||||
|
|
||||||
if (lPtr->idleID)
|
if (lPtr->idleID)
|
||||||
WMDeleteIdleHandler(lPtr->idleID);
|
WMDeleteIdleHandler(lPtr->idleID);
|
||||||
lPtr->idleID = NULL;
|
lPtr->idleID = NULL;
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(lPtr->items); i++) {
|
WM_ITERATE_BAG(lPtr->items, item, i) {
|
||||||
item = WMGetFromBag(lPtr->items, i);
|
|
||||||
wfree(item->text);
|
wfree(item->text);
|
||||||
wfree(item);
|
wfree(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
item = WMGetFromBag(bPtr->items, index);
|
item = WMGetFromBag(bPtr->items, index);
|
||||||
if (!item)
|
if (item == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return WMGetMenuItemTitle(item);
|
return WMGetMenuItemTitle(item);
|
||||||
@@ -464,8 +464,9 @@ makeMenuPixmap(PopUpButton *bPtr)
|
|||||||
{
|
{
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
W_Screen *scr = bPtr->view->screen;
|
W_Screen *scr = bPtr->view->screen;
|
||||||
int i;
|
WMMenuItem *item;
|
||||||
int yo;
|
WMBagIterator iter;
|
||||||
|
int yo, i;
|
||||||
int width, height, itemHeight;
|
int width, height, itemHeight;
|
||||||
|
|
||||||
itemHeight = bPtr->view->size.height;
|
itemHeight = bPtr->view->size.height;
|
||||||
@@ -479,12 +480,11 @@ makeMenuPixmap(PopUpButton *bPtr)
|
|||||||
XFillRectangle(scr->display, pixmap, WMColorGC(scr->gray), 0, 0,
|
XFillRectangle(scr->display, pixmap, WMColorGC(scr->gray), 0, 0,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(bPtr->items); i++) {
|
i = 0;
|
||||||
|
WM_ITERATE_BAG(bPtr->items, item, iter) {
|
||||||
GC gc;
|
GC gc;
|
||||||
WMMenuItem *item;
|
|
||||||
char *text;
|
char *text;
|
||||||
|
|
||||||
item = (WMMenuItem*)WMGetFromBag(bPtr->items, i);
|
|
||||||
text = WMGetMenuItemTitle(item);
|
text = WMGetMenuItemTitle(item);
|
||||||
|
|
||||||
W_DrawRelief(scr, pixmap, 0, i*itemHeight, width, itemHeight,
|
W_DrawRelief(scr, pixmap, 0, i*itemHeight, width, itemHeight,
|
||||||
@@ -506,6 +506,8 @@ makeMenuPixmap(PopUpButton *bPtr)
|
|||||||
width-scr->popUpIndicator->width-4,
|
width-scr->popUpIndicator->width-4,
|
||||||
i*itemHeight+(itemHeight-scr->popUpIndicator->height)/2);
|
i*itemHeight+(itemHeight-scr->popUpIndicator->height)/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pixmap;
|
return pixmap;
|
||||||
@@ -758,14 +760,13 @@ static void
|
|||||||
destroyPopUpButton(PopUpButton *bPtr)
|
destroyPopUpButton(PopUpButton *bPtr)
|
||||||
{
|
{
|
||||||
WMMenuItem *item;
|
WMMenuItem *item;
|
||||||
int i;
|
WMBagIterator i;
|
||||||
|
|
||||||
if (bPtr->timer) {
|
if (bPtr->timer) {
|
||||||
WMDeleteTimerHandler(bPtr->timer);
|
WMDeleteTimerHandler(bPtr->timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < WMGetBagItemCount(bPtr->items); i++) {
|
WM_ITERATE_BAG(bPtr->items, item, i) {
|
||||||
item = WMGetFromBag(bPtr->items, i);
|
|
||||||
WMDestroyMenuItem(item);
|
WMDestroyMenuItem(item);
|
||||||
}
|
}
|
||||||
WMFreeBag(bPtr->items);
|
WMFreeBag(bPtr->items);
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ typedef struct W_TabView {
|
|||||||
|
|
||||||
unsigned tabbed:1;
|
unsigned tabbed:1;
|
||||||
unsigned dontFitAll:1;
|
unsigned dontFitAll:1;
|
||||||
|
|
||||||
unsigned leftDown:1; // scrolling button state
|
|
||||||
unsigned rightDown:1;
|
|
||||||
} flags;
|
} flags;
|
||||||
} TabView;
|
} TabView;
|
||||||
|
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ destroyView(W_View *view)
|
|||||||
|
|
||||||
W_CleanUpEvents(view);
|
W_CleanUpEvents(view);
|
||||||
|
|
||||||
// WMUnregisterViewDraggedTypes(view);
|
WMUnregisterViewDraggedTypes(view);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (view->dragSourceProcs)
|
if (view->dragSourceProcs)
|
||||||
|
|||||||
Reference in New Issue
Block a user