CN117971108B - Touch control method, device, equipment and medium of WPF application - Google Patents

Touch control method, device, equipment and medium of WPF application Download PDF

Info

Publication number
CN117971108B
CN117971108B CN202410372761.3A CN202410372761A CN117971108B CN 117971108 B CN117971108 B CN 117971108B CN 202410372761 A CN202410372761 A CN 202410372761A CN 117971108 B CN117971108 B CN 117971108B
Authority
CN
China
Prior art keywords
touch screen
screen data
interface
shared memory
touch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410372761.3A
Other languages
Chinese (zh)
Other versions
CN117971108A (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nfs China Software Co ltd
Original Assignee
Nfs China Software Co ltd
Filing date
Publication date
Application filed by Nfs China Software Co ltd filed Critical Nfs China Software Co ltd
Priority to CN202410372761.3A priority Critical patent/CN117971108B/en
Publication of CN117971108A publication Critical patent/CN117971108A/en
Application granted granted Critical
Publication of CN117971108B publication Critical patent/CN117971108B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the application provides a touch control method, a device, equipment and a medium for WPF application, wherein the method is applied to compatible layer software running on a Linux system and specifically comprises the following steps: providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment; creating a touch screen data queue and a shared memory according to a call request of the WPF application for the related interface of the touch screen device, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle. The embodiment of the application can realize the touch control function of the WPF application in a compatible layer environment, and can alleviate the problem of touch screen data loss caused by untimely touch screen data reading of the WPF application to a certain extent.

Description

Touch control method, device, equipment and medium of WPF application
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a touch control method, a touch control device, touch control equipment and a touch control medium for WPF application.
Background
WPF (window presentation foundation, windows Presentation Foundation) is a framework developed by microsoft for creating Windows (window) applications. WPF applications may contain rich graphics and media elements, support three-dimensional graphics, and ease implementation of responsive user interfaces, which are commonly used to develop desktop applications such as business applications, graphic design tools, media players, and the like.
Wine (Wine is not a simulator, wine Is Not an Emulator) is a compatible layer of software that is capable of porting applications of a second operating system onto a first operating system. Since Wine can translate Windows API (application programming interface, application ProgramInterface) calls into dynamic POSIX (portable operating system interface ) calls, WPF applications can be run in operating systems outside of Windows.
At present, since Wine does not support touch, touch functions of some WPF applications running on Wine cannot be used.
Disclosure of Invention
The embodiment of the application provides a touch control method of a WPF application, which can realize the touch control function of the WPF application in a compatible layer environment and can alleviate the problem that touch screen data is lost due to the fact that the WPF application reads the touch screen data in time to a certain extent.
Correspondingly, the embodiment of the application also provides a touch device, electronic equipment and a machine-readable medium of the WPF application, which are used for ensuring the realization and the application of the method.
In order to solve the above problems, an embodiment of the present application discloses a touch method for WPF application, which is applied to compatible layer software running on a Linux system, and includes:
Providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
Creating a touch screen data queue and a shared memory according to a call request of the WPF application for the related interface of the touch screen device, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
The embodiment of the application also discloses a touch device of the WPF application, which is applied to a compatible layer environment of a Linux system and comprises:
The interface providing module is used for providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
And the calling processing module is used for creating a touch screen data queue and a shared memory according to a calling request of the WPF application for the related interface of the touch screen device, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
Optionally, the touch screen data processing interface includes: a window touch registration interface and a touch screen data acquisition interface;
the process of acquiring touch screen data according to the touch screen data processing interface comprises the following steps:
Registering a target window of the WPF application as supporting touch control according to the window touch control registration interface in the processing process of the relevant interface of the touch screen device, acquiring touch screen data corresponding to the touch screen device, and converting the touch screen data into touch screen information;
And intercepting the touch screen message by using a hook function, and acquiring touch screen data corresponding to the touch screen message according to the touch screen data acquisition interface.
Optionally, the acquiring touch screen data corresponding to the touch screen device includes:
acquiring touch screen data of a first data structure corresponding to touch screen equipment according to a window system interface provided by a Linux system; or alternatively
And acquiring touch screen data of a first data structure corresponding to the touch screen device according to a device file interface provided by the Linux system for the touch screen device.
Optionally, the converting the touch screen data into a touch screen message includes:
Converting the first data structure touch screen data into second data structure touch screen data;
the first data structure touch screen data corresponds to a first data structure provided by a Linux system, and the second data structure touch screen data corresponds to a second data structure provided by the Windows system.
Optionally, the apparatus further comprises:
And the data conversion module is used for converting the second touch screen data corresponding to the touch screen message into third data structure touch screen data meeting the WPF format requirement by using a hook function.
Optionally, the apparatus further comprises:
the creation module is used for creating a first event for representing that the WPF application finishes reading a group of touch screen data in the shared memory according to a call request of the WPF application for the related interface of the touch screen device, and creating a second event for representing that the WPF application finishes writing a group of touch screen data in the shared memory;
The reading a set of touch screen data from the touch screen data queue each time writes the touch screen data into the shared memory, including:
Judging whether the WPF application finishes reading a group of touch screen data in the shared memory according to the first event so as to obtain a corresponding first judgment result;
if the first judgment result is yes, reading a group of touch screen data from the touch screen data queue, and writing the read group of touch screen data into the shared memory;
after the writing of the group of touch screen data is completed, the state of the second event is set to be a signal state, so that the WPF application can read the group of touch screen data in the shared memory under the condition that the state of the second event is the signal state.
Optionally, the first thread creates a touch screen data queue and a shared memory, and writes touch screen data acquired according to the touch screen data processing interface into the touch screen data queue; and the second thread reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory.
Optionally, the touch screen device related interface includes: a touch screen device management interface and a touch screen device interface; the method for the touch screen device related interface comprises the following steps: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the method for the touch screen device interface comprises the following steps: a method of creating a context object for a touch screen device;
the call request sent by the WPF application for the touch screen device related interface includes:
the WPF application requests a first call of a method of the touch screen device management interface; the first call request is used for acquiring a touch screen device object and a touch screen device interface corresponding to the touch screen device object;
The WPF application requests a second call for a method included in the touch screen device interface for creating a context object of the touch screen device;
the processing procedure of the method for creating the context object of the touch screen device comprises the following steps:
creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle.
Optionally, the touch screen device related interface further includes: a touch screen device context interface; the method for the context interface of the touch screen device comprises the following steps: a shared memory access method; the second call request is used for acquiring a touch screen device context interface of the touch screen device object;
The call request sent by the WPF application for the touch screen device related interface further includes:
The WPF application is used for obtaining a memory handle of the shared memory according to a third call request of the shared memory access method.
The embodiment of the application also discloses an electronic device, which comprises: a processor; and a memory having executable code stored thereon that, when executed, causes the processor to perform a method according to an embodiment of the present application.
Embodiments of the present application also disclose a machine readable medium having stored thereon executable code which, when executed, causes a processor to perform a method according to an embodiment of the present application.
The embodiment of the application has the following advantages:
According to the technical scheme provided by the embodiment of the application, the WPF application can send the call request for the related interface of the touch screen device to the compatible layer software under the condition that the touch control function is required to be used. The processing procedure of the compatible layer software for the call request specifically comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
Because the embodiment of the application utilizes the following transmission paths of touch screen data: touch screen equipment, touch screen data processing interface, touch screen equipment related interface, touch screen data queue, shared memory and WPF application, and the touch screen data generated by the touch screen equipment is transferred to the WPF application, so that the WPF application running on Wine can use a touch control function.
And, the embodiment of the application writes the touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory, so that the WPF application reads a group of touch screen data according to the memory handle. Because the shared memory writing of the touch screen data can be controlled by utilizing the touch screen data queue, the embodiment of the application can solve the problem that the touch screen data is lost due to the fact that the WPF application reads the touch screen data in time to a certain extent.
Drawings
FIG. 1 is a schematic diagram of drawing a graphic on a whiteboard using a multi-touch operation in accordance with one embodiment of the present application;
fig. 2 is a flow chart of a touch method of a WPF application according to an embodiment of the present application;
Fig. 3 is a schematic step flow diagram of a touch method of a WPF application according to an embodiment of the present application;
fig. 4 is a schematic step flow diagram of a touch method of a WPF application according to an embodiment of the present application;
fig. 5 is a schematic step flow diagram of a touch method of a WPF application according to an embodiment of the present application;
Fig. 6 is a schematic structural diagram of a touch device of a WPF application according to an embodiment of the present application;
fig. 7 is a schematic structural view of an apparatus according to an embodiment of the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will become more readily apparent, a more particular description of the application will be rendered by reference to the appended drawings and appended detailed description.
The embodiment of the application can be used for realizing the touch control function of the WPF application in a compatible layer environment. The touch function includes: single touch functions and multi-touch functions.
Single touch refers to a touch operation capable of recognizing and responding to one finger on one screen.
Multi-touch refers to a touch operation capable of simultaneously recognizing and responding to a plurality of touch objects such as fingers or a stylus on one screen.
The characteristics of the multi-point touch specifically comprise:
1. multiple operations can be performed simultaneously, so that the operation efficiency and the response speed are improved;
2. Gesture operation such as zooming, rotating, sliding and the like is supported, so that the gesture operation is more visual and convenient;
3. the multi-user operation is supported, and the method is suitable for scenes such as interactive multi-player games, conferences and the like.
The application scene of the multi-point touch specifically comprises:
1. Personal consumer electronics such as smart phones, touch screen devices, electronic whiteboards, and the like;
2. Information display and interaction of public places such as interactive billboards, exhibition halls, museums and the like;
3. Industrial control, medical equipment, etc., can realize more accurate operation and control.
4. Aviation and aerospace equipment. To a cockpit of a touch screen, rocket control room, etc.
5. Game play, such as multiplayer music games, multiplayer competitive games, and the like.
6. Video editing, design drawing, and the like. The multi-touch control can improve the operation precision when the fine operation is involved.
7. Teaching scenes. The teaching-type application may include whiteboard functionality. In the case where the screen supports touch, a multi-touch operation may be performed on the whiteboard directly using a finger. The functions that the multi-touch operation uses to implement may include, but are not limited to: multiple fingers write pictures simultaneously, double-finger zoom, five-finger erase, etc.
Referring to fig. 1, a schematic diagram of drawing a graphic using a multi-touch operation on a whiteboard according to one embodiment of the present application is shown. Wherein, can use two fingers or two touch-control pens, draw two curves of different colours simultaneously on the whiteboard: a first curve 101 and a second curve 102. Of course, the use of two fingers or two styluses described above is merely an example of multi-touch. In fact, the multi-touch of the embodiments of the present application may support more than two fingers or styluses.
Aiming at the technical problem that the touch function of the WPF application running on Wine cannot be used, the embodiment of the application provides a touch method of the WPF application, and the method can be applied to compatible layer software running on a Linux system and specifically comprises the following steps: providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment; creating a touch screen data queue and a shared memory according to a call request of the WPF application for the related interface of the touch screen device, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the shared memory reads a group of touch screen data according to the memory handle.
The compatible layer software of the embodiment of the application provides a relevant interface of touch screen equipment and a touch screen data processing interface so as to realize the touch control function of the WPF application in a compatible layer environment.
Referring to fig. 2, a flow chart of a touch method of a WPF application according to an embodiment of the present application is shown. Wherein the compatible layer software provides a touch screen device dependent interface and a touch screen data processing interface.
In the case that the touch function is required to be used, the WPF application may send a call request for an interface related to the touch screen device to the compatible layer software.
The processing procedure of the compatible layer software for the call request specifically comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
In fig. 2, the compatible layer software invokes the touch screen data processing interface during the process of processing the call request. The processing procedure of the touch screen data processing interface comprises the following steps: and acquiring touch screen data generated by touch screen equipment such as a touch screen or a touch pad according to the system interface.
The transmission path of the touch screen data specifically comprises: touch screen device- & gt touch screen data processing interface- & gt touch screen device related interface- & gt touch screen data queue- & gt shared memory- & gt WPF application.
In practical application, the shared memory is a section of memory area corresponding to a preset address, and if touch screen data acquired according to the touch screen data processing interface is directly written into the shared memory, the following situations will occur: before the WPF application reads the touch screen data a from the shared memory, the touch screen data B is written by the method of the interface related to the touch screen device, and the touch screen data B will cover the touch screen data a, so that the touch screen data a will be missed.
According to the embodiment of the application, touch screen data acquired according to the touch screen data processing interface is written into the touch screen data queue, and one group of touch screen data is read from the touch screen data queue each time and written into the shared memory, so that the WPF application reads one group of touch screen data according to the memory handle. Because the shared memory writing of the touch screen data can be controlled by utilizing the touch screen data queue, the problem that the touch screen data is lost due to the fact that the WPF application reads the touch screen data in time can be relieved to a certain extent.
In summary, in the technical solution of the embodiment of the present application, the WPF application may send a call request for an interface related to the touch screen device to the compatible layer software when the touch function is required. The processing procedure of the compatible layer software for the call request specifically comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
Because the embodiment of the application utilizes the following transmission paths of touch screen data: touch screen equipment, touch screen data processing interface, touch screen equipment related interface, touch screen data queue, shared memory and WPF application, and the touch screen data generated by the touch screen equipment is transferred to the WPF application, so that the WPF application running on Wine can use a touch control function.
And, the embodiment of the application writes the touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory, so that the WPF application reads a group of touch screen data according to the memory handle. Because the shared memory writing of the touch screen data can be controlled by utilizing the touch screen data queue, the embodiment of the application can solve the problem that the touch screen data is lost due to the fact that the WPF application reads the touch screen data in time to a certain extent.
Method embodiment one
Referring to fig. 3, a schematic step flow diagram of a touch method of a WPF application according to an embodiment of the present application is shown, where the method may be applied to compatible layer software running on a Linux system, and may specifically include the following steps:
step 301, providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
Step 302, creating a touch screen data queue and a shared memory according to a call request of the WPF application for an interface related to the touch screen device, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle.
The method embodiment shown in fig. 3 may be executed by compatible layer software such as Wine, and is used to enable the WPF application running on Wine to use a touch function, that is, to implement the touch function of the WPF application in a compatible layer environment.
In step 301, compatible layer software provides a touch screen device dependent interface and a touch screen data processing interface in a compatible layer environment.
In practical applications, the touch screen device related interface and the touch screen data processing interface may be integrated into a dynamic link library. For example, the touch screen device dependent interface may be integrated into the first dynamic link library such that the WPF application invokes the touch screen device dependent interface via the first dynamic link library. As another example, the touch screen data processing interface may be integrated into the second dynamic link library.
In step 302, the WPF application can be run directly in a Windows system, but cannot be run directly in a Linux system, and needs to run in a compatible layer environment provided by compatible layer software.
In the case where touch functionality is required, the WPF application may send a call request to the compatible layer software for the touch screen device related interface. The processing procedure of the compatible layer software for the call request specifically comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
The touch screen device dependent interface may be a COM (component object model ) interface provided by the Windows system for the touch screen device.
In practical application, the relevant interface of the touch screen device specifically includes: a touch screen device management interface and a touch screen device interface; the method for the relevant interface of the touch screen device specifically comprises the following steps: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the method for the touch screen device interface specifically comprises the following steps: a method of creating a context object for a touch screen device.
The call request sent by the WPF application for the interface related to the touch screen device specifically includes:
the WPF application requests a first call of a method of the touch screen device management interface; the first call request is used for acquiring a touch screen device object and a touch screen device interface corresponding to the touch screen device object;
The WPF application requests a second call for a method included in the touch screen device interface for creating a context object of the touch screen device;
The processing procedure of the method for creating the context object of the touch screen device includes: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle.
In a specific implementation, the WPF application may first call a coceateinstance (object creation function, create a COM object with a specified class identifier) function to obtain a touch screen device management interface; then, the WPF application may call a method for retrieving the number of touch screen devices, where the operating system where the compatible layer software is located includes N touch screen devices, and the method for retrieving the number of touch screen devices may return index identifiers of the N touch screen devices, where N may be a positive integer. Then, the WPF application may invoke a method for retrieving the touch device object, and obtain a touch device interface corresponding to the touch device object identified by a certain index.
The COM interface is actually a pointer to a set of methods, and the touch screen device related interface is inherited from the COM interface; therefore, the method included in the interface related to the touch screen device according to the embodiment of the present application may have a corresponding pointer. After the touch screen device management interface is acquired, a pointer corresponding to a method contained in the touch screen device management interface can be acquired. After the touch screen device interface is acquired, a pointer corresponding to a method contained in the touch screen device interface can be acquired. The pointers described above may be used to invoke corresponding methods.
After acquiring a touch screen device interface corresponding to a touch screen device object of a certain index identifier, the WPF application may call a method for creating a context object of the touch screen device, where a processing procedure of the method for creating the context object of the touch screen device specifically includes: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application.
In a specific implementation, the touch screen data processing interface specifically includes: a window touch registration interface and a touch screen data acquisition interface;
The process of acquiring the touch screen data according to the touch screen data processing interface specifically includes:
A1, registering a target window of the WPF application as supporting touch according to the window touch registration interface in the processing process of the relevant interface of the touch screen device, acquiring touch screen data corresponding to the touch screen device, and converting the touch screen data into touch screen information;
and A2, acquiring touch screen data corresponding to the touch screen message by using a hook function according to the touch screen data acquisition interface.
The window touch registration interface may be configured to register the target window of the WPF application as supporting touch, obtain touch screen data corresponding to a touch screen device, and convert the touch screen data into a touch screen message.
According to the embodiment of the application, the touch screen data corresponding to the touch screen equipment can be obtained according to the system interface of the Linux system. The touch screen data of the embodiment of the application can correspond to different formats or different data structures at different interfaces. Specifically, the touch screen data acquired by the touch screen data processing interface may be touch screen data of a first data structure; the touch screen data acquired by the touch screen device related interface may be touch screen data of a second data structure; the touch screen data acquired by the shared memory may be touch screen data of a third data structure.
In practical application, the system interface specifically includes: a window system interface or a device file interface. Correspondingly, the acquiring mode for acquiring the touch screen data of the first data structure corresponding to the touch screen device specifically includes:
The method comprises the steps of 1, acquiring touch screen data of a first data structure corresponding to touch screen equipment according to a window system interface provided by a Linux system; or alternatively
And 2, acquiring touch screen data of a first data structure corresponding to the touch screen device according to a device file interface provided by a Linux system for the touch screen device.
Examples of window system interfaces may include: xinput2 (input extension 2,X Input Extension 2 of X window system). The X Window system is the next open Window system for graphical user interfaces to Unix-like systems, while XInput provides more advanced input event handling capabilities to developers, especially for supporting touch screens, multi-touch, and other advanced input devices.
XInput2 specifically includes:
Multi-touch support: XInput2 allow applications to obtain information about multiple touch points, which enables developers to implement richer and more interactive touch interfaces.
Improvement of event handling: XInput2 introduces new input event types, including touch events, pointer events, etc., to better accommodate different types of input devices. These events provide more detailed information that enables the application to respond more accurately to the user's input.
Device attribute query: XInput2 allow applications to query the input device for attributes, including physical characteristics and supported functions, to better accommodate different hardware.
Asynchronous event processing: XInput2 support asynchronous event processing, allowing applications to process incoming events without blocking the main event loop.
The introduction of XInput extension enables the X Window system to better adapt to the requirements of modern input equipment, and provides more flexibility and control for developers. The developer may utilize XInput's functionality using Xlib (client side of X window system protocol) libraries or other corresponding libraries to implement a more advanced, more interactive user interface.
In a specific implementation, the process of acquiring the touch screen data of the first data structure corresponding to the touch screen device according to the window system interface provided by the Linux system specifically includes:
acquiring a touch screen device identifier according to a first window system interface provided by a Linux system;
Starting and executing monitoring aiming at the target touch screen equipment identification according to a second window system interface provided by the Linux system;
And acquiring the touch screen data of the first data structure corresponding to the target touch screen equipment identifier from the monitoring data of the target touch screen equipment identifier according to a third window system interface provided by the Linux system.
The first window system interface is configured to obtain a touch screen device Identification (ID) of one or more touch screen devices. And under the condition that the touch screen device identifiers of the plurality of touch screen devices are obtained, the touch screen device identifier of the first touch screen device can be used as the target touch screen device identifier to be monitored.
The second window system interface may be used to turn on and perform listening for the target touch screen device identification.
The second window system interface may set the specified event types in the input event mask so that the application can receive these particular types of events. In particular, according to the embodiment of the present application, the specified event types include: one or more of a touch down event, a hold down event, and a lift up event.
And the third window system interface is used for acquiring the touch screen data of the first data structure corresponding to the target touch screen equipment identifier from the monitoring data of the target touch screen equipment identifier. After the monitoring for the target touch screen device identifier is started and executed, the third window system interface can be circularly called to continuously acquire the touch screen data of the first data structure corresponding to the target touch screen device identifier.
In Linux systems, input devices such as a keyboard, a mouse, and a touch screen device are abstracted into device file interfaces such as/dev/event 0,/dev/event 1, and/dev/event 3. Thus, the device data corresponding to the device file interface can be read by using the reading method. For example, if the device file interface corresponding to the touch screen device is/dev/event 3, the device data corresponding to the/dev/event 3 is read, and thus the touch screen data of the first data structure can be obtained.
The processing procedure of the relevant interface of the touch screen device can convert the touch screen data into touch screen information. The touch screen message is a message in the Windows system for processing touch input. In Windows systems, the input of a touch screen device is abstracted into a series of messages, one of which is the touch screen message. In particular, touch screen messages are messages used to process multi-touch inputs, which provide a mechanism for developers to detect, process, and respond to multi-touch operations performed by users through the touch screen. These operations may include single touch, multi-touch, sliding, rotating, etc. In the Windows messaging system, messaging is one way to communicate between an application program and an operating system. When a particular event occurs, the system generates a corresponding message that is then sent to the associated window or control. A touch screen message is one of the messages used to notify an application when a touch event occurs.
In practical application, the process of converting the touch screen data into the touch screen message specifically includes: converting the touch screen data of the first data structure into touch screen data of a second data structure, and storing touch screen information corresponding to the touch screen data of the second data structure into an information queue of the target window;
the touch screen data of the first data structure corresponds to a first data structure provided by a Linux system, and the touch screen data of the second data structure corresponds to a second data structure provided by the Windows system.
The touch screen data of the first data structure specifically includes: a first touch screen coordinates field, a first touch identification field, and a first touch event type field; the second data structure touch screen data specifically includes: a second touch screen coordinates field, a second touch identification field, and a second touch event type field.
The touch object of the embodiment of the application can comprise: finger or stylus, etc. The touch screen device may include: a touch screen or a touch pad, etc. A touch identifier characterizes a touch object currently performing a touch operation.
The initial value of the touch flag may be 0. Each time a finger is pressed onto the touch screen device, the Linux system will increment the touch identifier by 1 to indicate that a new finger is pressed, and will associate the touch screen device with the touch identifier, so that it can be distinguished that touch data is generated by the touch operation of that finger. The embodiment of the application can acquire the touch screen data corresponding to the touch identifiers respectively, and one touch identifier corresponds to one touch object, so that the embodiment of the application can acquire the touch screen data of the touch objects, and further can realize a multi-point touch function.
In an application example of the present application, assuming that the user wants to draw the graph shown in fig. 1, and assuming that the user first presses the finger a onto the touch screen device, the finger a is used to draw the first curve 101 in fig. 1, an embodiment of the present application may associate the touch screen data of the finger a with the touch identifier 1. Assuming that the user presses finger B onto the touch screen device while holding finger a, finger B is used to draw the second curve 102 in fig. 1, embodiments of the present application may associate touch screen data of finger B with touch identifier 2.
For example, the second data structure touch screen data has a data structure type XIDeviceEvent, where the root_x and root_y fields included in the first touch screen coordinate field indicate touch screen coordinates, the first touch identification field detail indicates a touch ID, and the first touch event type field evtype indicates a touch event type. When the field value of the first touch event type word evtype field is XI_ TouchBegin, the event type representing a touch screen event is a press event; when the field value of the first touch event type field evtype is XI_ TouchUpdate, the event type indicating a touch screen event is a hold event; when the field value of the first touch event type field evtype is XI_ TouchEnd, the event type indicating a touch screen event is a lift event.
For another example, the data structure type of the second data structure touch screen data is TOUCHINPUT, where the second touch screen coordinates field includes x, y fields representing touch screen coordinates, the second touch identification field dwID representing a touch ID, and the second touch event type field dwflag representing a touch screen event. When the field value of the second touch event type field is TOUCHEVENTF _down, the event type indicating the touch event is a press-DOWN event; when the field value of the second touch event type field is TOUCHEVENTF _MOVE, the event type of the touch event is a hold event; when the field value of the second touch event type field is TOUCHEVENTF _up, the event type indicating the touch event is a lift event.
Therefore, the converting the first data structure touch screen data into the second data structure touch screen data includes:
assigning a value to the second touch screen coordinate field according to the field value of the first touch screen coordinate field;
Assigning a value to the second touch identification field according to the field value of the first touch identification field;
And assigning a value to the second touch event type field according to the field value of the first touch event type field.
For example, root_x, root_y of XIDeviceEvent type data may be assigned to x, y of TOUCHINPUT data, and detail of XIDeviceEvent type data may be assigned to dwID. And, it can judge evtype field value of XIDeviceEvent type data, when evtype field value is TouchBegin, dwFlags is assigned to TOUCHEVENTF _DOWN; when the field value of evtype is XI_ TouchUpdate, dwFlags is assigned to TOUCHEVENTF _MOVE; when the field value of evtype is XI_ TouchEnd, dwFlags is assigned to TOUCHEVENTF _UP.
In the embodiment of the application, the message path of Windows specifically comprises: after creating the target window, the WPF application loops to call a get message function that is used to get the message from the message queue.
According to the embodiment of the application, the hook function is arranged in the message acquisition function and is used for intercepting the touch screen message and acquiring the touch screen data corresponding to the touch screen message according to the touch screen data acquisition interface.
In Windows systems, a Message Hook (Message Hook) corresponding to a Hook function is a mechanism for intercepting and processing window messages. This allows developers to monitor and modify messages passed in the system for custom processing before or after the message reaches the target window. In particular, according to the embodiment of the present application, the custom processing of the hook function specifically includes: and intercepting the touch screen message from the message queue, and acquiring touch screen data corresponding to the touch screen message according to the touch screen data acquisition interface.
In actual application, setWindowsHookExA function setup hook functions may be called. The SetWindowsHookExA function is used to install the application-defined hooking process into the hooking chain.
In a specific implementation, after capturing a message, the hook function can determine whether the message is a touch screen message, and if so, can call a touch screen data acquisition interface to acquire touch screen data corresponding to the touch screen message.
Further, the hook function can convert the second touch screen data corresponding to the touch screen message into third data structure touch screen data meeting the WPF format requirement.
The touch screen data of the third data structure specifically comprises: a data header and a data body. Wherein a third touch identification field cid in the data header indicates a touch ID, a third touch event type field dwEvent in the data header indicates a touch event type, and a data volume is used to indicate touch screen coordinates.
The second data structure touch screen data includes a touch screen ID that is incremented by 1 each time it is pressed, while the touch screen ID in the third data structure touch screen data required by the WPF format is fixed. Assuming that the touch screen device supports at most 10 fingers to perform touch operation at the same time, 10 touch screen IDs are generated, and each time one touch screen ID is pressed by a finger, the touch screen ID is recovered by lifting. Assuming that the range of the touch ID in the touch screen data of the third data structure is 0 to 9, the touch screen ID included in the touch screen data of the second data structure may be divided by 10 to obtain a remainder, and the remainder may be assigned to the third touch identification field cid.
The third touch event type field dwEvent in the header may have a value wm_tab_ CURSORDOWN, WM _tab_packet, wm_tab_ CURSORUP, indicating pressing, moving, lifting, respectively, on the touch screen.
DwEvent may be assigned wm_tab_ CURSORDOWN when the field value of the second touch event type field in the second data structure touch screen data is TOUCHEVENTF _down, dwEvent may be assigned wm_tab_ PACKE when the field value of the second touch event type field in the second data structure touch screen data is TOUCHEVENTF _move, and dwEvent may be assigned wm_tab_ CURSORUP when the field value of the second touch event type field in the second data structure touch screen data is TOUCHEVENTF _up.
The data body may include 8 4 bytes of data, the first two 4 bytes representing the touch screen coordinates x, y, the 7 th 4 bytes of content being 1, and the other 4 bytes of content being 0. According to the field structure of the data body, coordinates in touch screen data of the second data structure can be assigned to the first two 4 bytes of the data body.
The hook function may write third data structure touch screen data to the touch screen data queue, one set of third data structure touch screen data at a time.
In an optional implementation manner of the present application, the method of the embodiment of the present application may further include:
Creating a first event for representing that the WPF application finishes reading a group of touch screen data in the shared memory according to a calling request of the WPF application for the related interface of the touch screen device, and creating a second event for representing that the WPF application finishes writing a group of touch screen data in the shared memory;
the process of reading a group of touch screen data from the touch screen data queue and writing the touch screen data into the shared memory each time specifically includes:
Step B1, judging whether the WPF application finishes reading a group of touch screen data in the shared memory according to a first event so as to obtain a corresponding first judgment result;
step B2, under the condition that the first judging result is yes, reading a group of touch screen data from the touch screen data queue, and writing the read group of touch screen data into the shared memory;
And B3, after the writing of a group of touch screen data is completed, setting the state of the second event to be a signal state, so that the WPF application reads a group of touch screen data in the shared memory under the condition that the state of the second event is the signal state.
According to the embodiment of the application, whether the WPF application finishes reading a group of touch screen data in the shared memory or not can be judged according to the first event in a circulating manner, if the WPF application finishes reading, a group of touch screen data can be read from the touch screen data queue, and the read group of touch screen data is written into the shared memory; after the writing of the group of touch screen data is completed, the state of the second event is set to be a signal state, so that the WPF application can read the group of touch screen data in the shared memory under the condition that the state of the second event is the signal state.
According to the embodiment of the application, whether the WPF application finishes reading a group of touch screen data in the shared memory or not is judged according to the first event, and whether the WPF application finishes writing a group of touch screen data or not is judged according to the second event; the first event and the second event can achieve the writing and reading order of a group of touch screen data, so that the problem that the touch screen data is lost due to the fact that the WPF application reads the touch screen data in time can be further relieved.
Before writing the read group of touch screen data into the shared memory, locking the shared memory; and after the writing of a group of touch screen data is completed, the shared memory can be unlocked. The locking and unlocking of the shared content can prevent two or more objects from writing into the shared memory at the same time, so that the data consistency of the shared memory can be improved.
The embodiment of the application does not limit the way of locking the shared memory, for example, a mutex can be adopted to lock the shared memory.
In the embodiment of the application, a first thread creates a touch screen data queue and a shared memory, and writes touch screen data acquired according to the touch screen data processing interface into the touch screen data queue; and the second thread reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory. In practical applications, a set of touch screen data needs to be written in a circulating manner, and after the WPF application finishes reading the previous set of touch screen data, the next set of touch screen data needs to be written in. The operation of writing the touch screen data acquired according to the touch screen data processing interface into the touch screen data queue is usually performed by a hook function, so as to relieve the situation that the hook function is blocked due to overlong waiting time.
In a specific implementation, the interface related to the touch screen device may further include: a touch screen device context interface; the method for the context interface of the touch screen device comprises the following steps: a shared memory access method; the second call request is used for acquiring a touch screen device context interface of the touch screen device object;
The call request sent by the WPF application for the touch screen device related interface may further include: the WPF application is used for obtaining a memory handle of the shared memory according to a third call request of the shared memory access method. The memory handle can be used by the WPF application as a basis for reading touch screen data from the shared memory.
In summary, according to the touch method of the WPF application in the embodiment of the present application, the WPF application may send a call request for an interface related to a touch screen device to compatible layer software under the condition that a touch function is required to be used. The processing procedure of the compatible layer software for the call request specifically comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
Because the embodiment of the application utilizes the following transmission paths of touch screen data: touch screen equipment, touch screen data processing interface, touch screen equipment related interface, touch screen data queue, shared memory and WPF application, and the touch screen data generated by the touch screen equipment is transferred to the WPF application, so that the WPF application running on Wine can use a touch control function.
And, the embodiment of the application writes the touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory, so that the WPF application reads a group of touch screen data according to the memory handle. Because the shared memory writing of the touch screen data can be controlled by utilizing the touch screen data queue, the embodiment of the application can solve the problem that the touch screen data is lost due to the fact that the WPF application reads the touch screen data in time to a certain extent.
Method embodiment II
Referring to fig. 4, a schematic step flow diagram of a touch method of a WPF application according to an embodiment of the present application is shown, where the method may be applied to a WPF application running on a Linux system, and may specifically include the following steps:
in practical application, the compatible layer software provides a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
Wherein, touch screen device related interface includes: a touch screen device management interface, a touch screen device interface, and a touch screen device context interface; the method for the touch screen device related interface comprises the following steps: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the method for the touch screen device interface comprises the following steps: a method of creating a context object for a touch screen device; the method for the context interface of the touch screen device comprises the following steps: a shared memory access method; the second call request is used for acquiring a touch screen device context interface of the touch screen device object.
Step 401, calling an object creation function by the WPF application to acquire a touch screen device management interface;
Step 402, the WPF application calls a method for searching the number of the touch screen devices to acquire index identifiers of N touch screen devices;
step 403, the WPF application invokes a method for retrieving the touch screen device object, and obtains a touch screen device interface corresponding to the touch screen device object with a certain index identifier;
Step 404, the WPF application invokes a method for creating a context object of the touch screen device to acquire a context interface of the touch screen device;
step 405, the WPF application calls a shared memory access method to obtain a memory handle of the shared memory;
in step 406, the WPF application reads touch screen data from the shared memory according to the memory handle.
Method example III
Referring to fig. 5, a schematic step flow diagram of a touch method of a WPF application according to an embodiment of the present application is shown, where the method may be applied to compatible layer software running on a Linux system, and may specifically include the following steps:
step 501, providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
Wherein, touch screen data processing interface includes: a window touch registration interface and a touch screen data acquisition interface;
The touch screen device related interface comprises: a touch screen device management interface, a touch screen device interface, and a touch screen device context interface; the method for the touch screen device related interface comprises the following steps: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the method for the touch screen device interface comprises the following steps: a method of creating a context object for a touch screen device; the method for the context interface of the touch screen device comprises the following steps: a shared memory access method; the second call request is used for acquiring a touch screen device context interface of the touch screen device object.
Step 502, receiving a call request of the WPF application for a method for creating a context object of the touch screen device, wherein the method is included in the interface of the touch screen device;
the following is a process of the method of creating a context object for a touch screen device:
step 503, creating a shared memory for storing touch screen data of a target window;
step 504, creating a mutex for protecting shared memory resources;
Step 505, creating a first event for characterizing that the WPF application completes reading of a set of touch screen data in the shared memory;
step 506, creating a second event for characterizing completion of writing of a set of touch screen data in the shared memory;
step 507, creating a touch screen data queue;
Step 508, calling a window touch registration interface, and starting a function of acquiring touch screen data;
The function of acquiring touch screen data by opening specifically includes: registering a target window of the WPF application as supporting touch control, acquiring touch screen data corresponding to touch screen equipment, and converting the touch screen data into touch screen information.
Step 509, setting a hook function in the acquired message function;
step 510, capturing a touch screen message by using a hook function, acquiring touch screen data corresponding to the touch screen message according to the touch screen data acquisition interface, and storing the touch screen data to a touch screen data queue;
Assume steps 503 to 510 are performed by a first thread.
Step 511, starting a second thread, and using the second thread to read touch screen data from the touch screen data queue according to the mutex, the first event and the second event, and writing the touch screen data into the shared memory.
The second thread reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory, and the specific writing process comprises the following steps:
Judging whether the WPF application finishes reading a group of touch screen data in the shared memory according to the first event so as to obtain a corresponding first judgment result;
if the first judgment result is yes, reading a group of touch screen data from the touch screen data queue, and writing the read group of touch screen data into the shared memory;
after the writing of the group of touch screen data is completed, the state of the second event is set to be a signal state, so that the WPF application can read the group of touch screen data in the shared memory under the condition that the state of the second event is the signal state.
In summary, by means of the compatible layer software of the embodiment of the application, the WPF application can normally use the touch screen function under the Linux system, thereby facilitating the migration of the WPF application from the Windows system to the Linux system and expanding the application range of the WPF application.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the application.
On the basis of the foregoing embodiment, this embodiment further provides a touch device for WPF application, and referring to fig. 6, the device is applied to a compatible layer environment of a Linux system, and may specifically include: an interface providing module 401 and a call processing module 402.
The interface providing module 401 is configured to provide a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
And the call processing module 402 is configured to create a touch screen data queue and a shared memory according to a call request of the WPF application for an interface related to the touch screen device, write touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, read a set of touch screen data from the touch screen data queue each time, write the touch screen data into the shared memory, and return a memory handle of the shared memory to the WPF application, so that the WPF application reads a set of touch screen data according to the memory handle.
Optionally, the touch screen data processing interface specifically includes: a window touch registration interface and a touch screen data acquisition interface;
the process of acquiring the touch screen data according to the touch screen data processing interface specifically includes:
in the processing process of the related interface of the touch screen device, registering the target window of the WPF application as supporting touch control according to the window touch control registration interface, acquiring touch screen data corresponding to the touch screen device, and converting the touch screen data into touch screen information;
And intercepting the touch screen message by using a hook function, and acquiring touch screen data corresponding to the touch screen message according to the touch screen data acquisition interface.
Optionally, the acquiring touch screen data corresponding to the touch screen device specifically includes:
acquiring touch screen data of a first data structure corresponding to touch screen equipment according to a window system interface provided by a Linux system; or alternatively
And acquiring touch screen data of a first data structure corresponding to the touch screen device according to a device file interface provided by the Linux system for the touch screen device.
Optionally, the converting the touch screen data into a touch screen message may include:
Converting the first data structure touch screen data into second data structure touch screen data;
the touch screen data of the first data structure corresponds to a first data structure provided by a Linux system, and the touch screen data of the second data structure corresponds to a second data structure provided by the Windows system.
Optionally, the apparatus further includes:
And the data conversion module is used for converting the second touch screen data corresponding to the touch screen message into third data structure touch screen data meeting the WPF format requirement by using a hook function.
Optionally, the apparatus may further include:
The creation module is used for creating a first event for representing that the WPF application finishes reading a group of touch screen data in the shared memory according to a calling request of the WPF application for the related interface of the touch screen device, and creating a second event for representing that the WPF application finishes writing a group of touch screen data in the shared memory;
The reading a set of touch screen data from the touch screen data queue each time writes the touch screen data into the shared memory, including:
Judging whether the WPF application finishes reading a group of touch screen data in the shared memory according to the first event so as to obtain a corresponding first judgment result;
if the first judgment result is yes, reading a group of touch screen data from the touch screen data queue, and writing the read group of touch screen data into the shared memory;
after the writing of the group of touch screen data is completed, the state of the second event is set to be a signal state, so that the WPF application can read the group of touch screen data in the shared memory under the condition that the state of the second event is the signal state.
Optionally, the first thread creates a touch screen data queue and a shared memory, and writes touch screen data acquired according to the touch screen data processing interface into the touch screen data queue; the second thread reads a group of touch screen data from the touch screen data queue and writes the touch screen data into the shared memory each time.
Optionally, the touch screen device related interface includes: a touch screen device management interface and a touch screen device interface; the method for the related interface of the touch screen device comprises the following steps: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the method for the touch screen device interface comprises the following steps: a method of creating a context object for a touch screen device;
the call request sent by the WPF application for the touch screen device related interface specifically includes:
The WPF application requests a first call of a method of the touch screen device management interface; the first call request is used for acquiring a touch screen device object and a touch screen device interface corresponding to the touch screen device object;
The WPF application requests a second call for a method included in the touch screen device interface for creating a context object of the touch screen device;
The processing procedure of the method for creating the context object of the touch screen device specifically comprises the following steps:
Creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle.
Optionally, the touch screen device related interface may further include: a touch screen device context interface; the method for the context interface of the touch screen device comprises the following steps: a shared memory access method; the second call request is used for acquiring a touch screen device context interface of the touch screen device object;
the call request sent by the WPF application for the touch screen device related interface further includes:
The WPF application is used for obtaining a memory handle of the shared memory according to a third call request of the shared memory access method.
In summary, in the touch device of the WPF application in the embodiment of the present application, the WPF application may send a call request for an interface related to a touch screen device to compatible layer software under the condition that a touch function is required to be used. The processing procedure of the compatible layer software for the call request specifically comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application can read a group of touch screen data according to the memory handle.
Because the embodiment of the application utilizes the following transmission paths of touch screen data: touch screen equipment, touch screen data processing interface, touch screen equipment related interface, touch screen data queue, shared memory and WPF application, and the touch screen data generated by the touch screen equipment is transferred to the WPF application, so that the WPF application running on Wine can use a touch control function.
And, the embodiment of the application writes the touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory, so that the WPF application reads a group of touch screen data according to the memory handle. Because the shared memory writing of the touch screen data can be controlled by utilizing the touch screen data queue, the embodiment of the application can solve the problem that the touch screen data is lost due to the fact that the WPF application reads the touch screen data in time to a certain extent.
The embodiment of the application also provides a non-volatile readable storage medium, where one or more modules (programs) are stored, where the one or more modules are applied to a device, and the instructions (instructions) of each method step in the embodiment of the application may cause the device to execute.
Embodiments of the application provide one or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause an electronic device to perform a method as described in one or more of the above embodiments. In the embodiment of the application, the electronic equipment comprises various types of equipment such as terminal equipment, servers (clusters) and the like.
Embodiments of the present disclosure may be implemented as an apparatus for performing a desired configuration using any suitable hardware, firmware, software, or any combination thereof, which may include: terminal equipment, servers (clusters), and other electronic devices. Fig. 7 schematically illustrates an exemplary apparatus 1100 that may be used to implement various embodiments described in the present disclosure.
For one embodiment, fig. 7 illustrates an example apparatus 1100 having one or more processors 1102, a control module (chipset) 1104 coupled to at least one of the processor(s) 1102, a memory 1106 coupled to the control module 1104, a non-volatile memory/storage device 1108 coupled to the control module 1104, one or more input/output devices 1110 coupled to the control module 1104, and a network interface 1112 coupled to the control module 1104.
The processor 1102 may include one or more single-core or multi-core processors, and the processor 1102 may include any combination of general-purpose or special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the apparatus 1100 can be used as a terminal device, a server (cluster), or the like in the embodiments of the present application.
In some embodiments, the apparatus 1100 may include one or more computer-readable media (e.g., memory 1106 or nonvolatile memory/storage 1108) having instructions 1114 and one or more processors 1102 combined with the one or more computer-readable media configured to execute the instructions 1114 to implement the modules to perform the actions described in this disclosure.
For one embodiment, the control module 1104 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1102 and/or any suitable device or component in communication with the control module 1104.
The control module 1104 may include a memory controller module to provide an interface to the memory 1106. The memory controller modules may be hardware modules, software modules, and/or firmware modules.
Memory 1106 may be used to load and store data and/or instructions 1114 for device 1100, for example. For one embodiment, memory 1106 may include any suitable volatile memory, such as, for example, a suitable DRAM (dynamic random Access memory ). In some embodiments, memory 1106 may comprise a double data rate type four synchronous dynamic random access memory.
For one embodiment, the control module 1104 may include one or more input/output controllers to provide interfaces to the non-volatile memory/storage 1108 and the input/output device(s) 1110.
For example, nonvolatile memory/storage 1108 may be used to store data and/or instructions 1114. The non-volatile memory/storage 1108 may include any suitable non-volatile memory (e.g., flash memory) and/or may include any suitable non-volatile storage device(s) (e.g., hard disk drive(s), optical disk drive(s), and/or digital versatile disk drive (s)).
The non-volatile memory/storage 1108 may include a storage resource that is physically part of the device on which the apparatus 1100 is installed, or it may be accessible by the device, or it may not be necessarily part of the device. For example, nonvolatile memory/storage 1108 may be accessed over a network via input/output device(s) 1110.
Input/output device(s) 1110 may provide an interface for apparatus 1100 to communicate with any other suitable device, input/output device 1110 may include communication components, audio components, sensor components, and the like. The network interface 1112 may provide an interface for the device 1100 to communicate over one or more networks, and the device 1100 may communicate wirelessly with one or more components of a wireless network according to any of one or more wireless network standards and/or protocols, such as accessing a wireless network based on a communication standard, such as WiFi (wireless fidelity ), 2G (second generation wireless communication technology, 2-Generation wireless telephone technology), 3G (third generation wireless communication technology, 3-Generation wireless telephone technology), 4G (fourth generation wireless communication technology, 4-Generation wireless telephone technology), 5G (fifth generation wireless communication technology, 5-Generation wireless telephone technology), etc., or a combination thereof.
For one embodiment, at least one of the processor(s) 1102 may be packaged together with logic of one or more controllers (e.g., memory controller modules) of the control module 1104. For one embodiment, at least one of the processor(s) 1102 may be packaged together with logic of one or more controllers of the control module 1104 to form a system-in-package. For one embodiment, at least one of the processor(s) 1102 may be integrated on the same mold as logic of one or more controllers of the control module 1104. For one embodiment, at least one of the processor(s) 1102 may be integrated on the same die with logic of one or more controllers of the control module 1104 to form a system-on-chip.
In various embodiments, apparatus 1100 may be, but is not limited to being: a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a touch screen device, a netbook, etc.). In various embodiments, device 1100 may have more or fewer components and/or different architectures. For example, in some embodiments, the apparatus 1100 includes one or more cameras, keyboards, liquid crystal display screens (including touch screen displays), non-volatile memory ports, multiple antennas, graphics chips, application specific integrated circuits, and speakers.
The detection device can adopt a main control chip as a processor or a control module, sensor data, position information and the like are stored in a memory or a nonvolatile memory/storage device, a sensor group can be used as an input/output device, and a communication interface can comprise a network interface.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the application.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or terminal device that comprises the element.
The above detailed description of a touch method and apparatus for WPF application, an electronic device and a machine readable medium provided by the present application, the specific examples are applied to illustrate the principles and embodiments of the present application, and the above description of the examples is only used to help understand the method and core idea of the present application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (9)

1. The touch control method for the WPF window presenting basic application is characterized by being applied to compatible layer software running on a Linux system and comprising the following steps of:
Providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
Creating a touch screen data queue and a shared memory according to a call request sent by the WPF application for the related interface of the touch screen device, creating a first event for representing that the WPF application finishes reading a group of touch screen data in the shared memory, and creating a second event for representing that the WPF application finishes writing a group of touch screen data in the shared memory; writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application so that the WPF application reads a group of touch screen data according to the memory handle;
wherein each time a group of touch screen data is read from the touch screen data queue and written into the shared memory, the method comprises the following steps: judging whether the WPF application finishes reading a group of touch screen data in the shared memory according to the first event so as to obtain a corresponding first judgment result; if the first judgment result is yes, reading a group of touch screen data from the touch screen data queue, and writing the read group of touch screen data into the shared memory; after the writing of a group of touch screen data is completed, setting the state of the second event to be a signal state, so that the WPF application reads the group of touch screen data in the shared memory under the condition that the state of the second event is the signal state;
The touch screen device related interface comprises: a touch screen device management interface, a touch screen device interface, and a touch screen device context interface; the touch screen device management interface includes: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the touch screen device interface includes: a method of creating a context object for a touch screen device; the touch screen device context interface includes: a shared memory access method;
the call request sent by the WPF application for the touch screen device related interface comprises the following steps:
the WPF application is used for sending a first call request aiming at a method of a touch screen device management interface; the first call request is used for acquiring a touch screen device object and a touch screen device interface corresponding to the touch screen device object;
The WPF application sends a second call request aiming at a method for creating a context object of the touch screen device, wherein the method is contained in the interface of the touch screen device; the second call request is used for acquiring a touch screen device context interface of the touch screen device object;
The WPF application sends a third call request aiming at a shared memory access method, wherein the third call request is used for acquiring a memory handle of the shared memory;
The processing procedure of the method for creating the context object of the touch screen device comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle.
2. The method of claim 1, wherein the touch screen data processing interface comprises: a window touch registration interface and a touch screen data acquisition interface;
the process of acquiring touch screen data according to the touch screen data processing interface comprises the following steps:
Registering a target window of the WPF application as supporting touch control according to the window touch control registration interface in the processing process of the relevant interface of the touch screen device, acquiring touch screen data corresponding to the touch screen device, and converting the touch screen data into touch screen information;
And intercepting the touch screen message by using a hook function, and acquiring touch screen data corresponding to the touch screen message according to the touch screen data acquisition interface.
3. The method according to claim 2, wherein the obtaining touch screen data corresponding to the touch screen device includes:
acquiring touch screen data of a first data structure corresponding to touch screen equipment according to a window system interface provided by a Linux system; or alternatively
And acquiring touch screen data of a first data structure corresponding to the touch screen device according to a device file interface provided by the Linux system for the touch screen device.
4. The method of claim 2, wherein the converting the touch screen data into a touch screen message comprises:
Converting the first data structure touch screen data into second data structure touch screen data;
the first data structure touch screen data corresponds to a first data structure provided by a Linux system, and the second data structure touch screen data corresponds to a second data structure provided by the Windows system.
5. The method according to claim 2, wherein the method further comprises:
And converting the touch screen data of the second data structure corresponding to the touch screen message into touch screen data of a third data structure meeting the WPF format requirement by using a hook function.
6. The method of claim 1, wherein a first thread creates a touch data queue and shared memory and writes touch data acquired according to the touch data processing interface into the touch data queue; and the second thread reads a group of touch screen data from the touch screen data queue each time and writes the touch screen data into the shared memory.
7. The touch device for the WPF window presentation basic application is characterized in that the device is applied to a compatible layer environment of a Linux system and comprises:
The interface providing module is used for providing a touch screen device related interface and a touch screen data processing interface in a compatible layer environment;
The calling processing module is used for creating a first event for representing that the WPF application finishes reading a group of touch screen data in the shared memory according to a calling request sent by the WPF application for the related interface of the touch screen device, and creating a second event for representing that the WPF application finishes writing a group of touch screen data in the shared memory; creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle;
wherein each time a group of touch screen data is read from the touch screen data queue and written into the shared memory, the method comprises the following steps: judging whether the WPF application finishes reading a group of touch screen data in the shared memory according to the first event so as to obtain a corresponding first judgment result; if the first judgment result is yes, reading a group of touch screen data from the touch screen data queue, and writing the read group of touch screen data into the shared memory; after the writing of a group of touch screen data is completed, setting the state of the second event to be a signal state, so that the WPF application reads the group of touch screen data in the shared memory under the condition that the state of the second event is the signal state;
The touch screen device related interface comprises: a touch screen device management interface, a touch screen device interface, and a touch screen device context interface; the touch screen device management interface includes: a method for searching the number of touch screen devices and a method for searching the objects of the touch screen devices; the touch screen device interface includes: a method of creating a context object for a touch screen device; the touch screen device context interface includes: a shared memory access method;
the call request sent by the WPF application for the touch screen device related interface comprises the following steps:
the WPF application is used for sending a first call request aiming at a method of a touch screen device management interface; the first call request is used for acquiring a touch screen device object and a touch screen device interface corresponding to the touch screen device object;
The WPF application sends a second call request aiming at a method for creating a context object of the touch screen device, wherein the method is contained in the interface of the touch screen device; the second call request is used for acquiring a touch screen device context interface of the touch screen device object;
The WPF application sends a third call request aiming at a shared memory access method, wherein the third call request is used for acquiring a memory handle of the shared memory;
The processing procedure of the method for creating the context object of the touch screen device comprises the following steps: creating a touch screen data queue and a shared memory, writing touch screen data acquired according to the touch screen data processing interface into the touch screen data queue, reading a group of touch screen data from the touch screen data queue each time, writing the touch screen data into the shared memory, and returning a memory handle of the shared memory to the WPF application, so that the WPF application reads a group of touch screen data according to the memory handle.
8. An electronic device, comprising: a processor; and
A memory having executable code stored thereon that, when executed, causes the processor to perform the method of any of claims 1-6.
9. A machine readable medium having stored thereon executable code which when executed causes a processor to perform the method of any of claims 1-6.
CN202410372761.3A 2024-03-29 Touch control method, device, equipment and medium of WPF application Active CN117971108B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410372761.3A CN117971108B (en) 2024-03-29 Touch control method, device, equipment and medium of WPF application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410372761.3A CN117971108B (en) 2024-03-29 Touch control method, device, equipment and medium of WPF application

Publications (2)

Publication Number Publication Date
CN117971108A CN117971108A (en) 2024-05-03
CN117971108B true CN117971108B (en) 2024-06-04

Family

ID=

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103492978A (en) * 2010-10-05 2014-01-01 西里克斯系统公司 Touch support for remoted applications
CN104834468A (en) * 2015-04-24 2015-08-12 青岛海信移动通信技术股份有限公司 Touch operation method and touch operation device in terminal
CN104881203A (en) * 2015-04-24 2015-09-02 青岛海信移动通信技术股份有限公司 Touch operation method and device in terminal
CN109062433A (en) * 2018-07-23 2018-12-21 广州视源电子科技股份有限公司 Method, apparatus, smart machine and the storage medium of touch data processing
CN112068761A (en) * 2020-08-26 2020-12-11 北京小米移动软件有限公司 Touch screen data processing method, touch screen data processing device and storage medium
CN113687898A (en) * 2021-08-24 2021-11-23 天津津航计算技术研究所 QT development-based multi-point touch function implementation method under road system
CN116400846A (en) * 2023-05-11 2023-07-07 深圳市瑞云科技股份有限公司 Realization method, equipment and medium for simulating touch operation 3D application
CN117349132A (en) * 2023-09-28 2024-01-05 中科方德软件有限公司 Window monitoring method and device and readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103492978A (en) * 2010-10-05 2014-01-01 西里克斯系统公司 Touch support for remoted applications
CN104834468A (en) * 2015-04-24 2015-08-12 青岛海信移动通信技术股份有限公司 Touch operation method and touch operation device in terminal
CN104881203A (en) * 2015-04-24 2015-09-02 青岛海信移动通信技术股份有限公司 Touch operation method and device in terminal
CN109062433A (en) * 2018-07-23 2018-12-21 广州视源电子科技股份有限公司 Method, apparatus, smart machine and the storage medium of touch data processing
CN112068761A (en) * 2020-08-26 2020-12-11 北京小米移动软件有限公司 Touch screen data processing method, touch screen data processing device and storage medium
CN113687898A (en) * 2021-08-24 2021-11-23 天津津航计算技术研究所 QT development-based multi-point touch function implementation method under road system
CN116400846A (en) * 2023-05-11 2023-07-07 深圳市瑞云科技股份有限公司 Realization method, equipment and medium for simulating touch operation 3D application
CN117349132A (en) * 2023-09-28 2024-01-05 中科方德软件有限公司 Window monitoring method and device and readable storage medium

Similar Documents

Publication Publication Date Title
US8477143B2 (en) Buffers for display acceleration
CN106843715B (en) Touch support for remoted applications
CN110300328B (en) Video playing control method and device and readable storage medium
JP2013542515A (en) Redirection between different environments
JP2013546043A (en) Instant remote rendering
CN112055072B (en) Cloud audio input method and device, cloud system, electronic equipment and storage medium
US10055388B2 (en) Declarative style rules for default touch behaviors
TW201601059A (en) Methods for screen sharing and apparatuses using the same
US10983625B2 (en) Systems and methods for measurement of unsupported user interface actions
WO2022199283A1 (en) Method and apparatus for determining object of call stack frame, device, and medium
US9383908B2 (en) Independent hit testing
CN110807161A (en) Page framework rendering method, device, equipment and medium
CN112131208A (en) Full data migration method, device and equipment and computer readable storage medium
CN115421787A (en) Instruction execution method, apparatus, device, system, program product, and medium
CN117971108B (en) Touch control method, device, equipment and medium of WPF application
CN101533314B (en) Method for positioning terminal by cursor, system thereof and terminal controller
WO2020207083A1 (en) Information sharing method and apparatus, and electronic device and computer-readable storage medium
CN113157439B (en) Resource statistics method, device and terminal
CN117971108A (en) Touch control method, device, equipment and medium of WPF application
US9589126B2 (en) Lock control method and electronic device thereof
WO2022242419A1 (en) Partition creation method and apparatus, and storage medium and computer device
US20150074530A1 (en) Method for controlling content in mobile electronic device
CN107390981B (en) Global menu control method, device, equipment and storage medium
WO2013185664A1 (en) Operating method and device
CN115639920B (en) Drawing method, electronic device, and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant