मेरे पास एक एम्बेडेड डिवाइस है जो Linux/X11 चला रहा है जो एक डिवाइस से जुड़ा हुआ है जो यूएसबी कनेक्शन पर टच इवेंट प्रदान करता है। यह डिवाइस मानक सूचक/माउस इनपुट के किसी भी रूप के रूप में पहचाना नहीं गया है। मैं जो करने की कोशिश कर रहा हूं वह बाहरी घटनाओं की रिपोर्ट करता है जब एक्स 11 में माउस घटनाओं को "इंजेक्ट" करने का एक तरीका मिलता है।X11 इनपुट कतार में सिंथेटिक माउस ईवेंट कैसे सम्मिलित करें
ऐसा करने से जीटीके + कॉल के साथ नकली माउस प्रेस में मेरे आवेदन (जीटीके + का उपयोग कर सी में लिखा गया) की आवश्यकता को हटा दिया जाएगा।
यदि यह किया जा सकता है तो मेरे जीटीके + एप्लिकेशन को स्पर्श घटनाओं को उत्पन्न करने वाले डिवाइस के बारे में जानने या देखभाल करने की आवश्यकता नहीं होगी। यह सिर्फ मानक माउस घटनाओं के रूप में आवेदन के लिए दिखाई देगा।
कोई भी जानता है कि X11 में सिंथेटिक माउस ईवेंट डालने के बारे में कैसे जाना है?
अभी मैं निम्नलिखित काम कर रहा हूं जो काम करता है, लेकिन इष्टतम नहीं है।
GtkWidget *btnSpin; /* sample button */
gboolean buttonPress_cb(void *btn);
gboolean buttonDePress_cb(void *btn);
/* make this call after the device library calls the TouchEvent_cb() callback
and the application has determined which, if any, button was touched
In this example we are assuming btnSpin was touched.
This function will, in 5ms, begin the process of causing the button to do it's
normal animation (button in, button out effects) and then send the actual
button_clicked event to the button.
*/
g_timeout_add(5, (GSourceFunc) buttonPress_cb, (void *)btnSpin);
/* this callback is fired 5ms after the g_timeout_add() function above.
It first sets the button state to ACTIVE to begin the animation cycle (pressed look)
And then 250ms later calls buttonDePress_cb which will make the button look un-pressed
and then send the button_clicked event.
*/
gboolean buttonPress_cb(void *btn)
{
gtk_widget_set_state((GtkWidget *)btn, GTK_STATE_ACTIVE);
g_timeout_add(250, (GSourceFunc) buttonDePress_cb, btn);
return(FALSE);
}
/* Sets button state back to NORMAL (not pressed look)
and sends the button_clicked event so that the registered signal handler for the
button can be activated
*/
gboolean buttonDePress_cb(void *btn)
{
gtk_widget_set_state(btn, GTK_STATE_NORMAL);
gtk_button_clicked(GTK_BUTTON(btn));
return(FALSE);
}
उत्कृष्ट .. यह सिर्फ जवाब हो सकता है। मुझे यह देखने की आवश्यकता होगी कि मेरा एम्बेडेड लिनक्स डिवाइस 'यूनपूट' सिस्टम का समर्थन करता है या नहीं। धन्यवाद। – Chimera