Changeset 38396 for titan/titan/textinput.h
- Timestamp:
- 08/28/16 11:27:56 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/textinput.h
r28058 r38396 73 73 } 74 74 75 char* textinputsave(char* title, char* text, char* tconfig) 76 { 77 int rcret = -1, fromthread = 0, height = 0; 78 struct skin* textinput = getscreen("textinput"); 79 struct skin* input = getscreennode(textinput, "input"); 80 struct skin* framebuffer = getscreen("framebuffer"); 81 char* ret = NULL, *bg = NULL; 82 83 if(pthread_self() != status.mainthread) 84 fromthread = 1; 85 86 if(title == NULL) title = ostrcat(_("Input field"), NULL, 0, 0); 87 88 changetitle(textinput, title); 89 height = textinput->height; 90 if(title != NULL) 91 textinput->height += textinput->fontsize + 6 + (textinput->bordersize * 2); 92 changeinput(input, text); 93 94 if(fromthread == 1) 95 { 96 delrc(getrcconfigint("rcvolup", NULL), NULL, NULL); 97 delrc(getrcconfigint("rcvoldown", NULL), NULL, NULL); 98 delrc(getrcconfigint("rcmute", NULL), NULL, NULL); 99 m_lock(&status.drawingmutex, 0); 100 m_lock(&status.rcmutex, 10); 101 setnodeattr(textinput, framebuffer, 2); 102 status.rcowner = textinput; 103 bg = savescreen(textinput); 104 drawscreen(textinput, 0, 2); 105 } 106 else 107 drawscreen(textinput, 0, 0); 108 addscreenrc(textinput, input); 109 110 while(1) 111 { 112 rcret = waitrc(textinput, 0, 0); 113 if(rcret == getrcconfigint("rcexit", NULL)) break; 114 if(rcret == getrcconfigint("rcyellow", NULL)) 115 { 116 ret = ostrcat(input->input, NULL, 0, 0); 117 if(tconfig != NULL) 118 addconfig(tconfig, ret); 119 break; 120 } 121 if(rcret == getrcconfigint("rcok", NULL)) 122 { 123 ret = ostrcat(input->input, NULL, 0, 0); 124 break; 125 } 126 } 127 128 delownerrc(textinput); 129 130 if(fromthread == 1) 131 { 132 clearscreennolock(textinput); 133 restorescreen(bg, textinput); 134 blitfb(0); 135 sleep(1); 136 status.rcowner = NULL; 137 m_unlock(&status.rcmutex, 3); 138 m_unlock(&status.drawingmutex, 0); 139 addrc(getrcconfigint("rcvolup", NULL), screenvolumeup, NULL, NULL); 140 addrc(getrcconfigint("rcvoldown", NULL), screenvolumedown, NULL, NULL); 141 addrc(getrcconfigint("rcmute", NULL), screenmute, NULL, NULL); 142 } 143 else 144 { 145 clearscreen(textinput); 146 drawscreen(skin, 0, 0); 147 } 148 149 textinput->height = height; 150 return ret; 151 } 152 75 153 #endif
Note: See TracChangeset
for help on using the changeset viewer.