k->x = wx;
k->y = wy;
k->state = msk;
+// also clear modifiers state if a key is to be released
+ if( !press ) k->state = 0;
k->keycode = key;
k->same_screen = 1;
wdw->top_level->put_event((XEvent *) k);
fprintf(stderr, "key(%d, %d) out of range\n", code + EVENT_CODE_KEY1, value);
return;
}
-// Show help if both Alt's pressed on keyboard together with a shuttle button
- if( wdw && wdw->alt_down() ) {
- if( value ) wdw->context_help_show("Shuttle key default arrangement");
+// Show help if Alt is pressed on the keyboard together with a shuttle button
+ if( wdw && wdw->alt_down() && value ) {
+ wdw->context_help_show("Shuttle key default arrangement");
return;
}
send_stroke_sequence(value ? KJS_KEY_DOWN : KJS_KEY_UP, code);
# On empty keyphrase do nothing
# The special keyphrase "TOC" shows Contents, "IDX" shows Index
# The keyphrase starting with "FILE:" shows the file named after colon
+# The special keyphrase "API" shows the numeric version of the script itself
# Several important definitions
-# Web browser executable
+# ContextManual.pl script API version. Must not be changed !
+$cin_cm_api = 1;
+
+# Web browser executable, can be redefined on user's demand
$cin_browser = $ENV{'CIN_BROWSER'};
# a likely default browser
$cin_browser = 'firefox' if $cin_browser eq '';
# a fake browser for debugging
#$cin_browser = 'echo';
+# The following definitions depend on the HTML manual structure
+# There is nothing to change below this line
+
# The node with the manual contents
$contents_node = 'Contents.html';
$index = $cin_man.'/'.$index_node;
#print "ContextManual: using contents $contents\n";
+# Cinelerra user's config directory
+$cin_config = $ENV{'CIN_CONFIG'};
+$cin_config = $ENV{'HOME'}.'/.bcast5'
+ if $cin_config eq '' && $ENV{'HOME'} ne '';
+$cin_config = '.' if $cin_config eq '';
+$me_config = "$cin_config/ContextManual.pl";
+#print "ContextManual: user script=$me_config\n";
+
# 1st argument is the requested key
$help_key = $ARGV[0];
#print "ContextManual: request=$help_key\n";
# Do nothing if no key requested
exit 0 if $help_key eq '';
+
+# A special internal request: output own API version
+if ($help_key eq 'API')
+{
+ print "$cin_cm_api\n";
+ exit 0;
+}
+
+# If a system (not user's) script instance is executed, and the API versions
+# of both scripts do not match, then copy the system script to the user's one
+# (making a backup copy of the latter). Then execute it with the same key.
+if ($0 ne $me_config)
+{
+ $me_api = 0;
+ $me_api = `\"$me_config\" API` if -x $me_config;
+ if ($me_api != $cin_cm_api)
+ {
+ print "ContextManual: copying \"$0\" to \"$me_config\"\n";
+ unlink "$me_config.bak" if -f "$me_config.bak";
+ rename "$me_config", "$me_config.bak" if -f $me_config;
+ system "cp \"$0\" \"$me_config\"";
+ system "chmod +x \"$me_config\"";
+ }
+ exec "\"$me_config\" \"$help_key\"" if -x $me_config;
+}
+
+# If a user's script instance is executed, do everything by myself
+#print "ContextManual: executing \"$0\" \"$help_key\"\n";
+
# Show contents on this special request
if ($help_key eq 'TOC')
{
# If not found, grep manual for exact key instance
if ($node eq '')
{
- $_ = `grep -l \"$help_key\" $cin_dat/doc/CinelerraGG_Manual/*.html`;
+ $_ = `grep -l \"$help_key\" \"$cin_dat\"/doc/CinelerraGG_Manual/*.html`;
($node) = split;
}
# If not found, grep manual for case insensitive key instance
if ($node eq '')
{
- $_ = `grep -il \"$help_key\" $cin_dat/doc/CinelerraGG_Manual/*.html`;
+ $_ = `grep -il \"$help_key\" \"$cin_dat\"/doc/CinelerraGG_Manual/*.html`;
($node) = split;
}
//__LINE__,
//keysym);
+// force setting modifiers state if a modifier key pressed
+ switch( keysym ) {
+ case XK_Alt_L:
+ case XK_Alt_R:
+ alt_mask = 1;
+ break;
+ case XK_Shift_L:
+ case XK_Shift_R:
+ shift_mask = 1;
+ break;
+ case XK_Control_L:
+ case XK_Control_R:
+ ctrl_mask = 1;
+ break;
+ default:
+ break;
+ }
+
// block out control keys
if(keysym > 0xffe0 && keysym < 0xffff) break;
// block out Alt_GR key
case KeyRelease:
XLookupString((XKeyEvent*)event, keys_return, 1, &keysym, 0);
+ get_key_masks(event->xkey.state);
+// force clearing modifiers state if a modifier key released
+ switch( keysym ) {
+ case XK_Alt_L:
+ case XK_Alt_R:
+ alt_mask = 0;
+ break;
+ case XK_Shift_L:
+ case XK_Shift_R:
+ shift_mask = 0;
+ break;
+ case XK_Control_L:
+ case XK_Control_R:
+ ctrl_mask = 0;
+ break;
+ default:
+ break;
+ }
dispatch_keyrelease_event();
-// printf("BC_WindowBase::dispatch_event KeyRelease keysym=0x%x keystate=0x%lld\n",
+// printf("BC_WindowBase::dispatch_event KeyRelease keysym=%#lx keystate=%04x\n",
// keysym, event->xkey.state);
break;