Skip to content

Commit f5fbd93

Browse files
committed
Some minor updates, some things I didn't add to the previous commit.
1 parent 21f76ec commit f5fbd93

File tree

6 files changed

+707
-10
lines changed

6 files changed

+707
-10
lines changed

gdraw/gcontainer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,7 @@ static int _GWidget_TopLevel_Key(GWindow top, GWindow ew, GEvent *event) {
485485
}
486486
}
487487
/* Check for mnemonics and shortcuts */
488-
if ( event->type == et_char &&
489-
((event->u.chr.state&(ksm_control|ksm_meta|ksm_cmdmacosx)) ||
490-
event->u.chr.keysym>=0xff00 ||
491-
GMenuAnyUnmaskedShortcuts(topd->ispalette?topd->owner->gmenubar:NULL,topd->gmenubar)) ) {
488+
if ( event->type == et_char ) {
492489
handled = GMenuPopupCheckKey(event);
493490
if ( topd->ispalette ) {
494491
if ( !(handled = GMenuBarCheckKey(top,topd->owner->gmenubar,event)) )

gdraw/gmenu.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,10 +1801,13 @@ int GMenuBarCheckKey(GWindow top, GGadget *g, GEvent *event) {
18011801
GMenuItem *mi;
18021802
unichar_t keysym = event->u.chr.keysym;
18031803

1804+
printf("GMenuBarCheckKey(1)\n");
1805+
18041806
if ( g==NULL )
18051807
return( false );
18061808
if ( keysym==0 )
18071809
return( false );
1810+
printf("GMenuBarCheckKey(2)\n");
18081811

18091812
if ( (menumask&ksm_cmdmacosx) && keysym>0x7f &&
18101813
(event->u.chr.state&ksm_meta) &&
@@ -1814,6 +1817,7 @@ return( false );
18141817
if ( keysym<GK_Special && islower(keysym))
18151818
keysym = toupper(keysym);
18161819
if ( event->u.chr.state&ksm_meta && !(event->u.chr.state&(menumask&~(ksm_meta|ksm_shift)))) {
1820+
printf("GMenuBarCheckKey(3)\n");
18171821
/* Only look for mneumonics in the leaf of the displayed menu structure */
18181822
if ( mb->child!=NULL )
18191823
return( gmenu_key(mb->child,event)); /* this routine will do shortcuts too */
@@ -1826,12 +1830,15 @@ return( true );
18261830
}
18271831
}
18281832
}
1829-
1833+
1834+
printf("should we look for hotkey in new system?\n");
1835+
18301836
/* then look for shortcuts everywhere */
1831-
if ( event->u.chr.state&(menumask&~ksm_shift) ||
1832-
event->u.chr.keysym>=GK_Special ||
1833-
mb->any_unmasked_shortcuts ) {
1834-
1837+
/* if ( event->u.chr.state&(menumask&~ksm_shift) || */
1838+
/* event->u.chr.keysym>=GK_Special || */
1839+
/* mb->any_unmasked_shortcuts ) { */
1840+
if(1) {
1841+
18351842
printf("looking for hotkey in new system...keysym:%d\n", event->u.chr.keysym );
18361843
Hotkey* hk = hotkeyFindByEvent( top, event );
18371844
if( hk ) {

gdraw/hotkeys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Hotkey* hotkeyFindByEvent( GWindow w, GEvent *event ) {
238238
struct dlistnode* node = hotkeys;
239239
for( ; node; node=node->next ) {
240240
Hotkey* hk = (Hotkey*)node;
241-
printf("check hk:%s keysym:%d\n", hk->text, hk->keysym );
241+
// printf("check hk:%s keysym:%d\n", hk->text, hk->keysym );
242242
if( hk->keysym ) {
243243
if( event->u.chr.keysym == hk->keysym ) {
244244
if( event->u.chr.state == hk->state ) {

gutils/dlist.c

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* Copyright (C) 2012 by Ben Martin */
2+
/*
3+
* Redistribution and use in source and binary forms, with or without
4+
* modification, are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright notice, this
7+
* list of conditions and the following disclaimer.
8+
9+
* Redistributions in binary form must reproduce the above copyright notice,
10+
* this list of conditions and the following disclaimer in the documentation
11+
* and/or other materials provided with the distribution.
12+
13+
* The name of the author may not be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
16+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19+
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24+
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
#include <stdio.h> /* for NULL */
28+
#include "dlist.h"
29+
30+
void dlist_pushfront( struct dlistnode** list, struct dlistnode* node ) {
31+
if( *list ) {
32+
node->next = *list;
33+
node->next->prev = node;
34+
}
35+
*list = node;
36+
}
37+
38+
int dlist_size( struct dlistnode** list ) {
39+
struct dlistnode* node = *list;
40+
int ret = 0;
41+
for( ; node; node=node->next ) {
42+
ret++;
43+
}
44+
return ret;
45+
}
46+
47+
int dlist_isempty( struct dlistnode** list ) {
48+
return *list == NULL;
49+
}
50+
51+
void dlist_erase( struct dlistnode** list, struct dlistnode* node ) {
52+
if( !node )
53+
return;
54+
if( *list = node ) {
55+
*list = node->next;
56+
if( node->next ) {
57+
node->next->prev = 0;
58+
}
59+
return 0;
60+
}
61+
if( node->prev ) {
62+
node->prev->next = node->next;
63+
}
64+
if( node->next ) {
65+
node->next->prev = node->prev;
66+
}
67+
68+
}
69+
70+
void dlist_foreach( struct dlistnode** list, dlist_foreach_func_type func )
71+
{
72+
struct dlistnode* node = *list;
73+
while( node ) {
74+
struct dlistnode* t = node;
75+
node = node->next;
76+
func( t );
77+
}
78+
}
79+
80+
void dlist_foreach_udata( struct dlistnode** list, dlist_foreach_udata_func_type func, void* udata )
81+
{
82+
struct dlistnode* node = *list;
83+
while( node ) {
84+
struct dlistnode* t = node;
85+
node = node->next;
86+
func( t, udata );
87+
}
88+
}
89+

0 commit comments

Comments
 (0)