Changeset 537
- Timestamp:
- 06/07/08 03:35:15 (4 months ago)
- Location:
- trunk/thune
- Files:
-
- 9 modified
-
cmake_modules/FindThune.cmake (modified) (1 diff)
-
cmake_modules/FindThuneGL.cmake (modified) (1 diff)
-
doc/GLManual (modified) (1 diff)
-
gl/CMakeLists.txt (modified) (2 diffs)
-
gl/gui.c (modified) (14 diffs)
-
gl/gui.h (modified) (2 diffs)
-
gl/gx.c (modified) (2 diffs)
-
thune-gl.spec (modified) (1 diff)
-
thune.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/cmake_modules/FindThune.cmake
r517 r537 1 FIND_PATH(THUNE_INCLUDE_DIR urlan.h /usr/include /usr/local/include)1 FIND_PATH(THUNE_INCLUDE_DIR urlan.h /usr/include/thune /usr/local/include/thune) 2 2 3 3 FIND_LIBRARY(THUNE_LIBRARY NAMES thune PATH /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib) -
trunk/thune/cmake_modules/FindThuneGL.cmake
r518 r537 1 FIND_PATH(THUNEGL_INCLUDE_DIR thune-gl.h /usr/include /usr/local/include)1 FIND_PATH(THUNEGL_INCLUDE_DIR gx.h /usr/include/thune /usr/local/include/thune) 2 2 3 3 FIND_LIBRARY(THUNEGL_LIBRARY NAMES thune-gl PATH /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib) -
trunk/thune/doc/GLManual
r516 r537 155 155 make-matrix (vec3 -- matrix) 156 156 ================= ====================== ====================== 157 158 159 Widget Functions 160 ---------------- 161 162 ================ ====================== ====================== 163 Word Stack Usage Function 164 ================ ====================== ====================== 165 show (widget -- ) Show widget 166 show/focus (widget -- ) Show widget and give it focus 167 hide (widget -- ) Hide widget 168 ================ ====================== ====================== 157 169 158 170 -
trunk/thune/gl/CMakeLists.txt
r527 r537 72 72 rfont.c 73 73 shader.c 74 #gui.c74 gui.c 75 75 ${GLV_FILE} 76 76 ${JOYSTICK_FILE} … … 114 114 install(TARGETS thune-gl DESTINATION /usr/local/bin) 115 115 install(TARGETS thuneGL-lib DESTINATION /usr/local/lib) 116 #install(FILES urlan.h DESTINATION /usr/local/include) 116 install(FILES gx.h DESTINATION /usr/local/include/thune) 117 install(FILES gui.h DESTINATION /usr/local/include/thune) 118 install(FILES TexFont.h DESTINATION /usr/local/include/thune) 117 119 endif () 118 120 -
trunk/thune/gl/gui.c
r536 r537 72 72 for(it.id = ui->rootList; IS_VALID(it.id); it.id = it.w->next) { \ 73 73 it.w = WPTR(it.id); 74 75 #define EACH_SHOWN_ROOT(it) \ 76 EACH_ROOT(it) \ 77 if( it.w->flags & GW_HIDDEN ) \ 78 continue; 74 79 75 80 #define EACH_END } … … 121 126 122 127 123 static void gui_freeWidgetP( GUI* ui, GWidget* w, GWidgetId id ) 124 { 125 GWidgetIt it; 126 GWidgetId next; 127 128 w->next = ui->firstFree; 129 ui->firstFree = id; 130 128 static void gui_removeFocus( GUI* ui, GWidgetId id ) 129 { 131 130 if( ui->mouseFocus == id ) 132 131 { … … 137 136 if( ui->keyFocus == id ) 138 137 ui->keyFocus = NO_WID; 138 } 139 140 141 static void gui_freeWidgetP( GUI* ui, GWidget* w, GWidgetId id ) 142 { 143 GWidgetIt it; 144 GWidgetId next; 145 146 w->next = ui->firstFree; 147 ui->firstFree = id; 148 149 gui_removeFocus( ui, id ); 139 150 140 151 //EACH_CHILD( w, it ) … … 896 907 ui->ut = ut; 897 908 ui->style = 0; 898 ui->root = NO_WID;899 909 ui->keyFocus = NO_WID; 900 910 ui->mouseFocus = NO_WID; … … 956 966 957 967 968 void gui_setKeyFocus( GUI* ui, GWidgetId id ) 969 { 970 ui->keyFocus = id; 971 } 972 973 974 void gui_setMouseFocus( GUI* ui, GWidgetId id ) 975 { 976 ui->mouseFocus = id; 977 } 978 979 980 void gui_grabMouse( GUI* ui, GWidgetId id ) 981 { 982 ui->mouseFocus = id; 983 ui->mouseGrabbed = 1; 984 } 985 986 987 void gui_ungrabMouse( GUI* ui, GWidgetId id ) 988 { 989 if( ui->mouseFocus == id ) 990 { 991 ui->mouseGrabbed = 0; 992 } 993 } 994 995 958 996 static GWidget* childAt( GUI* ui, GWidget* wp, const GLViewEvent* ev ) 959 997 { … … 967 1005 968 1006 969 void gui_setKeyFocus( GUI* ui, GWidgetId id ) 970 { 971 ui->keyFocus = id; 972 } 973 974 975 void gui_grabMouse( GUI* ui, GWidgetId id ) 976 { 977 ui->mouseFocus = id; 978 ui->mouseGrabbed = 1; 979 } 980 981 982 void gui_ungrabMouse( GUI* ui, GWidgetId id ) 983 { 984 if( ui->mouseFocus == id ) 985 { 986 ui->mouseGrabbed = 0; 987 } 1007 static GWidgetId widgetAt( GUI* ui, const GLViewEvent* ev ) 1008 { 1009 GWidgetIt it; 1010 EACH_SHOWN_ROOT( it ) 1011 if( gui_widgetContains( it.w, ev->x, ev->y ) ) 1012 { 1013 it.w = childAt( ui, it.w, ev ); 1014 return it.w ? WID(it.w) : NO_WID; 1015 } 1016 EACH_END 1017 return NO_WID; 988 1018 } 989 1019 … … 994 1024 995 1025 #if 0 996 printf( "KR dispatch %d root %dmouseFocus %d keyFocus %d\n",997 ev->type, ui-> root, ui->mouseFocus, ui->keyFocus );1026 printf( "KR dispatch %d mouseFocus %d keyFocus %d\n", 1027 ev->type, ui->mouseFocus, ui->keyFocus ); 998 1028 #endif 999 1029 … … 1004 1034 // Convert window system origin from top of window to the bottom. 1005 1035 ev->y = ui->rootH - ev->y; 1036 // Fall through... 1006 1037 1007 1038 case GLV_EVENT_WHEEL: … … 1031 1062 ev->state, ev->x, ev->y ); 1032 1063 CLASS( w ).dispatch( ui, w, &me ); 1033 ui->mouseFocus = NO_WID;1034 1064 } 1035 1065 } 1036 if( IS_VALID(ui->root) ) 1066 1067 ui->mouseFocus = widgetAt( ui, ev ); 1068 if( IS_VALID(ui->mouseFocus) ) 1037 1069 { 1038 GWidget* rw = WPTR(ui->root); 1039 w = childAt( ui, rw, ev ); 1040 if( /*(w != rw) &&*/ (! (w->flags & GW_DISABLED)) ) 1070 w = WPTR(ui->mouseFocus); 1071 if( ! (w->flags & GW_DISABLED) ) 1041 1072 { 1042 1073 GLViewEvent me; … … 1044 1075 ev->state, ev->x, ev->y ); 1045 1076 CLASS( w ).dispatch( ui, w, &me ); 1046 ui->mouseFocus = WID(w);1047 1077 goto dispatch; 1048 1078 } … … 1060 1090 1061 1091 case GLV_EVENT_FOCUS_IN: 1092 ui->mouseFocus = widgetAt( ui, ev ); 1093 // Fall through... 1094 1062 1095 case GLV_EVENT_FOCUS_OUT: 1063 goto root;1064 }1065 1066 root: 1067 1068 if( ! IS_VALID(ui->root) )1069 return;1070 w = WPTR(ui->root);1096 if( IS_VALID(ui->mouseFocus) ) 1097 { 1098 w = WPTR(ui->mouseFocus); 1099 goto dispatch; 1100 } 1101 break; 1102 } 1103 return; 1071 1104 1072 1105 dispatch: … … 1170 1203 1171 1204 /** 1172 Returns pointer to root widget or zero if id is invalid.1205 Returns pointer to root parent widget or zero if id is invalid. 1173 1206 */ 1174 1207 GWidget* gui_root( const GUI* ui, GWidgetId id ) … … 1225 1258 else if( ! hidden ) 1226 1259 { 1260 GWidgetId id = WID(wp); 1261 gui_removeFocus( ui, id ); 1227 1262 wp->flags |= GW_HIDDEN; 1228 1263 markLayoutDirty( ui, wp->parent ); … … 1339 1374 { 1340 1375 linkRoot( ui, wp, ms->wid ); 1341 ui->root = ms->wid;1342 1343 1376 if( ! IS_VALID(ui->keyFocus) ) 1344 ui->keyFocus = ui->root;1377 ui->keyFocus = ms->wid; 1345 1378 } 1346 1379 //return wp; -
trunk/thune/gl/gui.h
r533 r537 44 44 UAtom atom_action; 45 45 UAtom atom_text; 46 GWidgetId root;47 46 GWidgetId keyFocus; 48 47 GWidgetId mouseFocus; … … 163 162 GWidget* gui_root( const GUI* ui, GWidgetId id ); 164 163 void gui_setKeyFocus( GUI*, GWidgetId ); 164 void gui_setMouseFocus( GUI*, GWidgetId ); 165 165 void gui_grabMouse( GUI*, GWidgetId ); 166 166 void gui_ungrabMouse( GUI*, GWidgetId ); -
trunk/thune/gl/gx.c
r536 r537 721 721 722 722 723 // (widget -- ) 724 UR_CALL( uc_show ) 725 { 726 if( ur_is(tos, UT_WIDGET) ) 727 { 728 UCell* inv; 729 GWidgetId id = ur_int(tos); 730 GWidget* wp = gui_widgetPtr( &gxEnv.gui, id ); 731 if( wp ) 732 { 733 gui_show( &gxEnv.gui, wp, 1 ); 734 735 inv = UR_CALL_CELL; 736 if( inv && (ur_sel(inv) == UR_ATOM_FOCUS) ) 737 { 738 gui_setKeyFocus( &gxEnv.gui, id ); 739 gui_setMouseFocus( &gxEnv.gui, id ); 740 } 741 } 742 } 743 UR_S_DROP; 744 } 745 746 747 // (widget -- ) 748 UR_CALL( uc_hide ) 749 { 750 if( ur_is(tos, UT_WIDGET) ) 751 { 752 GWidget* wp = gui_widgetPtr( &gxEnv.gui, ur_int(tos) ); 753 if( wp ) 754 gui_show( &gxEnv.gui, wp, 0 ); 755 } 756 UR_S_DROP; 757 } 758 759 723 760 // (matrix vec3 -- ) 724 761 UR_CALL( uc_look_at ) … … 1293 1330 { uc_play, "play" }, 1294 1331 { uc_stop, "stop" }, 1332 { uc_show, "show" }, 1333 { uc_hide, "hide" }, 1295 1334 { uc_text_size, "text-size" }, 1296 1335 { uc_display_events, "display.events" }, -
trunk/thune/thune-gl.spec
r536 r537 40 40 mkdir include 41 41 sed -e "s~\"urlan.h\"~<thune/urlan.h>~" gl/gui.h >include/gui.h 42 sed -e "s~\"gui.h\"~<thune/gui.h>~" -e "s~\"TexFont.h\"~<thune/TexFont gui.h>~" gl/gx.h >include/gx.h42 sed -e "s~\"gui.h\"~<thune/gui.h>~" -e "s~\"TexFont.h\"~<thune/TexFont.h>~" gl/gx.h >include/gx.h 43 43 install -m 644 include/gx.h $RPM_BUILD_ROOT%{_includedir}/thune 44 44 install -m 644 include/gui.h $RPM_BUILD_ROOT%{_includedir}/thune -
trunk/thune/thune.c
r533 r537 773 773 774 774 case OP_HALT: 775 UR_CALL_OP = OP_HALT; 775 776 EMH_HALT(pc, end) 776 777 goto halt; … … 778 779 case OP_QUIT: 779 780 UR_S_PUSH( *val ); 781 UR_CALL_OP = OP_QUIT; 780 782 goto quit; 781 783 … … 1016 1018 1017 1019 case OP_HALT: 1018 UR_CALL_OP = 0;1020 //UR_CALL_OP = 0; 1019 1021 goto halt; 1020 1022 1021 1023 case OP_QUIT: 1022 UR_CALL_OP = 0;1024 //UR_CALL_OP = 0; 1023 1025 goto quit; 1024 1026
