aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-05-11 13:09:36 +1000
committerinmarket <andrewh@inmarket.com.au>2014-05-11 13:09:36 +1000
commitbdbe78a8daed85e6d794deb1f840c1ec3c3b02f1 (patch)
tree8bc8883ad298e6a8d2a8ac6a57696b41c2fdb816 /src/gwin
parenta49b095b945756f1c32d9cfe3795a0d86151d6aa (diff)
downloaduGFX-bdbe78a8daed85e6d794deb1f840c1ec3c3b02f1.tar.gz
uGFX-bdbe78a8daed85e6d794deb1f840c1ec3c3b02f1.tar.bz2
uGFX-bdbe78a8daed85e6d794deb1f840c1ec3c3b02f1.zip
frame fixes
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/frame.c20
-rw-r--r--src/gwin/gwin.c2
-rw-r--r--src/gwin/gwm.c6
3 files changed, 15 insertions, 13 deletions
diff --git a/src/gwin/frame.c b/src/gwin/frame.c
index ca37953a..16e16987 100644
--- a/src/gwin/frame.c
+++ b/src/gwin/frame.c
@@ -100,26 +100,26 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
if (!(fo = (GFrameObject *)_gcontainerCreate(g, &fo->gc, pInit, &frameVMT)))
return 0;
- fo->btnClose = NULL;
- fo->btnMin = NULL;
- fo->btnMax = NULL;
+ fo->btnClose = 0;
+ fo->btnMin = 0;
+ fo->btnMax = 0;
/* Buttons require a border */
- if ((flags & GWIN_FRAME_CLOSE_BTN || flags & GWIN_FRAME_MINMAX_BTN) && !(flags & GWIN_FRAME_BORDER))
+ if ((flags & (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN)))
flags |= GWIN_FRAME_BORDER;
/* apply flags */
fo->gc.g.flags |= flags;
/* create and initialize the listener if any button is present. */
- if ((flags & GWIN_FRAME_CLOSE_BTN) || (flags & GWIN_FRAME_MINMAX_BTN)) {
+ if ((flags & (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN))) {
geventListenerInit(&fo->gl);
gwinAttachListener(&fo->gl);
geventRegisterCallback(&fo->gl, _callbackBtn, (GHandle)fo);
}
/* create close button if necessary */
- if (flags & GWIN_FRAME_CLOSE_BTN) {
+ if ((flags & GWIN_FRAME_CLOSE_BTN)) {
GWidgetInit wi;
gwinWidgetClearInit(&wi);
@@ -131,11 +131,11 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
wi.text = "X";
- fo->btnClose = gwinButtonCreate(NULL, &wi);
+ fo->btnClose = gwinGButtonCreate(g, 0, &wi);
}
/* create minimize and maximize buttons if necessary */
- if (flags & GWIN_FRAME_MINMAX_BTN) {
+ if ((flags & GWIN_FRAME_MINMAX_BTN)) {
GWidgetInit wi;
gwinWidgetClearInit(&wi);
@@ -147,14 +147,14 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
wi.text = "O";
- fo->btnMin = gwinButtonCreate(NULL, &wi);
+ fo->btnMin = gwinGButtonCreate(g, 0, &wi);
wi.g.x = (flags & GWIN_FRAME_CLOSE_BTN) ? fo->gc.g.width - 3*BORDER_X - 3*BUTTON_X : fo->gc.g.width - BORDER_X - BUTTON_X;
wi.g.y = (BORDER_Y - BUTTON_Y) / 2;
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
wi.text = "_";
- fo->btnMax = gwinButtonCreate(NULL, &wi);
+ fo->btnMax = gwinGButtonCreate(g, 0, &wi);
}
gwinSetVisible(&fo->gc.g, pInit->g.show);
diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c
index 563b7abe..dfcb8d4c 100644
--- a/src/gwin/gwin.c
+++ b/src/gwin/gwin.c
@@ -148,7 +148,7 @@ GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit
#if GWIN_NEED_CONTAINERS
if (pInit->parent) {
- if (!(pInit->parent->flags & GWIN_FLG_CONTAINER) || pgw->display != pgw->parent->display) {
+ if (!(pInit->parent->flags & GWIN_FLG_CONTAINER) || pgw->display != pInit->parent->display) {
if ((pgw->flags & GWIN_FLG_DYNAMIC))
gfxFree(pgw);
return 0;
diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c
index c5e0f956..7611bc9d 100644
--- a/src/gwin/gwm.c
+++ b/src/gwin/gwm.c
@@ -217,7 +217,8 @@ static void WM_Size(GHandle gh, coord_t w, coord_t h) {
// Clip to the container
if (gh->x+w > gh->parent->x+gh->parent->width) w = gh->parent->x + gh->parent->width - gh->x;
if (gh->y+h > gh->parent->y+gh->parent->height) h = gh->parent->y + gh->parent->height - gh->y;
- ((const gcontainerVMT *)gh->parent->vmt)->AdjustSize(gh, &w, &h);
+ if (((const gcontainerVMT *)gh->parent->vmt)->AdjustSize)
+ ((const gcontainerVMT *)gh->parent->vmt)->AdjustSize(gh, &w, &h);
}
#endif
@@ -251,7 +252,8 @@ static void WM_Move(GHandle gh, coord_t x, coord_t y) {
if (y > gh->parent->height-gh->height) y = gh->parent->height-gh->height;
// Allow the parent to adjust it
- ((const gcontainerVMT *)gh->parent->vmt)->AdjustPosition(gh, &x, &y);
+ if (((const gcontainerVMT *)gh->parent->vmt)->AdjustPosition)
+ ((const gcontainerVMT *)gh->parent->vmt)->AdjustPosition(gh, &x, &y);
// Convert to absolute position
x += gh->parent->x;