The gas that usually causes the most pain is in your body cavity after surgery. Gax X and the like will only influence the gas that is in your stomach/digestive system, which may or may not be a problem.
Walk as soon as you can and walk often. When I was at the hospital, the nurses also put heating pads across my shoulders. They said the gas has to work its way out of the body cavity through the shoulders and the heating pads help draw it out. I can't say if that is a scientific fact or not, but the heating pads felt good, and my gas pains were gone after day 2. Atworst, it feels good, and at best it helps get the gas out. So, it's worth a try. I'd ask them to do that at the hospital too.