Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
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
Esteban Blanc
proview
Commits
ff76b4ba
Commit
ff76b4ba
authored
Sep 01, 2020
by
Claes
Committed by
Esteban Blanc
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rt_xtt file, SetValue action added
parent
042a862c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
27 deletions
+83
-27
xtt/exe/rt_xtt/gtk/rt_xtt_gtk.cpp
xtt/exe/rt_xtt/gtk/rt_xtt_gtk.cpp
+20
-7
xtt/exe/rt_xtt/gtk/rt_xtt_gtk.h
xtt/exe/rt_xtt/gtk/rt_xtt_gtk.h
+5
-4
xtt/exe/rt_xtt/src/rt_xtt_main.h
xtt/exe/rt_xtt/src/rt_xtt_main.h
+1
-0
xtt/exe/rt_xtt/src/xtt_main.cpp
xtt/exe/rt_xtt/src/xtt_main.cpp
+29
-0
xtt/lib/xtt/gtk/xtt_hotkey_gtk.cpp
xtt/lib/xtt/gtk/xtt_hotkey_gtk.cpp
+21
-10
xtt/lib/xtt/gtk/xtt_hotkey_gtk.h
xtt/lib/xtt/gtk/xtt_hotkey_gtk.h
+7
-6
No files found.
xtt/exe/rt_xtt/gtk/rt_xtt_gtk.cpp
View file @
ff76b4ba
...
@@ -62,26 +62,38 @@
...
@@ -62,26 +62,38 @@
#include "rt_xtt_gtk.h"
#include "rt_xtt_gtk.h"
void
XttGtk
::
hotkey_Command
(
char
*
arg
,
void
*
userdata
)
void
XttGtk
::
hotkey_Command
(
char
*
arg
1
,
char
*
arg2
,
void
*
userdata
)
{
{
char
arg
[
2000
];
Xtt
*
xtt
=
(
Xtt
*
)
userdata
;
Xtt
*
xtt
=
(
Xtt
*
)
userdata
;
strcpy
(
arg
,
arg1
);
if
(
strcmp
(
arg2
,
""
)
!=
0
)
{
strcat
(
arg
,
","
);
strcat
(
arg
,
arg2
);
}
xtt
->
hotkey_activate_command
(
arg
);
xtt
->
hotkey_activate_command
(
arg
);
}
}
void
XttGtk
::
hotkey_ToggleDig
(
char
*
arg
,
void
*
userdata
)
void
XttGtk
::
hotkey_ToggleDig
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
)
{
hotkey_activate_toggledig
(
arg1
);
}
void
XttGtk
::
hotkey_SetDig
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
)
{
{
hotkey_activate_
toggledig
(
arg
);
hotkey_activate_
setdig
(
arg1
);
}
}
void
XttGtk
::
hotkey_
SetDig
(
char
*
arg
,
void
*
userdata
)
void
XttGtk
::
hotkey_
ResetDig
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
)
{
{
hotkey_activate_
setdig
(
arg
);
hotkey_activate_
resetdig
(
arg1
);
}
}
void
XttGtk
::
hotkey_
ResetDig
(
char
*
arg
,
void
*
userdata
)
void
XttGtk
::
hotkey_
SetValue
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
)
{
{
hotkey_activate_
resetdig
(
arg
);
hotkey_activate_
setvalue
(
arg1
,
arg2
);
}
}
static
GdkFilterReturn
xtt_hotkey_filter
(
static
GdkFilterReturn
xtt_hotkey_filter
(
...
@@ -1173,6 +1185,7 @@ XttGtk::XttGtk(int argc, char* argv[], int* return_sts)
...
@@ -1173,6 +1185,7 @@ XttGtk::XttGtk(int argc, char* argv[], int* return_sts)
hotkey
->
register_action
(
"SetDig"
,
hotkey_SetDig
,
this
);
hotkey
->
register_action
(
"SetDig"
,
hotkey_SetDig
,
this
);
hotkey
->
register_action
(
"ResetDig"
,
hotkey_ResetDig
,
this
);
hotkey
->
register_action
(
"ResetDig"
,
hotkey_ResetDig
,
this
);
hotkey
->
register_action
(
"ToggleDig"
,
hotkey_ToggleDig
,
this
);
hotkey
->
register_action
(
"ToggleDig"
,
hotkey_ToggleDig
,
this
);
hotkey
->
register_action
(
"SetValue"
,
hotkey_SetValue
,
this
);
hotkey
->
register_action
(
"Command"
,
hotkey_Command
,
this
);
hotkey
->
register_action
(
"Command"
,
hotkey_Command
,
this
);
int
n_screens
=
gdk_display_get_n_screens
(
gdk_display_get_default
());
int
n_screens
=
gdk_display_get_n_screens
(
gdk_display_get_default
());
...
...
xtt/exe/rt_xtt/gtk/rt_xtt_gtk.h
View file @
ff76b4ba
...
@@ -128,10 +128,11 @@ public:
...
@@ -128,10 +128,11 @@ public:
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
);
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
);
static
void
valchanged_cmd_input
(
GtkWidget
*
w
,
gpointer
data
);
static
void
valchanged_cmd_input
(
GtkWidget
*
w
,
gpointer
data
);
static
void
hotkey_Command
(
char
*
arg
,
void
*
userdata
);
static
void
hotkey_Command
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
);
static
void
hotkey_ToggleDig
(
char
*
arg
,
void
*
userdata
);
static
void
hotkey_ToggleDig
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
);
static
void
hotkey_SetDig
(
char
*
arg
,
void
*
userdata
);
static
void
hotkey_SetDig
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
);
static
void
hotkey_ResetDig
(
char
*
arg
,
void
*
userdata
);
static
void
hotkey_ResetDig
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
);
static
void
hotkey_SetValue
(
char
*
arg1
,
char
*
arg2
,
void
*
userdata
);
};
};
#endif
#endif
xtt/exe/rt_xtt/src/rt_xtt_main.h
View file @
ff76b4ba
...
@@ -82,6 +82,7 @@ public:
...
@@ -82,6 +82,7 @@ public:
static
void
hotkey_activate_toggledig
(
char
*
namep
);
static
void
hotkey_activate_toggledig
(
char
*
namep
);
static
void
hotkey_activate_setdig
(
char
*
namep
);
static
void
hotkey_activate_setdig
(
char
*
namep
);
static
void
hotkey_activate_resetdig
(
char
*
namep
);
static
void
hotkey_activate_resetdig
(
char
*
namep
);
static
void
hotkey_activate_setvalue
(
char
*
namep
,
char
*
valuep
);
static
void
open_URL_cb
(
void
*
ctx
,
char
*
url
);
static
void
open_URL_cb
(
void
*
ctx
,
char
*
url
);
static
void
qcom_events
(
void
*
data
);
static
void
qcom_events
(
void
*
data
);
...
...
xtt/exe/rt_xtt/src/xtt_main.cpp
View file @
ff76b4ba
...
@@ -217,6 +217,35 @@ void Xtt::hotkey_activate_resetdig(char* namep)
...
@@ -217,6 +217,35 @@ void Xtt::hotkey_activate_resetdig(char* namep)
printf
(
"rt_xtt hotkey: SetDig. Can't get %s
\n
"
,
name
);
printf
(
"rt_xtt hotkey: SetDig. Can't get %s
\n
"
,
name
);
}
}
void
Xtt
::
hotkey_activate_setvalue
(
char
*
namep
,
char
*
valuep
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tTypeId
tid
;
pwr_tUInt32
size
;
char
value
[
80
];
str_trim
(
name
,
namep
);
if
(
!
strchr
(
name
,
'.'
))
strcat
(
name
,
".ActualValue"
);
sts
=
gdh_GetAttributeCharacteristics
(
name
,
&
tid
,
&
size
,
0
,
0
);
if
(
EVEN
(
sts
))
{
printf
(
"rt_xtt hotkey: SetValue. Can't get %s
\n
"
,
name
);
return
;
}
sts
=
gdh_AttrStringToValue
(
tid
,
valuep
,
value
,
sizeof
(
value
),
size
);
if
(
EVEN
(
sts
))
{
printf
(
"rt_xtt hotkey: SetValue. Can't convert value %s
\n
"
,
name
);
return
;
}
sts
=
gdh_SetObjectInfo
(
name
,
value
,
size
);
if
(
EVEN
(
sts
))
printf
(
"rt_xtt hotkey: SetValue. Can't get %s
\n
"
,
name
);
}
void
Xtt
::
open_URL_cb
(
void
*
ctx
,
char
*
url
)
void
Xtt
::
open_URL_cb
(
void
*
ctx
,
char
*
url
)
{
{
xnav_open_URL
(
url
);
xnav_open_URL
(
url
);
...
...
xtt/lib/xtt/gtk/xtt_hotkey_gtk.cpp
View file @
ff76b4ba
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
#include "xtt_hotkey_gtk.h"
#include "xtt_hotkey_gtk.h"
HotkeyAction
::
HotkeyAction
(
const
char
*
name
,
void
(
*
action
)(
char
*
,
void
*
))
HotkeyAction
::
HotkeyAction
(
const
char
*
name
,
void
(
*
action
)(
char
*
,
char
*
,
void
*
))
:
m_action
(
action
)
:
m_action
(
action
)
{
{
strcpy
(
m_name
,
name
);
strcpy
(
m_name
,
name
);
...
@@ -87,16 +87,19 @@ HotkeyAction::HotkeyAction(const HotkeyAction& x) : m_action(x.m_action)
...
@@ -87,16 +87,19 @@ HotkeyAction::HotkeyAction(const HotkeyAction& x) : m_action(x.m_action)
strcpy
(
m_name
,
x
.
m_name
);
strcpy
(
m_name
,
x
.
m_name
);
}
}
HotkeyKey
::
HotkeyKey
(
int
mod
,
int
keysym
,
char
*
action_name
,
char
*
action_arg
)
HotkeyKey
::
HotkeyKey
(
int
mod
,
int
keysym
,
char
*
action_name
,
char
*
action_arg1
,
char
*
action_arg2
)
:
m_mod
(
mod
),
m_keysym
(
keysym
),
m_action
(
0
),
m_userdata
(
0
)
:
m_mod
(
mod
),
m_keysym
(
keysym
),
m_action
(
0
),
m_userdata
(
0
)
{
{
strcpy
(
m_action_name
,
action_name
);
strcpy
(
m_action_name
,
action_name
);
strcpy
(
m_action_arg
,
action_arg
);
strcpy
(
m_action_arg1
,
action_arg1
);
strcpy
(
m_action_arg2
,
action_arg2
);
}
}
HotkeyKey
::
HotkeyKey
(
const
HotkeyKey
&
x
)
:
m_mod
(
x
.
m_mod
),
m_keysym
(
x
.
m_keysym
),
m_action
(
x
.
m_action
),
m_userdata
(
x
.
m_userdata
)
HotkeyKey
::
HotkeyKey
(
const
HotkeyKey
&
x
)
:
m_mod
(
x
.
m_mod
),
m_keysym
(
x
.
m_keysym
),
m_action
(
x
.
m_action
),
m_userdata
(
x
.
m_userdata
)
{
{
strcpy
(
m_action_name
,
x
.
m_action_name
);
strcpy
(
m_action_name
,
x
.
m_action_name
);
strcpy
(
m_action_arg
,
x
.
m_action_arg
);
strcpy
(
m_action_arg1
,
x
.
m_action_arg1
);
strcpy
(
m_action_arg2
,
x
.
m_action_arg2
);
}
}
void
HotkeyKey
::
set_action
(
HotkeyAction
*
action
,
void
*
userdata
)
void
HotkeyKey
::
set_action
(
HotkeyAction
*
action
,
void
*
userdata
)
...
@@ -108,7 +111,7 @@ void HotkeyKey::set_action(HotkeyAction* action, void* userdata)
...
@@ -108,7 +111,7 @@ void HotkeyKey::set_action(HotkeyAction* action, void* userdata)
}
}
void
XttHotkey
::
register_action
(
void
XttHotkey
::
register_action
(
const
char
*
name
,
void
(
*
action
)(
char
*
,
void
*
),
void
*
userdata
)
const
char
*
name
,
void
(
*
action
)(
char
*
,
char
*
,
void
*
),
void
*
userdata
)
{
{
HotkeyAction
a
(
name
,
action
);
HotkeyAction
a
(
name
,
action
);
m_actions
.
push_back
(
a
);
m_actions
.
push_back
(
a
);
...
@@ -147,7 +150,8 @@ int XttHotkey::read_file()
...
@@ -147,7 +150,8 @@ int XttHotkey::read_file()
int
mod
=
0
;
int
mod
=
0
;
int
keysym
;
int
keysym
;
char
keystr
[
20
]
=
""
;
char
keystr
[
20
]
=
""
;
char
action_arg
[
200
];
char
action_arg1
[
200
];
char
action_arg2
[
200
];
char
action_name
[
200
];
char
action_name
[
200
];
row
++
;
row
++
;
...
@@ -195,20 +199,26 @@ int XttHotkey::read_file()
...
@@ -195,20 +199,26 @@ int XttHotkey::read_file()
}
}
strcpy
(
action_name
,
p2
[
0
]);
strcpy
(
action_name
,
p2
[
0
]);
str_trim
(
action_name
,
action_name
);
str_trim
(
action_name
,
action_name
);
strcpy
(
action_arg
,
p2
[
1
]);
strcpy
(
action_arg
1
,
p2
[
1
]);
if
((
s
=
strrchr
(
action_arg
,
')'
)))
if
((
s
=
strrchr
(
action_arg
1
,
')'
)))
*
s
=
0
;
*
s
=
0
;
else
{
else
{
printf
(
"Syntax error, %s, row %d
\n
"
,
m_filename
,
row
);
printf
(
"Syntax error, %s, row %d
\n
"
,
m_filename
,
row
);
continue
;
continue
;
}
}
if
(
s
=
strstr
(
action_arg1
,
","
))
{
strcpy
(
action_arg2
,
s
+
1
);
*
s
=
0
;
}
else
strcpy
(
action_arg2
,
""
);
keysym
=
XStringToKeysym
(
keystr
);
keysym
=
XStringToKeysym
(
keystr
);
if
(
!
keysym
)
{
if
(
!
keysym
)
{
printf
(
"Syntax error, %s, row %d
\n
"
,
m_filename
,
row
);
printf
(
"Syntax error, %s, row %d
\n
"
,
m_filename
,
row
);
continue
;
continue
;
}
}
HotkeyKey
key
(
mod
,
keysym
,
action_name
,
action_arg
);
HotkeyKey
key
(
mod
,
keysym
,
action_name
,
action_arg
1
,
action_arg2
);
m_keys
.
push_back
(
key
);
m_keys
.
push_back
(
key
);
}
}
...
@@ -237,7 +247,8 @@ int XttHotkey::event_handler(GdkXEvent* xevent, gpointer data)
...
@@ -237,7 +247,8 @@ int XttHotkey::event_handler(GdkXEvent* xevent, gpointer data)
&
~
Mod5Mask
))
{
&
~
Mod5Mask
))
{
if
(
hotkey
->
m_keys
[
i
].
m_action
)
if
(
hotkey
->
m_keys
[
i
].
m_action
)
(
hotkey
->
m_keys
[
i
].
m_action
)(
(
hotkey
->
m_keys
[
i
].
m_action
)(
hotkey
->
m_keys
[
i
].
m_action_arg
,
hotkey
->
m_keys
[
i
].
m_userdata
);
hotkey
->
m_keys
[
i
].
m_action_arg1
,
hotkey
->
m_keys
[
i
].
m_action_arg2
,
hotkey
->
m_keys
[
i
].
m_userdata
);
}
}
}
}
}
}
...
...
xtt/lib/xtt/gtk/xtt_hotkey_gtk.h
View file @
ff76b4ba
...
@@ -45,8 +45,8 @@
...
@@ -45,8 +45,8 @@
class
HotkeyAction
{
class
HotkeyAction
{
public:
public:
char
m_name
[
80
];
char
m_name
[
80
];
void
(
*
m_action
)(
char
*
,
void
*
);
void
(
*
m_action
)(
char
*
,
char
*
,
void
*
);
HotkeyAction
(
const
char
*
name
,
void
(
*
action
)(
char
*
,
void
*
));
HotkeyAction
(
const
char
*
name
,
void
(
*
action
)(
char
*
,
char
*
,
void
*
));
HotkeyAction
(
const
HotkeyAction
&
x
);
HotkeyAction
(
const
HotkeyAction
&
x
);
};
};
...
@@ -55,11 +55,12 @@ public:
...
@@ -55,11 +55,12 @@ public:
int
m_mod
;
int
m_mod
;
int
m_keysym
;
int
m_keysym
;
char
m_action_name
[
80
];
char
m_action_name
[
80
];
char
m_action_arg
[
200
];
char
m_action_arg1
[
200
];
void
(
*
m_action
)(
char
*
,
void
*
);
char
m_action_arg2
[
200
];
void
(
*
m_action
)(
char
*
,
char
*
,
void
*
);
void
*
m_userdata
;
void
*
m_userdata
;
HotkeyKey
(
int
mod
,
int
keysym
,
char
*
action_name
,
char
*
action_arg
);
HotkeyKey
(
int
mod
,
int
keysym
,
char
*
action_name
,
char
*
action_arg
1
,
char
*
action_arg2
);
HotkeyKey
(
const
HotkeyKey
&
x
);
HotkeyKey
(
const
HotkeyKey
&
x
);
void
set_action
(
HotkeyAction
*
action
,
void
*
userdata
);
void
set_action
(
HotkeyAction
*
action
,
void
*
userdata
);
};
};
...
@@ -72,7 +73,7 @@ public:
...
@@ -72,7 +73,7 @@ public:
XttHotkey
(
const
char
*
filename
);
XttHotkey
(
const
char
*
filename
);
~
XttHotkey
();
~
XttHotkey
();
void
register_action
(
void
register_action
(
const
char
*
name
,
void
(
*
action
)(
char
*
,
void
*
),
void
*
userdata
);
const
char
*
name
,
void
(
*
action
)(
char
*
,
char
*
,
void
*
),
void
*
userdata
);
int
read_file
();
int
read_file
();
int
grab_key
(
int
keysym
,
int
modifier
);
int
grab_key
(
int
keysym
,
int
modifier
);
static
int
event_handler
(
GdkXEvent
*
xevent
,
gpointer
data
);
static
int
event_handler
(
GdkXEvent
*
xevent
,
gpointer
data
);
...
...
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