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
常顺宇
OpenXG-RAN
Commits
4511fe77
Commit
4511fe77
authored
May 19, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add key modifiers to button event
parent
262ab709
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
19 deletions
+39
-19
common/utils/T/tracer/gui/container.c
common/utils/T/tracer/gui/container.c
+4
-4
common/utils/T/tracer/gui/gui.h
common/utils/T/tracer/gui/gui.h
+5
-0
common/utils/T/tracer/gui/gui_defs.h
common/utils/T/tracer/gui/gui_defs.h
+2
-1
common/utils/T/tracer/gui/label.c
common/utils/T/tracer/gui/label.c
+4
-2
common/utils/T/tracer/gui/positioner.c
common/utils/T/tracer/gui/positioner.c
+3
-2
common/utils/T/tracer/gui/textlist.c
common/utils/T/tracer/gui/textlist.c
+2
-1
common/utils/T/tracer/gui/timeline.c
common/utils/T/tracer/gui/timeline.c
+2
-1
common/utils/T/tracer/gui/toplevel_window.c
common/utils/T/tracer/gui/toplevel_window.c
+3
-2
common/utils/T/tracer/gui/widget.c
common/utils/T/tracer/gui/widget.c
+4
-4
common/utils/T/tracer/gui/x.c
common/utils/T/tracer/gui/x.c
+10
-2
No files found.
common/utils/T/tracer/gui/container.c
View file @
4511fe77
...
@@ -227,7 +227,7 @@ static void horizontal_hints(gui *_gui, widget *_w, int *width, int *height)
...
@@ -227,7 +227,7 @@ static void horizontal_hints(gui *_gui, widget *_w, int *width, int *height)
}
}
static
void
horizontal_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
static
void
horizontal_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
int
key_modifiers
,
int
button
,
int
up
)
{
{
LOGD
(
"BUTTON container horizontal %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON container horizontal %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
gui
*
g
=
_g
;
...
@@ -237,7 +237,7 @@ static void horizontal_button(gui *_g, widget *_this, int x, int y,
...
@@ -237,7 +237,7 @@ static void horizontal_button(gui *_g, widget *_this, int x, int y,
l
=
this
->
common
.
children
;
l
=
this
->
common
.
children
;
while
(
l
)
{
while
(
l
)
{
if
(
l
->
item
->
x
<=
x
&&
x
<
l
->
item
->
x
+
l
->
item
->
width
)
{
if
(
l
->
item
->
x
<=
x
&&
x
<
l
->
item
->
x
+
l
->
item
->
width
)
{
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
button
,
up
);
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
key_modifiers
,
button
,
up
);
break
;
break
;
}
}
l
=
l
->
next
;
l
=
l
->
next
;
...
@@ -245,7 +245,7 @@ static void horizontal_button(gui *_g, widget *_this, int x, int y,
...
@@ -245,7 +245,7 @@ static void horizontal_button(gui *_g, widget *_this, int x, int y,
}
}
static
void
vertical_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
static
void
vertical_button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
int
key_modifiers
,
int
button
,
int
up
)
{
{
LOGD
(
"BUTTON container vertical %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON container vertical %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
gui
*
g
=
_g
;
...
@@ -255,7 +255,7 @@ static void vertical_button(gui *_g, widget *_this, int x, int y,
...
@@ -255,7 +255,7 @@ static void vertical_button(gui *_g, widget *_this, int x, int y,
l
=
this
->
common
.
children
;
l
=
this
->
common
.
children
;
while
(
l
)
{
while
(
l
)
{
if
(
l
->
item
->
y
<=
y
&&
y
<
l
->
item
->
y
+
l
->
item
->
height
)
{
if
(
l
->
item
->
y
<=
y
&&
y
<
l
->
item
->
y
+
l
->
item
->
height
)
{
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
button
,
up
);
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
key_modifiers
,
button
,
up
);
break
;
break
;
}
}
l
=
l
->
next
;
l
=
l
->
next
;
...
...
common/utils/T/tracer/gui/gui.h
View file @
4511fe77
...
@@ -12,6 +12,11 @@ typedef void widget;
...
@@ -12,6 +12,11 @@ typedef void widget;
#define BACKGROUND_COLOR 0
#define BACKGROUND_COLOR 0
#define FOREGROUND_COLOR 1
#define FOREGROUND_COLOR 1
/* key modifiers */
#define KEY_SHIFT (1<<0)
#define KEY_CONTROL (1<<1)
#define KEY_ALT (1<<2)
gui
*
gui_init
(
void
);
gui
*
gui_init
(
void
);
/* position = -1 to put at the end */
/* position = -1 to put at the end */
...
...
common/utils/T/tracer/gui/gui_defs.h
View file @
4511fe77
...
@@ -53,7 +53,8 @@ struct widget {
...
@@ -53,7 +53,8 @@ struct widget {
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 */
/* user input */
void
(
*
button
)(
gui
*
g
,
widget
*
this
,
int
x
,
int
y
,
int
button
,
int
up
);
void
(
*
button
)(
gui
*
g
,
widget
*
this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
);
};
};
struct
widget_list
{
struct
widget_list
{
...
...
common/utils/T/tracer/gui/label.c
View file @
4511fe77
...
@@ -45,7 +45,8 @@ widget *new_label(gui *_gui, const char *label)
...
@@ -45,7 +45,8 @@ widget *new_label(gui *_gui, const char *label)
return
w
;
return
w
;
}
}
static
void
button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
static
void
button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
)
{
{
LOGD
(
"BUTTON label %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON label %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
...
@@ -55,7 +56,8 @@ static void button(gui *gui, widget *_this, int x, int y, int button, int up)
...
@@ -55,7 +56,8 @@ static void button(gui *gui, widget *_this, int x, int y, int button, int up)
}
}
/* we could use default_button, but it's in widget.c, so, well... */
/* we could use default_button, but it's in widget.c, so, well... */
static
void
no_button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
static
void
no_button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
)
{
{
/* do nothing */
/* do nothing */
}
}
...
...
common/utils/T/tracer/gui/positioner.c
View file @
4511fe77
...
@@ -50,14 +50,15 @@ static void hints(gui *_gui, widget *_w, int *width, int *height)
...
@@ -50,14 +50,15 @@ static void hints(gui *_gui, widget *_w, int *width, int *height)
else
{
*
width
=
*
height
=
1
;
}
else
{
*
width
=
*
height
=
1
;
}
}
}
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
)
{
{
LOGD
(
"BUTTON positioner %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
LOGD
(
"BUTTON positioner %p xy %d %d button %d up %d
\n
"
,
_this
,
x
,
y
,
button
,
up
);
struct
gui
*
g
=
_g
;
struct
gui
*
g
=
_g
;
struct
positioner_widget
*
this
=
_this
;
struct
positioner_widget
*
this
=
_this
;
struct
widget_list
*
l
=
this
->
common
.
children
;
struct
widget_list
*
l
=
this
->
common
.
children
;
if
(
l
!=
NULL
)
if
(
l
!=
NULL
)
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
button
,
up
);
l
->
item
->
button
(
g
,
l
->
item
,
x
,
y
,
key_modifiers
,
button
,
up
);
}
}
static
void
paint
(
gui
*
_gui
,
widget
*
_this
)
static
void
paint
(
gui
*
_gui
,
widget
*
_this
)
...
...
common/utils/T/tracer/gui/textlist.c
View file @
4511fe77
...
@@ -44,7 +44,8 @@ static void allocate(
...
@@ -44,7 +44,8 @@ static void allocate(
LOGD
(
"ALLOCATE textlist %p xywh %d %d %d %d nlines %d
\n
"
,
this
,
x
,
y
,
width
,
height
,
this
->
allocated_nlines
);
LOGD
(
"ALLOCATE textlist %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
)
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
)
{
{
struct
gui
*
g
=
_g
;
struct
gui
*
g
=
_g
;
struct
textlist_widget
*
this
=
_this
;
struct
textlist_widget
*
this
=
_this
;
...
...
common/utils/T/tracer/gui/timeline.c
View file @
4511fe77
...
@@ -54,7 +54,8 @@ static void allocate(gui *_gui, widget *_this,
...
@@ -54,7 +54,8 @@ static void allocate(gui *_gui, widget *_this,
gui_notify
(
_gui
,
"resize"
,
_this
,
&
width
);
gui_notify
(
_gui
,
"resize"
,
_this
,
&
width
);
}
}
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
button
,
int
up
)
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
)
{
{
struct
gui
*
g
=
_g
;
struct
gui
*
g
=
_g
;
struct
timeline_widget
*
this
=
_this
;
struct
timeline_widget
*
this
=
_this
;
...
...
common/utils/T/tracer/gui/toplevel_window.c
View file @
4511fe77
...
@@ -55,13 +55,14 @@ static void paint(gui *_gui, widget *_this)
...
@@ -55,13 +55,14 @@ static void paint(gui *_gui, widget *_this)
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
)
static
void
button
(
gui
*
_g
,
widget
*
_this
,
int
x
,
int
y
,
int
key_modifiers
,
int
button
,
int
up
)
{
{
struct
gui
*
g
=
_g
;
struct
gui
*
g
=
_g
;
struct
toplevel_window_widget
*
this
=
_this
;
struct
toplevel_window_widget
*
this
=
_this
;
g
->
xwin
=
this
->
x
;
g
->
xwin
=
this
->
x
;
this
->
common
.
children
->
item
->
button
(
_g
,
this
->
common
.
children
->
item
,
this
->
common
.
children
->
item
->
button
(
_g
,
this
->
common
.
children
->
item
,
x
,
y
,
button
,
up
);
x
,
y
,
key_modifiers
,
button
,
up
);
g
->
xwin
=
NULL
;
/* TODO: remove? it's just in case */
g
->
xwin
=
NULL
;
/* TODO: remove? it's just in case */
}
}
...
...
common/utils/T/tracer/gui/widget.c
View file @
4511fe77
...
@@ -14,8 +14,8 @@ static void default_add_child(
...
@@ -14,8 +14,8 @@ static void default_add_child(
gui
*
_gui
,
widget
*
_this
,
widget
*
child
,
int
position
);
gui
*
_gui
,
widget
*
_this
,
widget
*
child
,
int
position
);
static
void
default_del_child
(
gui
*
_gui
,
widget
*
_this
,
widget
*
child
);
static
void
default_del_child
(
gui
*
_gui
,
widget
*
_this
,
widget
*
child
);
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
,
static
void
default_button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
up
);
int
key_modifiers
,
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
)
{
{
...
@@ -228,8 +228,8 @@ static void default_hints(gui *g, widget *this, int *width, int *height)
...
@@ -228,8 +228,8 @@ 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
,
static
void
default_button
(
gui
*
gui
,
widget
*
_this
,
int
x
,
int
y
,
int
up
)
int
key_modifiers
,
int
button
,
int
up
)
{
{
/* nothing */
/* nothing */
}
}
...
...
common/utils/T/tracer/gui/x.c
View file @
4511fe77
...
@@ -171,13 +171,21 @@ void x_events(gui *_gui)
...
@@ -171,13 +171,21 @@ void x_events(gui *_gui)
break
;
break
;
case
ButtonPress
:
case
ButtonPress
:
if
((
w
=
find_x_window
(
g
,
ev
.
xbutton
.
window
))
!=
NULL
)
{
if
((
w
=
find_x_window
(
g
,
ev
.
xbutton
.
window
))
!=
NULL
)
{
w
->
common
.
button
(
g
,
w
,
ev
.
xbutton
.
x
,
ev
.
xbutton
.
y
,
int
key_modifiers
=
0
;
if
(
ev
.
xbutton
.
state
&
ShiftMask
)
key_modifiers
|=
KEY_SHIFT
;
if
(
ev
.
xbutton
.
state
&
Mod1Mask
)
key_modifiers
|=
KEY_ALT
;
if
(
ev
.
xbutton
.
state
&
ControlMask
)
key_modifiers
|=
KEY_CONTROL
;
w
->
common
.
button
(
g
,
w
,
ev
.
xbutton
.
x
,
ev
.
xbutton
.
y
,
key_modifiers
,
ev
.
xbutton
.
button
,
0
);
ev
.
xbutton
.
button
,
0
);
}
}
break
;
break
;
case
ButtonRelease
:
case
ButtonRelease
:
if
((
w
=
find_x_window
(
g
,
ev
.
xbutton
.
window
))
!=
NULL
)
{
if
((
w
=
find_x_window
(
g
,
ev
.
xbutton
.
window
))
!=
NULL
)
{
w
->
common
.
button
(
g
,
w
,
ev
.
xbutton
.
x
,
ev
.
xbutton
.
y
,
int
key_modifiers
=
0
;
if
(
ev
.
xbutton
.
state
&
ShiftMask
)
key_modifiers
|=
KEY_SHIFT
;
if
(
ev
.
xbutton
.
state
&
Mod1Mask
)
key_modifiers
|=
KEY_ALT
;
if
(
ev
.
xbutton
.
state
&
ControlMask
)
key_modifiers
|=
KEY_CONTROL
;
w
->
common
.
button
(
g
,
w
,
ev
.
xbutton
.
x
,
ev
.
xbutton
.
y
,
key_modifiers
,
ev
.
xbutton
.
button
,
1
);
ev
.
xbutton
.
button
,
1
);
}
}
break
;
break
;
...
...
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