Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
e742718c
Commit
e742718c
authored
Apr 28, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle button press/release
first version, to be finished
parent
2df85ee8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
2 deletions
+83
-2
common/utils/T/tracer/gui/container.c
common/utils/T/tracer/gui/container.c
+38
-0
common/utils/T/tracer/gui/gui_defs.h
common/utils/T/tracer/gui/gui_defs.h
+2
-0
common/utils/T/tracer/gui/text_list.c
common/utils/T/tracer/gui/text_list.c
+8
-0
common/utils/T/tracer/gui/toplevel_window.c
common/utils/T/tracer/gui/toplevel_window.c
+12
-0
common/utils/T/tracer/gui/widget.c
common/utils/T/tracer/gui/widget.c
+9
-0
common/utils/T/tracer/gui/x.c
common/utils/T/tracer/gui/x.c
+14
-2
No files found.
common/utils/T/tracer/gui/container.c
View file @
e742718c
...
@@ -164,6 +164,42 @@ printf("HINTS container horizontal %p\n", _w);
...
@@ -164,6 +164,42 @@ printf("HINTS container horizontal %p\n", _w);
*
height
=
this
->
hint_height
;
*
height
=
this
->
hint_height
;
}
}
static
void
horizontal_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
printf
(
"BUTTON container horizontal %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
container_widget
*
this
=
_this
;
struct
widget_list
*
l
;
l
=
this
->
common
.
children
;
while
(
l
)
{
if
(
l
->
item
->
x
<=
x
&&
x
<
l
->
item
->
x
+
l
->
item
->
width
)
{
l
->
item
->
button
(
g
,
l
->
item
,
x
-
l
->
item
->
x
,
y
,
button
,
up
);
break
;
}
l
=
l
->
next
;
}
}
static
void
vertical_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
printf
(
"BUTTON container vertical %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
container_widget
*
this
=
_this
;
struct
widget_list
*
l
;
l
=
this
->
common
.
children
;
while
(
l
)
{
if
(
l
->
item
->
y
<=
y
&&
y
<
l
->
item
->
y
+
l
->
item
->
height
)
{
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
-
l
->
item
->
y
,
button
,
up
);
break
;
}
l
=
l
->
next
;
}
}
static
void
paint
(
gui
*
_gui
,
widget
*
_this
)
static
void
paint
(
gui
*
_gui
,
widget
*
_this
)
{
{
printf
(
"PAINT container
\n
"
);
printf
(
"PAINT container
\n
"
);
...
@@ -197,9 +233,11 @@ widget *new_container(gui *_gui, int vertical)
...
@@ -197,9 +233,11 @@ widget *new_container(gui *_gui, int vertical)
if
(
vertical
)
{
if
(
vertical
)
{
w
->
common
.
allocate
=
vertical_allocate
;
w
->
common
.
allocate
=
vertical_allocate
;
w
->
common
.
hints
=
vertical_hints
;
w
->
common
.
hints
=
vertical_hints
;
w
->
common
.
button
=
vertical_button
;
}
else
{
}
else
{
w
->
common
.
allocate
=
horizontal_allocate
;
w
->
common
.
allocate
=
horizontal_allocate
;
w
->
common
.
hints
=
horizontal_hints
;
w
->
common
.
hints
=
horizontal_hints
;
w
->
common
.
button
=
horizontal_button
;
}
}
gunlock
(
g
);
gunlock
(
g
);
...
...
common/utils/T/tracer/gui/gui_defs.h
View file @
e742718c
...
@@ -47,6 +47,8 @@ struct widget {
...
@@ -47,6 +47,8 @@ struct widget {
void
(
*
hints
)(
gui
*
g
,
widget
*
this
,
int
*
width
,
int
*
height
);
void
(
*
hints
)(
gui
*
g
,
widget
*
this
,
int
*
width
,
int
*
height
);
void
(
*
paint
)(
gui
*
g
,
widget
*
this
);
void
(
*
paint
)(
gui
*
g
,
widget
*
this
);
void
(
*
clear
)(
gui
*
g
,
widget
*
this
);
void
(
*
clear
)(
gui
*
g
,
widget
*
this
);
/* user input */
void
(
*
button
)(
gui
*
g
,
widget
*
this
,
int
x
,
int
y
,
int
button
,
int
up
);
};
};
struct
widget_list
{
struct
widget_list
{
...
...
common/utils/T/tracer/gui/text_list.c
View file @
e742718c
...
@@ -44,6 +44,12 @@ static void allocate(
...
@@ -44,6 +44,12 @@ static void allocate(
printf
(
"ALLOCATE text_list %p xywh %d %d %d %d nlines %d
\n
"
,
this
,
x
,
y
,
width
,
height
,
this
->
allocated_nlines
);
printf
(
"ALLOCATE text_list %p xywh %d %d %d %d nlines %d
\n
"
,
this
,
x
,
y
,
width
,
height
,
this
->
allocated_nlines
);
}
}
static
void
button
(
gui
*
g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
struct
text_list_widget
*
this
=
_this
;
printf
(
"BUTTON test_list %p xy %d %d button %d up %d
\n
"
,
this
,
x
,
y
,
button
,
up
);
}
widget
*
new_text_list
(
gui
*
_gui
,
int
width
,
int
nlines
,
int
bgcol
)
widget
*
new_text_list
(
gui
*
_gui
,
int
width
,
int
nlines
,
int
bgcol
)
{
{
struct
gui
*
g
=
_gui
;
struct
gui
*
g
=
_gui
;
...
@@ -63,6 +69,8 @@ widget *new_text_list(gui *_gui, int width, int nlines, int bgcol)
...
@@ -63,6 +69,8 @@ widget *new_text_list(gui *_gui, int width, int nlines, int bgcol)
w
->
common
.
hints
=
hints
;
w
->
common
.
hints
=
hints
;
w
->
common
.
allocate
=
allocate
;
w
->
common
.
allocate
=
allocate
;
w
->
common
.
button
=
button
;
gunlock
(
g
);
gunlock
(
g
);
return
w
;
return
w
;
...
...
common/utils/T/tracer/gui/toplevel_window.c
View file @
e742718c
...
@@ -55,6 +55,16 @@ printf("PAINT toplevel_window (%d %d)\n", this->common.width, this->common.heigh
...
@@ -55,6 +55,16 @@ printf("PAINT toplevel_window (%d %d)\n", this->common.width, this->common.heigh
g
->
xwin
=
NULL
;
/* TODO: remove? it's just in case */
g
->
xwin
=
NULL
;
/* TODO: remove? it's just in case */
}
}
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
struct
gui
*
g
=
_g
;
struct
toplevel_window_widget
*
this
=
_this
;
g
->
xwin
=
this
->
x
;
this
->
common
.
children
->
item
->
button
(
_g
,
this
->
common
.
children
->
item
,
x
,
y
,
button
,
up
);
g
->
xwin
=
NULL
;
/* TODO: remove? it's just in case */
}
/**********************************************************************/
/**********************************************************************/
/* creation */
/* creation */
/**********************************************************************/
/**********************************************************************/
...
@@ -78,6 +88,8 @@ widget *new_toplevel_window(gui *_gui, int width, int height, char *title)
...
@@ -78,6 +88,8 @@ widget *new_toplevel_window(gui *_gui, int width, int height, char *title)
w
->
common
.
allocate
=
allocate
;
w
->
common
.
allocate
=
allocate
;
w
->
common
.
paint
=
paint
;
w
->
common
.
paint
=
paint
;
w
->
common
.
button
=
button
;
gunlock
(
g
);
gunlock
(
g
);
return
w
;
return
w
;
...
...
common/utils/T/tracer/gui/widget.c
View file @
e742718c
...
@@ -13,6 +13,8 @@ static void default_allocate(
...
@@ -13,6 +13,8 @@ static void default_allocate(
static
void
default_add_child
(
static
void
default_add_child
(
gui
*
_gui
,
widget
*
_this
,
widget
*
child
,
int
position
);
gui
*
_gui
,
widget
*
_this
,
widget
*
child
,
int
position
);
static
void
default_hints
(
gui
*
g
,
widget
*
this
,
int
*
width
,
int
*
height
);
static
void
default_hints
(
gui
*
g
,
widget
*
this
,
int
*
width
,
int
*
height
);
static
void
default_button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
);
static
void
toplevel_list_append
(
struct
gui
*
g
,
struct
widget
*
e
)
static
void
toplevel_list_append
(
struct
gui
*
g
,
struct
widget
*
e
)
{
{
...
@@ -47,6 +49,7 @@ widget *new_widget(struct gui *g, enum widget_type type, int size)
...
@@ -47,6 +49,7 @@ widget *new_widget(struct gui *g, enum widget_type type, int size)
ret
->
add_child
=
default_add_child
;
ret
->
add_child
=
default_add_child
;
ret
->
allocate
=
default_allocate
;
ret
->
allocate
=
default_allocate
;
ret
->
hints
=
default_hints
;
ret
->
hints
=
default_hints
;
ret
->
button
=
default_button
;
/* there is no default paint, on purpose */
/* there is no default paint, on purpose */
ret
->
type
=
type
;
ret
->
type
=
type
;
...
@@ -159,6 +162,12 @@ static void default_hints(gui *g, widget *this, int *width, int *height)
...
@@ -159,6 +162,12 @@ static void default_hints(gui *g, widget *this, int *width, int *height)
*
height
=
1
;
*
height
=
1
;
}
}
static
void
default_button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
{
/* nothing */
}
/*************************************************************************/
/*************************************************************************/
/* utils functions */
/* utils functions */
/*************************************************************************/
/*************************************************************************/
...
...
common/utils/T/tracer/gui/x.c
View file @
e742718c
...
@@ -158,7 +158,7 @@ printf("XEV %d\n", ev.type);
...
@@ -158,7 +158,7 @@ printf("XEV %d\n", ev.type);
}
}
break
;
break
;
case
ConfigureNotify
:
case
ConfigureNotify
:
if
((
w
=
find_x_window
(
g
,
ev
.
x
expos
e
.
window
))
!=
NULL
)
{
if
((
w
=
find_x_window
(
g
,
ev
.
x
configur
e
.
window
))
!=
NULL
)
{
struct
x_window
*
xw
=
w
->
x
;
struct
x_window
*
xw
=
w
->
x
;
xw
->
resize
=
1
;
xw
->
resize
=
1
;
xw
->
new_width
=
ev
.
xconfigure
.
width
;
xw
->
new_width
=
ev
.
xconfigure
.
width
;
...
@@ -168,9 +168,21 @@ printf("XEV %d\n", ev.type);
...
@@ -168,9 +168,21 @@ printf("XEV %d\n", ev.type);
printf
(
"ConfigureNotify %d %d
\n
"
,
ev
.
xconfigure
.
width
,
ev
.
xconfigure
.
height
);
printf
(
"ConfigureNotify %d %d
\n
"
,
ev
.
xconfigure
.
width
,
ev
.
xconfigure
.
height
);
}
}
break
;
break
;
case
ButtonPress
:
if
((
w
=
find_x_window
(
g
,
ev
.
xbutton
.
window
))
!=
NULL
)
{
w
->
common
.
button
(
g
,
w
,
ev
.
xbutton
.
x
,
ev
.
xbutton
.
y
,
ev
.
xbutton
.
button
,
0
);
}
break
;
case
ButtonRelease
:
if
((
w
=
find_x_window
(
g
,
ev
.
xbutton
.
window
))
!=
NULL
)
{
w
->
common
.
button
(
g
,
w
,
ev
.
xbutton
.
x
,
ev
.
xbutton
.
y
,
ev
.
xbutton
.
button
,
1
);
}
break
;
#if 0
#if 0
case MapNotify:
case MapNotify:
if ((w = find_x_window(g, ev.x
expose
.window)) != NULL) {
if ((w = find_x_window(g, ev.x
map
.window)) != NULL) {
struct x_window *xw = w->x;
struct x_window *xw = w->x;
xw->repaint = 1;
xw->repaint = 1;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment